par-storygen
Table of Contents
- About
- Features
- Screenshots
- Prerequisites
- Installing
- Command line arguments
- Environment Variables
- Data locations
- Running par-storygen
- Choosing a text model
- Choosing an image model
- Character library
- Replay and endings
- Branch prefetch
- Character outfits
- Text-to-speech
- Auto-play
- Export book
- Keyboard shortcuts
- Web API and frontend (optional)
- Troubleshooting
- Contributing
- Roadmap
About
par-storygen is a TUI (Text UI) choose-your-own-adventure powered by configurable LLMs. The application was built with Textual and Rich. A configurable LLM (via pydantic-ai) drives theme, characters, narration, and choices; image providers render portraits and scene illustrations using per-character reference portraits for visual consistency. Game state is a content-addressed tree persisted as JSON — walk the same choices twice and the game replays byte-for-byte. It runs on all major OS's including Windows, macOS, and Linux.
Features
Core Capabilities
- Multi-Provider Text: OpenAI, OpenRouter, and Ollama (all OpenAI-compatible) with per-save provider pinning
- Multi-Provider Images: OpenAI (ref-aware), Gemini (ref-aware), Z.AI (text-to-image), and Ollama (local) with automatic fallback
- Interactive Wizard: 8-step story setup — theme, tone, narration style, art style, length, reader level, characters, and confirmation
- Half-Block Inline Art: Scene illustrations rendered directly in the terminal using reference portraits for character consistency
- Content-Addressed Tree: Every choice is cached; replaying the same path returns byte-for-byte identical results
- Save/Resume: Full game state persistence with
--resumeflag to pick up where you left off
Advanced Features
- Branch Prefetch: Background-generates pending choices while you read, for instant picks
- Text-to-Speech: Read narration aloud via OpenAI, ElevenLabs, Deepgram, Gemini, or Kokoro with provider/voice-aware audio caching
- Auto-Play: Press
ato auto-advance with random choices, waiting for images and TTS before continuing - Character Library: Export characters from finished stories and re-import with optional AI-powered backstory adaptation
- Character Outfits: Define multiple looks per character and switch between them mid-story
- Endings Gallery: Card-based view of every ending reached, with jump-to-node navigation
- Branch Replay: Read-only slideshow of any path from root to an explored node
- Story Graph: Full tree view with marker legend, current-node arrow, and unexplored-choice leaves
- Reference Images: Supply your own character images as portrait anchors for ref-aware providers
- Reader Levels: Vocabulary and complexity controls for ages 0-5, 6-10, 11-15, or 15+
- Settings Persistence: In-app Settings screen for provider defaults, art toggle, streaming, prefetch, TTS, and auto-play options
- Export Book: Export any story path as a standalone HTML book reader with 3D page turns, audio player, and auto-read
- Story Templates / Presets: Six curated presets plus your own saved presets; "Quick Start" from the main menu or "Load Preset" / "Save as Preset" in the wizard
- Narrative Recap: Press
Shift+Rfor an on-demand "Previously on..." summary; optional auto-recap every N major beats and on resume - Relationship Tracking: View pairwise character relationships (ally, rival, romantic, mentor, …) with strength bars via
i→ Relationships, extracted inline as the story progresses - Image Style Gallery: Browse and apply art styles from the Settings screen
- Graph Prune: Press
pin the story graph to delete a node and all its descendants (with confirmation) - Dynamic Pacing: Choose Slow / Moderate / Fast pacing per story (wizard LENGTH step) to control narration length and choice frequency
Technical Excellence
- Async Architecture: Non-blocking pipeline with concurrent illustration and portrait generation
- Type Safety: Fully typed Python 3.13 codebase with strict pyright mode
- XDG-Compliant Paths: Config and data stored per platform conventions
- Atomic Persistence: All file writes use
.tmp+os.replacefor crash safety - Cost Tracking: Per-save image cost and token usage with per-model call counts
- Prompt Caching: Static system prompt content for optimal API cache hit rates
Screenshots
Splash & Main Menu
Settings — Configure text and image providers, art toggles, streaming, and prefetch options. Preferences persist across sessions.
New Story Wizard — An 8-step guided setup for theme, tone, narration style, art style, length, reader level, and characters (with library import). See the full wizard walkthrough.
Load Story — Browse and resume existing saves.
Gameplay — The main play screen shows the scene illustration (half-block inline art) on the left, narrative text in the center, and the character roster on the right. Numbered choices appear at the bottom.
Character Portraits — Press i → Portraits to view full portraits for every character in the current scene. High-res zoom available for ref-aware providers.
Story Graph — Press i → Graph for a full tree view with marker legend, current-node arrow, and unexplored-choice leaves. Press r on any node for branch replay; press p to prune a subtree.
Character Catalog — A scrollable grid of exported characters from across all your stories. Each card shows the portrait thumbnail, name, and source story. Import any character into a new story (keep as-is or adapt backstory to the new theme).
High-res versions of images are available
Prerequisites
For running
- Install Python 3.13 or newer
- https://www.python.org/downloads/ has installers for all versions
- On Windows the Scoop tool makes it easy to install and manage things like python
- Install Scoop then do
scoop install python
- Install Scoop then do
For development
- Install uv
- Install GNU Compatible Make command
- On Windows if you have scoop installed you can install make with
scoop install make
- On Windows if you have scoop installed you can install make with
Installing
Installing uv
If you don't have uv installed you can run the following:
curl -LsSf https://astral.sh/uv/install.sh | sh
Install from PyPI with uv
uv tool install par-storygen
storygen
Install from PyPI with pip
pip install par-storygen
storygen
Source install from GitHub
git clone https://github.com/paulrobello/par-storygen
cd par-storygen
make setup
Command line arguments
The TUI ships as the storygen console script. Bare uv run storygen is equivalent to storygen run with no flags.
storygen --version Print the version and exit.
storygen --help Show top-level help.
storygen run Launch the TUI.
storygen run --resume (-r) Skip the menu and resume the most recently played story.
storygen-api (optional [api] extra)
The FastAPI server ships as a separate console script, available after uv sync --extra api. Its single (default) command starts uvicorn:
storygen-api serve --host 127.0.0.1 --port 8101 --no-reload
| Flag | Default | Purpose |
|---|---|---|
--host |
127.0.0.1 |
Bind address. Pass 0.0.0.0 for LAN access (and set STORYGEN_API_TOKEN). |
--port |
8101 |
Bind port — pairs with the Next.js dev server on :8100. |
--reload / --no-reload |
--no-reload |
Auto-reload on source changes (dev only). |
make api-dev runs uvicorn with --reload --port 8101; make api-prod pins --workers 1 (the server is single-worker — see Web API and frontend).
Environment Variables
Variables are loaded in the following order, last one to set a var wins
- HOST Environment
.envfile in project root- par-storygen Settings Screen
Text provider variables
OPENAI_API_KEY— OpenAI API keyOPENROUTER_API_KEY— OpenRouter API keySTORYGEN_TEXT_PROVIDER—openai(default),openrouter, orollamaSTORYGEN_TEXT_MODEL— Model identifier (default:gpt-6-luna)STORYGEN_TEXT_BASE_URL— Override base URL for the text provider
Image provider variables
GEMINI_API_KEY— Google Gemini API keyZAI_API_KEY— Z.AI API keySTORYGEN_IMAGE_PROVIDER— Scene/cover art provider:openai(default),gemini,zai, orollamaSTORYGEN_IMAGE_MODEL— Scene/cover art model identifier (default:gpt-image-2.6-flare)STORYGEN_IMAGE_BASE_URL— Override base URL for the scene/cover art providerSTORYGEN_IMAGE_API_KEY— Override API key for the scene/cover art providerSTORYGEN_CHARACTER_IMAGE_PROVIDER— Character portrait provider:openai(default),gemini,zai, orollamaSTORYGEN_CHARACTER_IMAGE_MODEL— Character portrait model identifier (default:gpt-image-2.6-flare)STORYGEN_CHARACTER_IMAGE_BASE_URL— Override base URL for the character portrait providerSTORYGEN_CHARACTER_IMAGE_API_KEY— Override API key for the character portrait provider
See .env.example for the full list.
FastAPI server variables (optional [api] extra)
STORYGEN_API_TOKEN— shared bearer token. Unset → loopback trusted, off-box rejected (HTTP 503 / WS 4403); set → required of every client including loopback.STORYGEN_API_ALLOWED_ORIGINS— CORS origins (comma-separated; defaulthttp://localhost:8100,http://127.0.0.1:8100).STORYGEN_WS_ALLOWED_ORIGINS— WebSocket handshake origin allowlist (default mirrorsSTORYGEN_API_ALLOWED_ORIGINS).STORYGEN_API_RATE_LIMIT— per-IP sliding-window limit on cost-incurring routes, format<count>/<period>with periodsecond/minute/hour(default30/minute;0disables).
Data locations
par-storygen uses the XDG Base Directory Specification via the xdg-base-dirs library. Override the defaults by setting XDG_DATA_HOME or XDG_CONFIG_HOME.
Default data directory ($XDG_DATA_HOME/storygen/):
| Platform | Default path |
|---|---|
| macOS | ~/.local/share/storygen/ |
| Linux | ~/.local/share/storygen/ |
| Windows | %APPDATA%\storygen\ |
Within the data directory:
games/<uuid>/— one subdirectory per save, containinggame.jsonand portrait/scene imageslibrary/<uuid>/— one subdirectory per exported character, containingcharacter.jsonandportrait.png
Config state file ($XDG_CONFIG_HOME/storygen/state.json) stores provider preferences, art settings, and wizard defaults:
| Platform | Default path |
|---|---|
| macOS | ~/.config/storygen/state.json |
| Linux | ~/.config/storygen/state.json |
| Windows | %APPDATA%\storygen\state.json |
Running par-storygen
make run
Or directly:
uv run storygen
Resume last game:
make resume
# or
uv run storygen run --resume
Choosing a text model
par-storygen supports three text-LLM providers, all routed through pydantic-ai's OpenAI-compatible OpenAIChatModel.
There are two ways to select the provider and model:
- Environment variables (best for one-off runs, CI, or temporary overrides) —
STORYGEN_TEXT_PROVIDER,STORYGEN_TEXT_MODEL, and optionallySTORYGEN_TEXT_BASE_URL. See.env.examplefor the full list. - Settings screen (persisted across sessions) — open the app, hit
Settingsfrom the main menu, and edit the "Text provider" block. Saved prefs live in$XDG_CONFIG_HOME/storygen/state.json.
Priority order: real environment variables > .env file > Settings-saved prefs > hardcoded default (openai / gpt-6-luna).
OpenAI (text)
Set OPENAI_API_KEY. Known-good models: gpt-6-luna (default). Billing runs through api.openai.com.
OpenRouter
Set OPENROUTER_API_KEY and STORYGEN_TEXT_PROVIDER=openrouter. OpenRouter routes to dozens of frontier models under a single key. Known-good models: anthropic/claude-3.5-sonnet (excellent structured output), meta-llama/llama-3.3-70b-instruct (open-weight, very cheap). Full catalog at openrouter.ai/models. Keep the <vendor>/<model> slash form.
Ollama (text)
Starting in 0.5.3, the Ollama provider uses native JSON-schema output for every structured story step: theme, cast and catalog characters, backstory adaptation, beats, illustration plans, summaries, and recaps. Plain-text blurbs remain plain text; OpenAI and OpenRouter keep their existing output-tool mode. This targets local or self-hosted Ollama instances, not Ollama Cloud.
The initial Theme fix shipped in 0.5.2 and was live-tested with qwen2.5:32b-instruct on Ollama 0.40.16 on macOS; the reporter also confirmed that step on Windows (#23). The 0.5.3 extension was tested with the same model on macOS through cast generation and three saved beats. A separate no-choice dead end from that run is covered by an automated regression; a full live playthrough and the 0.5.3 extension on Windows have not been verified.
Set STORYGEN_TEXT_PROVIDER=ollama and run ollama serve locally (default: http://localhost:11434). No API key required. Known-good models: llama3.3:70b (good narration if you have the VRAM), qwen2.5:32b-instruct (lighter, faster). The model string must match the Ollama tag exactly. For remote Ollama, set STORYGEN_TEXT_BASE_URL=http://<host>:11434/v1.
Note: Each save pins its own text_config. Changing the provider in Settings only affects new stories — existing saves keep what they were created with.
Choosing an image model
par-storygen supports four image-gen providers. Only OpenAI and Gemini support reference images — the pattern used to keep characters visually consistent across scenes. Z.AI and Ollama are text-to-image only, so character consistency will drift.
Scene/cover art and character portraits are configured separately:
- Scene/cover art uses
STORYGEN_IMAGE_PROVIDER,STORYGEN_IMAGE_MODEL,STORYGEN_IMAGE_BASE_URL, andSTORYGEN_IMAGE_API_KEY. The hardcoded default is OpenAIgpt-image-2.6-flare. - Character portraits use
STORYGEN_CHARACTER_IMAGE_PROVIDER,STORYGEN_CHARACTER_IMAGE_MODEL,STORYGEN_CHARACTER_IMAGE_BASE_URL, andSTORYGEN_CHARACTER_IMAGE_API_KEY. The hardcoded default is OpenAIgpt-image-2.6-flare. Both GPT Image 2.6 models support transparent PNG portraits.
There are two ways to select image providers and models:
- Environment variables — use the scene/cover
STORYGEN_IMAGE_*variables and/or the portrait-specificSTORYGEN_CHARACTER_IMAGE_*variables. See.env.example. - Settings screen (persisted across sessions) — edit the "Image provider" block for scene/cover art and the "Character portrait provider" block for portraits.
Priority order for each image config: real environment variables > .env file > Settings-saved prefs > hardcoded defaults (openai / gpt-image-2.6-flare for scene/cover art, openai / gpt-image-2.6-flare for character portraits).
OpenAI (image)
Set OPENAI_API_KEY. The default is gpt-image-2.6-flare, OpenAI's recommended starting point for existing GPT Image 2 workflows that already meet quality needs. Choose gpt-image-2.6-sunburst for more demanding detail or precise edits. Both support reference images through images.edit, transparent PNG portraits, and streaming previews. Portrait sizes/quality and scene sizes/quality are unchanged. See OpenAI's model selection guide.
Existing saves pin their own image models. To update retiring GPT Image 2 / 1.5 configurations safely, follow the migration guide. Explicit environment overrides and custom endpoints are not rewritten.
The in-app image cost counter remains a coarse legacy size/quality estimate, not a bill. GPT Image 2.6 token consumption varies by model and quality; check API usage for actual costs.
Google Gemini
Set GEMINI_API_KEY and STORYGEN_IMAGE_PROVIDER=gemini. Supports up to 14 reference images per call. Known-good models: gemini-3.1-flash-image-preview (Nano Banana 2, $0.067/1K image tokens), gemini-3-pro-image-preview (Nano Banana Pro, $0.134/image). Leave STORYGEN_IMAGE_BASE_URL blank for Gemini. Docs: ai.google.dev/gemini-api/docs/image-generation.
Z.AI GLM-image
Set ZAI_API_KEY and STORYGEN_IMAGE_PROVIDER=zai. Text-to-image only — no reference-image support. Price: $0.015/image. Known-good model: glm-image. Docs: docs.z.ai.
Ollama (image)
Set STORYGEN_IMAGE_PROVIDER=ollama and run ollama serve locally. No API key required. macOS-only as of 2026-04, requires server ≥ 0.13.3. No reference-image support. Known-good models: x/z-image-turbo (fastest), x/flux2-klein:4b, x/flux2-klein:9b (higher quality, more VRAM). For remote Ollama, set STORYGEN_IMAGE_BASE_URL=http://<host>:11434/v1/.
Fallback provider
Settings lets you pick a secondary image provider that kicks in when the primary fails. Each fallback trip fires a toast. Useful combos: OpenAI primary + Gemini fallback (both ref-supporting). Same-provider fallbacks are ignored.
Note: Each save pins both image_config (scene/cover art) and character_image_config (portraits). Changing either image provider in Settings only affects new stories.
Character library: exporting and importing
par-storygen keeps a cross-game character library at $XDG_DATA_HOME/storygen/library/ — one subdirectory per exported character holding metadata plus its portrait. Characters from finished (or in-progress) stories can be re-used in new stories without regenerating the portrait, saving both token cost and wall time.
Export
From a game's Portraits screen, press the Export button next to any character. The character's name, backstory, personality, physical description, portrait, and the exact portrait prompt are copied into the library. Re-exporting the same character creates a separate library entry — use the Library Browser to clean up.
Import
During the wizard's CHARACTERS step, press Ctrl+L to open the Library Browser. Pick a character, then choose:
- Keep as-is — added to your new story unchanged. Portrait PNG is copied (no image-provider API calls).
- Adapt to theme — an LLM rewrites only the backstory to fit your new story's theme. Name, personality, and physical description are preserved so the existing portrait still matches.
Delete + sort
The Library Browser has per-entry Delete buttons with confirmation. Press s to toggle sort between newest-first (default) and alphabetical.
Replay and endings
Once you've played through to one or more endings, two read-only views let you revisit the journey.
Endings gallery (i → Endings from PlayScreen)
Press i → Endings to open a card per ending you've reached. Each card shows the scene image, a narration excerpt, and the path of choices you took. Press Jump on any ending to set the playhead to that node.
The Endings entry is hidden when no endings have been reached yet.
Branch replay (r from GraphScreen)
Open the graph (i → Graph from PlayScreen), highlight any explored node, and press r to walk through every beat from root to that node. Use space/right/n to advance, left/p to go back, j to jump to live play at the current step, and escape to exit.
Replay is read-only — no regeneration, no LLM calls.
Branch prefetch
While you're reading a beat, par-storygen can background-generate the next beats for each pending choice. When you pick, the next beat appears instantly (no LLM call) — assuming the prefetch finished in time.
Enabling
Open Settings and toggle:
- Enable branch prefetch — turns on background generation. Off by default (spends tokens up-front for paths you may never pick).
- Prefetch scene images too — also runs scene-image generation for each prefetched beat. Off by default and disabled unless prefetch + global art are both on.
What gets generated
For each pending choice from the current beat:
- Beat text (always, when prefetch is on).
- Illustration plan (always — cheap, lets you press
ilater). - Scene image (only when "Prefetch scene images too" is on).
Behavior notes
- Sibling prefetches keep running after you pick. They populate
save.nodes, so alternate branches are free cache hits. - Failures are silent. If a provider is down, you only see an error if you pick a choice whose prefetch failed (then live generation retries).
- Settings take effect on the next beat. Toggle any time; in-flight prefetches finish, future ones honor the new state.
Character outfits
Define multiple looks for a single character and switch between them at will. Each outfit is its own portrait, used as the reference image for scene generation so your character appears in the picked outfit across subsequent beats.
Creating an outfit
From PlayScreen, press i → Portraits. For any character:
- Click Add outfit.
- Give it a short name (e.g. "ballroom gown", "armored", "swimwear").
- Write a one-sentence description (e.g. "wearing a flowing red gown with gold trim").
- Press Generate. The new outfit is generated using the character's existing physical description PLUS your outfit description.
Outfit thumbnails appear in a row under the character's main portrait.
Switching and deleting
Click any outfit thumbnail for a Set as current / Delete / Cancel menu. Setting an outfit updates the character's active portrait and makes scene generation use that outfit as the reference from now on.
The main (base) portrait is preserved. Press Revert to base (visible only when an outfit is active) to switch back. Deleting the currently-active outfit auto-reverts to base first.
Notes
- Outfit generation uses the character portrait image provider + model + cost, same as a regular portrait.
- Image streaming is intentionally OFF for outfit generation (portraits are 5-10s — too fast for streaming to pay off).
- Library export captures only the currently-active outfit. Imported characters start with an empty
outfitslist.
Text-to-speech
par-storygen can read narration aloud using the par-cli-tts library, which supports five providers: OpenAI, ElevenLabs, Deepgram, Google Gemini, and Kokoro (local).
Setup
- Open Settings from the main menu.
- Scroll to the Text-to-speech section.
- Select a provider and enter your API key.
- Press Refresh voices to populate the voice dropdown, then pick a voice.
- Optionally toggle Auto-read to have narration read aloud automatically after each beat.
Playback controls (PlayScreen)
| Key | Action |
|---|---|
t |
Read aloud / pause / resume (context-dependent) |
T |
Restart narration from the beginning |
s |
Stop playback immediately |
Audio files are cached per node, provider, and voice in the save's audio/ directory. The cache file extension follows the active TTS provider's preferred output format, so changing provider or voice generates a separate cache entry instead of replaying stale narration.
Auto-play
Press a from the play screen to auto-advance the story with random choices. Auto-play:
- Waits for the scene image — waits until the current scene image reaches a terminal state (
doneorfailed), then applies a 5 second viewing delay after the image is displayed (if art is enabled). - Waits for TTS — if auto-read is on, waits for narration playback to finish (including through pauses) before advancing to the next random choice.
- Stops at endings — auto-play halts when an ending node is reached.
- Toggle off — press
aagain to stop at any time.
During auto-play, only menu, a (stop auto), and TTS controls (t/T/s) are available.
Export book
Press x from the play screen when viewing an ending to export the entire story path as a self-contained HTML book. The exported book opens in your browser and includes:
- Chapter-by-chapter navigation with arrow keys and on-screen buttons
- 3D page-turn animation (CSS
rotateY) withprefers-reduced-motionfallback - Light/dark mode toggle persisted via
localStorage - Inline audio player for chapters with TTS narration, with seek bar and time display
- Auto-read mode — plays each chapter's audio and advances automatically
- Open Graph / Twitter Card meta tags for social sharing previews
- Scene images copied alongside
index.htmlinto~/Desktop/<Title>_Book/
No server required — the entire book is a single HTML file with inline CSS/JS plus local image and audio assets.
Keyboard shortcuts
par-storygen consolidates secondary views behind an info picker (i) so the most common play actions stay on single keys. The i modal lists Portraits, Graph, Endings, and Relationships — each entry is hidden when the current save has nothing to show for it.
PlayScreen
| Key | Action |
|---|---|
1–9 |
Pick choice 1–9 |
j / ↓ |
Highlight next choice |
k / ↑ |
Highlight previous choice |
enter |
Pick the highlighted choice |
i |
Info picker — Portraits / Graph / Endings / Relationships |
r |
Regen picker — beat / scene image / portrait / audio |
b |
Back one node |
R (Shift+R) |
"Previously on..." recap (on demand) |
a |
Auto-play toggle (random choices, waits for image + TTS) |
t |
TTS read aloud / pause / resume (context-dependent) |
T |
Restart narration from the beginning |
s |
Stop TTS playback immediately |
x |
Export book (when viewing an ending) |
m / esc |
Return to main menu |
During beat generation, _loading blocks every action except menu. During auto-play, only menu, a (stop), and the TTS keys (t/T/s) are available.
GraphScreen (reached via i → Graph)
| Key | Action |
|---|---|
r |
Branch replay from the selected node |
p |
Prune the selected subtree (asks for confirmation) |
esc |
Back to PlayScreen |
Replay advances with space / right / n, steps back with left / p, jumps to live play with j, and exits with escape.
Web API and frontend (optional)
The TUI is the primary surface, but par-storygen also ships an optional HTTP/WebSocket API and a Next.js frontend that drives it. Both layers reuse the same storage / llm / images / pipeline code as the TUI — they are second composition roots, not a separate product.
FastAPI server (src/storygen_api/)
Installed via the [api] extra; the storygen-api console script exposes the wizard + play loop over REST plus a WebSocket for live narration.
uv sync --extra api # install fastapi, uvicorn[standard], websockets, python-multipart
make api-dev # uvicorn storygen_api.main:app --reload --port 8101
make api-prod # uvicorn ... --port 8101 --workers 1
- Auto-docs: open
http://localhost:8101/docsfor the interactive OpenAPI UI. - WebSocket: connect to
/api/ws/{game_id}to receivenarration_delta,beat_committed,image_committed, andimage_failedevents during play. - Single worker only: the server keeps in-memory session/WebSocket/TTS state per process, so always run with
--workers 1(the Makefile target does this). A second worker silently desyncs game state.
Security — bind address and auth. The server binds to
127.0.0.1by default (loopback only). Auth is two-mode: whenSTORYGEN_API_TOKENis unset, loopback peers are trusted (somake api-dev+make web-devwork out of the box) and off-box clients are rejected with HTTP 503 / WebSocket close 4403; when the token is set, every client — loopback included — must send the matching bearer token. To expose it on a LAN, pass--host 0.0.0.0and setSTORYGEN_API_TOKEN. See.env.examplefor the variable and the expectedAuthorization: Bearer <token>(HTTP) andSec-WebSocket-Protocol: bearer.<token>(WebSocket) usage.
Next.js frontend (web/)
A separate Next.js 16 app under web/ that drives the API from a browser. See web/README.md for the full route map and data flow.
make web-install # cd web && npm install
make web-dev # Next.js dev server on :8100 (run alongside `make api-dev`)
make web-build # production build
The dev server origin (http://localhost:8100) is the one the API allows for CORS by default. Point the frontend at a different API via the NEXT_PUBLIC_API_BASE build-time variable (see web/README.md); change the API's CORS or WebSocket origin allowlist via STORYGEN_API_ALLOWED_ORIGINS / STORYGEN_WS_ALLOWED_ORIGINS (comma-separated; both default to http://localhost:8100,http://127.0.0.1:8100).
Troubleshooting
Common runtime problems — missing API keys, Ollama not reachable, image-provider 4xx errors, blank image panel, TTS with no audio, and the web UI failing to reach the API — are covered in docs/TROUBLESHOOTING.md. Each entry follows a symptom → cause → fix → verify format.
Contributing
Contributions are welcome. The full setup, gate, pre-commit, commit-style, and branch/PR flow live in CONTRIBUTING.md. The short version:
git clone https://github.com/paulrobello/par-storygen
cd par-storygen
make build # uv sync --extra api --dev
make web-install # only if you touch web/
make checkall # ruff lint + pyright + pytest (the CI gate)
Please ensure pull requests are formatted with ruff, pass make checkall, and follow the Conventional Commits style used throughout the history (fix(scope):, feat(scope):, docs(scope):, …).
Roadmap
As of v0.5.0. See CHANGELOG.md for the full release history.
Where we are
- Core Gameplay — Theme wizard, beat pipeline, choice tree, caching, save/resume
- Multi-Provider — OpenAI, OpenRouter, Ollama for text; OpenAI, Gemini, Z.AI, Ollama for images
- Visual Consistency — Reference portraits, half-block inline art, character outfits
- Cross-Game Library — Export/import characters with optional AI backstory adaptation
- Navigation — Story graph, endings gallery, branch replay
- Branch Prefetch — Background beat generation for instant picks
- Reader Levels — Vocabulary and complexity controls for different age ranges
- Text-to-Speech — Multi-provider narration with provider/voice-aware audio caching and auto-read
- Auto-Play — Random-choice auto-advance with image and TTS wait gating
- Export Book — Standalone HTML book reader with 3D page turns, inline audio, and auto-read
- Story Templates & Presets — Curated and custom presets; Quick Start from the menu, Load/Save Preset in the wizard
- Narrative Recap — On-demand "Previously on..." summaries (
Shift+R), auto-recap, and resume recap - Relationship Tracking — Pairwise character relationships extracted inline, viewable via
i→ Relationships - Image Style Gallery — Browse and apply art styles from Settings
- Dynamic Pacing — Slow / Moderate / Fast pacing per story
Where we're going
- Sound effects and music per scene
- Multiplayer (shared story tree)
- More image providers and art styles
- Export stories as PDF
Metadata
Release files for par-storygen 0.5.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| par_storygen-0.5.4.tar.gz | 454.0 kB | With provenance | Details for par_storygen-0.5.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| par_storygen-0.5.4-py3-none-any.whl | Python 3 | none | any | Details for par_storygen-0.5.4-py3-none-any.whl |
Total release size: 777.4 kB
Release files / par_storygen-0.5.4.tar.gz
| Download URL | par_storygen-0.5.4.tar.gz |
|---|---|
| Size | 454.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b5cdd9839c466e3ea29783ce3b5e158e83f5e988846285ca09bb1a273fc8c5b
|
|
BLAKE2b-256 checksum How to use checksums |
18ffefcbddecedbaaa0d488cb53d1d55dfc1afb650ccb1c9bfdc8c910b124ea7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / par_storygen-0.5.4-py3-none-any.whl
| Download URL | par_storygen-0.5.4-py3-none-any.whl |
|---|---|
| Size | 323.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
767722d763921d447fa5195148a8a61c95844aabe15f921db0ae9ec2e4c66c36
|
|
BLAKE2b-256 checksum How to use checksums |
2db8a9d467f8deda5bad1495e6db53c5f87f63a844a8eddd27d2611f98aaf1cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for par-storygen 0.5.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for par_storygen-0.5.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.