A simple library for writing stories in ready-to-publish markdown format using LLMs.
Storymaker is a Python tool that helps generate creative stories using Large Language Models (LLMs). It provides a complete workflow from character creation to story generation, enhancement, and publishing-ready output in Markdown format.
- Character Creation: Generate detailed character profiles based on input prompts
- Story Generation: Create compelling stories with defined characters and themes
- Story Enhancement: Improve generated stories through multiple refinement steps
- Automatic Formatting: Generate publication-ready markdown files with proper frontmatter
- Model Flexibility: Configure different LLM models for each generation step
- Theme Selection: Choose from predefined themes or specify your own
# From PyPI
pip install storymaker
# From source
git clone https://github.com/passive-radio/storymaker.git
cd storymaker
pip install -e .- Python 3.10 or higher
- OpenAI API key (or OpenRouter API key)
- Required packages:
- openai
- pydantic
- python-dotenv
- tiktoken
- json5
Storymaker provides a simple CLI with two main commands:
storymaker character -i input_news.md -o characters.md -m manuscript.json5 -e .env-i, --input: Input file containing news or context for character creation-o, --output: Output file to save the generated character profiles-m, --manuscript: Optional JSON5 file specifying LLM models for each step-e, --env: Optional environment file with API keys
storymaker story -i characters.md -o output_directory -m manuscript.json5 -e .env-i, --input: Input file containing character profiles-o, --output_dir: Output directory for generated stories-m, --manuscript: Optional JSON5 file specifying LLM models for each step-e, --env: Optional environment file with API keys
You can also use Storymaker programmatically:
from storymaker.create_character import CharacterMaker
from storymaker.create_story import StoryMaker
# Create characters
character_maker = CharacterMaker("manuscript.json5", ".env")
news = "Some news or context for character creation..."
character_maker.process_steps(news, "characters.md")
# Create story
story_maker = StoryMaker("manuscript.json5", ".env")
with open("characters.md", "r") as f:
characters = f.read()
story_maker.process_steps(characters, "output_dir", theme="ディストピア")The manuscript file (JSON5 format) allows you to configure different models and parameters for each step of the generation process:
{
"characters": {
"model": "google/gemini-2.5-pro-preview",
"temperature": 0.7,
"top_p": 0.85,
},
"story": {
"model": "openai/o3",
"temperature": 0.8,
"top_p": 0.85,
},
"title_and_synopsis": {
"model": "openai/o1-mini",
"temperature": 0.6,
"top_p": 0.6,
},
"enhance_story1": {
"model": "openai/o3",
"temperature": 0.8,
"top_p": 0.85,
},
"enhance_story2": {
"model": "openai/o3",
"temperature": 0.8,
"top_p": 0.85,
},
"frontmatter": {
"model": "openai/gpt-4.1",
"temperature": 0,
"top_p": 0,
},
}Create a .env file with your API keys:
OPENAI_API_KEY=your_openai_api_key
OPENROUTER_API_KEY=your_openrouter_api_keyThe library generates two main files:
story.md: The raw story contentfinal.md: Publication-ready story with proper frontmatter
This project is licensed under the MIT License - see the LICENSE file for details.