How much would your Claude subscription usage cost at API list price?

1. Run in your terminal
python3 <(curl -sL https://raw.githubusercontent.com/jriso/claude-code-cost/main/cost.py)
2. Paste the output to see your breakdown
Your token data stays private. The script runs locally. We never see your usage data.
Nervous about running a script? Ask your Claude to review and run it for you.

Run this on the machine where you use Claude Code.

Your Claude Code usage last month would have cost
$0
Estimated. Does not count usage on other devices, Claude.ai, or the mobile app.
$0
$0 $0
Cost breakdown
Adjust assumptions
These controls update the estimate in real time.
Cache read rate $0.50/MTok
$0.375$0.50 (listed)$0.625
Your subscription
What is this?
This calculator estimates what your Claude Code usage would cost at API prices. You run a Python script locally that reads the JSONL logs Claude Code stores on your machine, tallies up every token by model, and outputs a JSON summary. Paste that summary here and the calculator applies current API rates to show your estimated monthly cost.
Where the token counts come from
Claude Code writes JSONL logs in ~/.claude/projects/. Each assistant message includes a usage object — the same one Anthropic's API returns for billing. This tool scans those files and aggregates by model, deduplicating by requestId.
Why requestId deduplication matters
Claude Code writes multiple events per API request (streaming). Each carries the same cache_read_input_tokens but increasing output_tokens. Naively summing overcounts by ~1.5x. We keep the last event per requestId.
Pricing
All rates from Anthropic's pricing page. Cache writes split by tier:
ModelInputOutputCache ReadCW 5mCW 1h
Opus 4.6$5$25$0.50$6.25$10
Sonnet 4.6$3$15$0.30$3.75$6
Haiku 4.5$1$5$0.10$1.25$2
Opus 4.5$5$25$0.50$6.25$10
Opus 4.1$15$75$1.50$18.75$30
Sonnet 4.5$3$15$0.30$3.75$6
Sonnet 4$3$15$0.30$3.75$6
Opus 4$15$75$1.50$18.75$30
Haiku 3.5$0.80$4$0.08$1$1.60
Haiku 3$0.25$1.25$0.03$0.30$0.50
Opus 3$15$75$1.50$18.75$30
Sonnet 3.5v2$3$15$0.30$3.75$6
Sonnet 3.5$3$15$0.30$3.75$6
Per million tokens.
What the range represents
Cache read rate ±25% around listed price. Cache reads dominate cost (60-70%). Other factors ruled out: fast mode (zero usage), data residency (not applied), extended thinking (in output tokens), web search (zero).
Limitations
Claude Code only. Web/mobile/API usage not captured — this is a lower bound.
JSONL retention. ~30 days complete; older data may be pruned.
List prices, not cost. Actual compute cost to Anthropic is significantly lower.
This project is open source. Contributions, bug reports, and ideas are welcome.