Claude Code cost calculator
Claude Code runs long, tool-heavy loops over your codebase — and context grows on every turn. Model your real coding workflow (model calls, tool calls, retries, prompt caching) and see cost per task, monthly spend, and the waste hiding in retries and failed runs.
Switching from Claude Opus 4.8 to DeepSeek-V4 Pro (reasoner) (DeepSeek, same frontier tier) cuts monthly spend by $6.6K — 92% — for this workload.
Where each task's cost goes
| Model | $/task | $/successful | Monthly | vs current |
|---|---|---|---|---|
CHEAPEST OpenAI · fast | $0.0508 | $0.0591 | $76.18 | cheapest |
| Groq · fast | $0.054 | $0.0627 | $80.94 | 1.1× |
| Gemini · fast | $0.0928 | $0.1079 | $139 | 1.8× |
| OpenRouter · mid | $0.1114 | $0.1296 | $167 | 2.2× |
| DeepSeek · mid | $0.1213 | $0.141 | $182 | 2.4× |
| OpenRouter · mid | $0.2264 | $0.2632 | $340 | 4.5× |
| OpenAI · mid | $0.2539 | $0.2953 | $381 | 5.0× |
| Gemini · mid | $0.3069 | $0.3569 | $460 | 6.0× |
| Together · mid | $0.3622 | $0.4211 | $543 | 7.1× |
| DeepSeek · frontier | $0.3756 | $0.4368 | $563 | 7.4× |
| Groq · mid | $0.6334 | $0.7365 | $950 | 12.5× |
| Anthropic · mid | $0.95 | $1.10 | $1.4K | 18.7× |
| Together · mid | $1.11 | $1.29 | $1.7K | 21.8× |
| OpenAI · frontier | $1.27 | $1.48 | $1.9K | 25.0× |
| Gemini · frontier | $1.27 | $1.48 | $1.9K | 25.0× |
| OpenAI · frontier | $1.92 | $2.24 | $2.9K | 37.9× |
| Anthropic · frontier | $2.85 | $3.31 | $4.3K | 56.1× |
CURRENT Anthropic · frontier | $4.75 | $5.52 | $7.1K | 93.5× |
Per-1M-token list prices; figures are estimates and exclude embeddings, fine-tuning, image/audio, and infrastructure. Rows marked verifystill need a final check against the provider's live pricing. LLM prices change often.
Frequently asked questions
How much does Claude Code cost per task?+
It depends almost entirely on context growth and number of turns, not the headline per-token price. A coding task that makes ~28 model calls over a growing 10–40K-token context lands in the low single-digit dollars on Opus 4.8 with prompt caching on, and a fraction of that on Sonnet 4.6 or Haiku 4.5. Use the calculator to model your own loop length and tool output sizes.
Why is my Claude Code bill higher than I expected?+
Three usual suspects: (1) context accumulation — every tool result and prior message is re-sent on the next turn, so a 30-turn task pays for the early context dozens of times; (2) retries and stuck loops that burn full-context calls without progress; (3) prompt caching not actually hitting because the stable prefix changes between calls. Toggle caching and bump the retry/loop inputs to see the impact.
Does prompt caching really cut Claude Code costs?+
Yes — cache reads are ~0.1x the input price on Claude, and Claude Code's system prompt + tool schemas are a large stable prefix re-read on every turn. With caching on, that prefix bills at roughly a tenth. The toggle in the calculator shows the difference for your prompt sizes.
Should I use Opus, Sonnet, or Haiku for a coding agent?+
Opus 4.8 for the hardest autonomous work, Sonnet 4.6 as the everyday balance, Haiku 4.5 for cheap, well-scoped edits and high-volume agents. The comparison table prices all three (and OpenAI, Gemini, DeepSeek, Groq) against the exact same workflow so you can see the real monthly delta.