A web application that generates content — blog posts, emails, social media posts, essays, and more — that sounds exactly like you wrote it. It creates a "digital twin" of your writing style by analyzing your existing writing samples using RAG (Retrieval-Augmented Generation) and style profiling via the Claude API.
No custom model training required. It uses your writing samples as few-shot context alongside a structured style profile to produce content indistinguishable from your own voice.
- Upload your writing samples — past blog posts, emails, social media posts, essays, etc.
- Generate your style profile — Claude analyzes your writing to extract tone, vocabulary, sentence structure, quirks, and rhetorical patterns
- Generate content — Describe what you want to write; the app retrieves your most relevant writing samples and uses them as examples to generate content in your exact voice
- Upload files (
.txt,.md,.pdf,.docx) or paste text directly - Automatic style profile extraction (tone, formality, vocabulary, sentence patterns, quirks)
- RAG-powered generation: retrieves your writing samples relevant to the topic before generating
- Regenerate or refine any piece of content
- Rate generated content (1–5 stars)
- Full generation history
- Clean web UI — no Node.js required
| Layer | Technology |
|---|---|
| Backend | Python 3.11+ / FastAPI |
| Database | SQLite (WAL mode) / SQLAlchemy async |
| Vector DB | ChromaDB (embedded, local embeddings) |
| LLM | Claude API (Sonnet for generation, Haiku for analysis) |
| Frontend | Jinja2 + HTMX + Tailwind CSS (CDN) |
| File parsing | pymupdf (PDF), python-docx (DOCX) |
git clone <repo-url>
cd "Personalized Content Generator"
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activatepip install -e ".[dev]"cp .env.example .envEdit .env and add your Anthropic API key:
ANTHROPIC_API_KEY=sk-ant-your-key-here
Get a key at console.anthropic.com.
uvicorn app.main:app --reloadOpen http://127.0.0.1:8000 in your browser.
Go to Writing Samples and either:
- Upload
.txt,.md,.pdf, or.docxfiles (max 10MB each) - Paste text directly with a title
Add as many samples as you have — more samples = better style matching. Label each with the content type (blog, email, social, etc.).
Go to Dashboard and click Generate Profile. Claude will analyze your samples and extract a detailed style profile. This takes ~10–30 seconds. You can regenerate it anytime as you add more samples.
Go to Generate and fill in:
- Content type (blog, email, tweet, LinkedIn post, essay)
- Topic
- Target audience (optional)
- Length (short / medium / long)
- Any additional instructions
Click Generate. If the result isn't quite right, click Regenerate for a different version or use Refine to give specific feedback.
All functionality is available as a REST API:
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/samples/upload |
Upload files |
POST |
/api/samples/paste |
Submit pasted text |
GET |
/api/samples |
List samples |
DELETE |
/api/samples/{id} |
Delete a sample |
GET |
/api/profile |
Get active style profile |
POST |
/api/profile/generate |
Generate/regenerate profile |
POST |
/api/generate |
Generate content |
POST |
/api/generate/{id}/regenerate |
Regenerate |
POST |
/api/generate/{id}/refine |
Refine with instructions |
GET |
/api/history |
List generation history |
POST |
/api/history/{id}/rate |
Rate (1–5) |
Interactive API docs available at http://127.0.0.1:8000/docs.
| Operation | Model | Approx. Cost |
|---|---|---|
| Style analysis | Claude Haiku 4.5 | ~$0.01 per run |
| Generate (short) | Claude Sonnet 4 | ~$0.02 |
| Generate (medium) | Claude Sonnet 4 | ~$0.03 |
| Generate (long) | Claude Sonnet 4 | ~$0.05 |
| Embeddings | Local (MiniLM) | Free |
Light personal use (~50 generations/month): ~$1–3/month.
- Writing samples are sent to the Anthropic API for style analysis and generation
- No data is stored by Anthropic beyond their standard API retention policy
- All your data (samples, profile, history) is stored locally in
data/ - Your
.envfile (containing your API key) is gitignored
app/
├── main.py # FastAPI app, lifespan, startup reconciliation
├── config.py # Settings via environment variables
├── api/ # JSON REST API endpoints
├── pages/ # HTML page routes
├── models/ # SQLAlchemy ORM models + Pydantic schemas
├── services/
│ ├── file_parsers.py # Safe file parsing with limits
│ ├── ingestion.py # Text chunking for RAG
│ ├── vectorstore.py # ChromaDB wrapper
│ ├── style_analyzer.py # Style profile extraction
│ └── generator.py # RAG + prompt assembly + generation
├── prompts/ # Prompt templates for Claude
└── templates/ # Jinja2 HTML templates
data/ # Runtime data (gitignored)
├── content_gen.db # SQLite database
├── chroma/ # ChromaDB vector store
└── uploads/ # Temporary upload storage