The spreadsheet you should build before committing to an LLM architecture — made interactive.
Every provider charges 4–8× more for output tokens than input. Most teams don't know this until the bill arrives. This simulator lets you model the token economics of your specific workload before you build it.
Set four moving parts and watch cost update live:
| Control | What it models |
|---|---|
| Total tokens | Your workload volume (default 1M) |
| I/O ratio | How many input tokens per output token your architecture generates |
| Provider / Model | List pricing — all prices editable, "reset to source" available |
| Prompt caching | Toggle on to model savings from prefix caching; set what % of your input is prefix-stable |
Archetype chips (Extraction · Summarizer · RAG · Code gen · Agent) snap the slider to the matching workflow profile and show you what a given ratio means architecturally.
inputTokens = N × ratio / (ratio + 1)
outputTokens = N / (ratio + 1)
Cost (no caching):
= inputTokens × inputPrice / 1M
+ outputTokens × outputPrice / 1M
Cost (with caching):
= cacheableIn × cacheHitPrice / 1M
+ fullIn × inputPrice / 1M
+ outputTokens × outputPrice / 1M
The model is unit-tested against published figures from the tokenomics series — see src/lib/costModel.test.ts. For example:
- AI agent on Claude Sonnet 4.6 (46,800 in / 4,000 out): $0.2004/task → $0.10563/task with 75% caching (−47%)
- Code generator (800 in / 1,200 out): $0.0204/task → caching saves only ~4%
Run the tests: npm test
| Model | Input /1M | Output /1M | Cache read /1M | Source |
|---|---|---|---|---|
| Claude Sonnet 4.6 | $3.00 | $15.00 | $0.30 | Anthropic |
| Claude Haiku 4.5 | $1.00 | $5.00 | $0.10 | Anthropic |
| Claude Opus 4.6 | $5.00 | $25.00 | $0.50 | Anthropic |
| GPT-4o | $2.50 | $10.00 | $1.25 | OpenAI · caching |
| GPT-5.2 | $1.75 | $14.00 | — | OpenAI |
| Gemini 3.1 Pro | $2.00 | $12.00 | — | |
| Grok 4.1 | $0.20 | $0.50 | — | xAI |
Prices are list prices as of the date above. Use the source links to confirm current pricing. All prices are editable in-UI.
- Simplified cache model: cache read only — the one-time write-premium is omitted. Real cost is slightly higher on first-request caching. See Anthropic docs for the write-premium.
- Archetype token profiles are author estimates based on representative tasks, not instrumented measurements.
- List prices only — volume discounts and committed-use pricing not modelled.
- Caching disabled for models where cache-read pricing is unconfirmed (GPT-5.2, Gemini 3.1 Pro, Grok 4.1). Override in-UI if you have confirmed pricing.
This tool operationalizes three LinkedIn posts:
- Token economics: why architecture beats provider choice (95× cost gap)
- The output premium: why every provider charges 4–8× more for output tokens
- Prompt caching cuts agent costs 47% — but only 4% for code generation
npm install
npm run dev # dev server at http://localhost:5173/llm-token-cost-simulator/
npm test # Vitest — 8 regression tests against published post figures
npm run build # production build → dist/
npm run preview # preview the production build locallyIf you rename the repo, update base in vite.config.ts to match the new GitHub Pages path (/<repo-name>/).
- Push to a public GitHub repo
- Go to Settings → Pages → Source and select GitHub Actions
- The workflow in
.github/workflows/deploy.ymlruns on every push tomain
MIT License