An interactive chatbot that tells serial adventure stories with cliffhangers that continue in the next chat session. Powered by AI (OpenAI or Anthropic).
- Multiple AI Providers: Choose between OpenAI (GPT-4) or Anthropic (Claude) models
- Command-line Provider Selection: Easily switch AI providers with a simple flag
- Multiple Story Arcs: Choose from different genre adventures
- Interactive Storytelling: Free-form exploration and choices
- Responsive Web Interface: Clean, modern UI
- State Management: Continue your story across sessions
- Smart Context Tracking: Prevents repetition and maintains story consistency
-
Clone the repository
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required packages:
pip install -r requirements.txt
-
Set up your API keys by creating a
.envfile and copying the example filecp .env.example .env
Then edit
.envand add your API keys:OPENAI_API_KEY=your-openai-api-key-here OPENAI_MODEL=gpt-4o-2024-11-20 ANTHROPIC_API_KEY=your-anthropic-api-key-here ANTHROPIC_MODEL=claude-opus-4-20250514AI_PROVIDER=openai
python app.pypython app.py --provider claudeTo clear your story progress and start fresh:
python app.py --resetYou can combine flags:
python app.py --provider claude --resetpython app.py --helpThen open your web browser and navigate to http://localhost:5006
The application supports two methods for selecting your AI provider:
-
Command-line flag (takes priority):
--provider openai- Use OpenAI GPT models--provider claude- Use Anthropic Claude models
-
Environment variable in
.env:AI_PROVIDER=openaiorAI_PROVIDER=anthropic
OpenAI:
- Default:
gpt-4o-2024-11-20 - Customizable via
OPENAI_MODELin.env
Anthropic:
- Default:
claude-opus-4-20250514 - Customizable via
ANTHROPIC_MODELin.env
To see the UI themes without setting up OpenAI:
source venv/bin/activate
python demo_app.pyThen visit http://localhost:5001
app.py- Main Flask application and story logictemplates/index.html- Web interfacestatic/- Static files (CSS, JavaScript, images)requirements.txt- Python dependencies
To add a new story, edit the stories list in app.py and add a new story arc with the following structure:
{
'title': 'Story Title',
'intro': 'Introduction text',
'scenes': [
'Scene 1 text',
'Scene 2 text',
# ... more scenes
]
}This project is open source and available under the MIT License.