
This app demonstrates four-panel-comic generation using the Inworld Runtime and the Minimax Image Generation API. Check out our video for a walkthrough of this demo.
Install dependencies:
npm install
Configure environment variables:
Create a .env file in the root directory:
MINIMAX_API_KEY=your_minimax_api_key
INWORLD_API_KEY=your_inworld_api_key
You can request a Minimax API key here and an Inworld API key here.
Run the application:
For development (with auto-reload on file changes):
npm run dev
For production:
npm run build
npm start
Then open your browser and navigate to http://localhost:3000 to access the comic generation interface.
The comic generator uses the Inworld Runtime SDK to create a graph-based processing pipeline that transforms user input into complete comics through multiple AI processing stages.
User Input → Story Generator → LLM (OpenAI) → Response Parser → Image Generator (Minimax) → Final Comic
comic-generator/
├── src/ # Source code
│ ├── index.ts # Main server with graph orchestration
│ ├── comic_story_node.ts # Custom node for story prompt generation
│ └── comic_image_node.ts # Custom node for image generation via Minimax
├── public/ # Static assets (HTML UI)
│ └── index.html # Web interface for testing
├── dist/ # Compiled JavaScript (generated)
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This file
comic_story_node.ts)Custom node that extends CustomNode to create structured prompts for comic generation.
Input: ComicStoryInput
interface ComicStoryInput {
character1Description: string;
character2Description: string;
artStyle: string;
theme?: string;
}
Output: GraphTypes.LLMChatRequest - Formatted prompt for the LLM
Key Features:
comic_image_node.ts)Handles the image generation for all 4 comic panels using the Minimax API.
Input: ComicStoryOutput - Structured comic story data
Output: ComicImageOutput - Comic with generated image URLs
Converts the LLM's JSON response into structured ComicStoryOutput format.
Features:
const graphBuilder = new GraphBuilder({
id: 'comic_generator',
apiKey: process.env.INWORLD_API_KEY!,
});
const executor = graphBuilder
.addNode(node1)
.addNode(node2)
.addEdge(node1, node2)
.setStartNode(node1)
.setEndNode(node2)
.build();
const executionId = uuidv4();
const outputStream = await executor.start(input, executionId);
for await (const result of outputStream) {
if (result.nodeId === 'target-node-id') {
// Handle result
break;
}
}
executor.closeExecution(outputStream);
Bug Reports: GitHub Issues
General Questions: For general inquiries and support, please email us at support@inworld.ai
We welcome contributions! Please see CONTRIBUTING.md for guidelines on how to contribute to this project.
This project is licensed under the MIT License — see the LICENSE file for details.