Turn one story idea into a validated four-panel comic.
Quick start · How it works · Image providers · Contributing · 简体中文
Plot2Panel is a self-hosted AI comic generator. DeepSeek turns a short premise into a typed ComicPlan with characters, story beats, dialogue, and image prompts. A separate image provider renders the artwork while the interface keeps narration and dialogue readable as HTML.
V0.1 deliberately has no accounts, database, queue, or persistence. Provider keys stay on the server, generated results live in the current browser session, and one failed image never discards the other panels.
| Landing page | Comic Studio |
|---|---|
![]() |
![]() |
These screenshots come from the local V0.1 application. The completed example shows the generated artwork, narration, dialogue, and character cards in one workflow. A hosted demo is not available yet.
- Converts one premise into exactly four connected panels: setup, development, turn, and payoff.
- Produces a validated title, cast, narration, dialogue, visual direction, and standalone image prompt.
- Supports suspense, horror, action, xianxia, comedy, and sci-fi genres.
- Supports cartoon, realistic, stylized 3D, and anime art direction in Chinese or English.
- Repairs invalid model output once, then returns a safe and actionable error.
- Renders panels concurrently and supports isolated regeneration when one image fails.
- Keeps every model SDK and API key behind server-only provider boundaries.
- Includes SiliconFlow, Together, Pollinations, and an explicitly selected local placeholder provider.
flowchart LR
A["Story idea"] --> B["POST /api/comics/plan"]
B --> C["DeepSeek planner"]
C --> D["Validated ComicPlan"]
D --> E["POST /api/images/generate"]
E --> F["Selected image provider"]
F --> G["Four independently rendered panels"]
ComicPlan is the core domain contract. Zod validates all external model output before it reaches the UI, including cross-field character references and the requested genre, style, and language. Image calls settle independently, so successful panels remain available when another panel needs regeneration.
The browser never imports an AI SDK or receives a provider credential:
Browser → Next.js Route Handler → Provider interface → External model API
See ADR 0001 for the provider-boundary decision.
- Node.js 20.9 or later
- pnpm 10
- A DeepSeek API key for story planning
- An image-provider key unless you intentionally choose Pollinations or the local placeholder
git clone https://github.com/kdjfs/plot2panel.git
cd plot2panel
corepack enable
pnpm install
cp .env.example .env.local
pnpm devOn Windows PowerShell, replace the copy command with:
Copy-Item .env.example .env.localAdd your credentials to .env.local, then open http://localhost:3000.
The recommended setup uses DeepSeek for text planning and SiliconFlow for image generation:
DEEPSEEK_API_KEY=replace-with-your-deepseek-key
DEEPSEEK_BASE_URL=https://api.deepseek.com
DEEPSEEK_MODEL=deepseek-v4-pro
IMAGE_PROVIDER=siliconflow
SILICONFLOW_API_KEY=replace-with-your-siliconflow-key
SILICONFLOW_IMAGE_MODEL=Tongyi-MAI/Z-Image-Turbo| Variable | Required | Default | Purpose |
|---|---|---|---|
DEEPSEEK_API_KEY |
Yes | — | Authenticates story-planning requests. |
DEEPSEEK_BASE_URL |
No | https://api.deepseek.com |
Overrides the DeepSeek-compatible endpoint. |
DEEPSEEK_MODEL |
No | deepseek-v4-pro |
Selects the text-planning model. |
IMAGE_PROVIDER |
No | siliconflow |
Selects siliconflow, together, pollinations, or mock. |
SILICONFLOW_API_KEY |
For SiliconFlow | — | Authenticates SiliconFlow image requests. |
SILICONFLOW_IMAGE_MODEL |
No | Tongyi-MAI/Z-Image-Turbo |
Selects the SiliconFlow image model. |
TOGETHER_API_KEY |
For Together | — | Authenticates Together image requests. |
TOGETHER_IMAGE_MODEL |
No | black-forest-labs/FLUX.1-schnell |
Selects the Together image model. |
Existing Anthropic-compatible DeepSeek shell setups may use ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, and ANTHROPIC_MODEL as fallbacks. New installations should prefer the explicit DEEPSEEK_* variables.
Never prefix provider keys with NEXT_PUBLIC_, commit .env.local, or paste a real credential into an issue or screenshot.
| Provider | Configuration | Best for | Notes |
|---|---|---|---|
| SiliconFlow | IMAGE_PROVIDER=siliconflow |
Users in China; balanced quality and cost | Recommended default. Follow the Chinese setup guide. |
| Together | IMAGE_PROVIDER=together |
Hosted FLUX-compatible generation | Requires a Together key and supported model. |
| Pollinations | IMAGE_PROVIDER=pollinations |
Keyless experiments | Convenient, but output quality and availability are not guaranteed. |
| Local placeholder | IMAGE_PROVIDER=mock |
UI development and deterministic tests | Produces labeled SVG placeholders, not AI artwork. |
DeepSeek plans the comic; it does not render images through the configured chat endpoint. A dedicated image provider always owns artwork generation.
src/
├── app/ # Pages and server Route Handlers
├── components/ # Landing page and Comic Studio UI
├── data/ # Curated story starters
├── features/comic-generation/ # ComicPlan schema, reducer, and types
└── server/
├── agents/ # Comic planning orchestration
├── prompts/ # Planning, repair, and image prompts
└── providers/ # DeepSeek and image-provider adapters
tests/ # Deterministic unit tests
docs/ # Setup guides and architecture decisions
Run the same quality gates used by CI:
pnpm lint
pnpm typecheck
pnpm test
pnpm buildTests are deterministic and do not call paid external APIs.
- Validated four-panel planning with DeepSeek
- Concurrent image rendering and per-panel regeneration
- SiliconFlow, Together, Pollinations, and local placeholder providers
- Stronger cross-panel character consistency
- Persistent project history and exported comic strips
- Continue-story and alternative-ending workflows
- Additional text and image providers
Contributions are welcome. Read CONTRIBUTING.md before opening a pull request. Report vulnerabilities privately as described in SECURITY.md; never include provider credentials in a public issue.
Plot2Panel is an independent implementation inspired by make-comics, Comic-Studio-Ai, and AI Comic Factory. Those projects did not participate in Plot2Panel development.
Released under the MIT License. Copyright © 2026 Liufengwei.


