Claude Code cost calculator

Put in the tokens a Claude Code run used (input, output, cache write and cache read), pick the model, and get the API-equivalent cost. Prompt-cache reads are counted at their own cheaper rate, which is why a long session often costs far less than the input token count suggests. Everything runs in your browser.

Cache write duration

API-equivalent cost

$0.3125

Have a Hatchlog task open? Its Tokens block lists these four counts; paste them from token cost per task.

Prices verified 2026-10-23. Source: Anthropic API pricing.

How it works

Each run is billed in four buckets, each at its own rate per million tokens. The calculator multiplies your counts by the model's rate and adds them up:

  1. Input: fresh tokens you send, not served from cache.
  2. Output: tokens the model generates. Always the priciest bucket.
  3. Cache write: tokens written into the prompt cache, at 1.25× input for 5 minutes or 2× for 1 hour.
  4. Cache read: tokens read back from the cache on later turns, at a fraction of the input price.

You can read all four counts for a real run in Claude Code's own usage output, or on a Hatchlog task, where they're shown per task. For how Hatchlog measures them, see token cost per task.

Current prices

US dollars per million tokens. Verified 2026-10-23 against the source.

Model Input Output 5m write 1h write Cache read
Claude Fable 5.1 $10 $50 $12.5 $20 $0.25
Claude Opus 5.5 $4 $20 $5 $8 $0.2
Claude Sonnet 5.5 $2 $10 $2.5 $4 $0.1
Claude Haiku 5.5 $0.1 $0.5 $0.125 $0.2 $0.01
Claude Opus 5 $5 $25 $6.25 $10 $0.5
Claude Sonnet 5 $2 $10 $2.5 $4 $0.2
Claude Opus 4.8 / 4.7 / 4.6 $5 $25 $6.25 $10 $0.5
Claude Sonnet 4.6 $3 $15 $3.75 $6 $0.3
Claude Haiku 4.5 $1 $5 $1.25 $2 $0.1

Claude Haiku 5.5 rates are for prompts up to 100K tokens; longer prompts cost more.

A Hatchlog task's Tokens block: total tokens, API-equivalent cost, and a per-type breakdown.
Hatchlog shows this per task — the tokens and the API-equivalent cost of each feature.

FAQ

Where do the prices come from?

From Anthropic's public API pricing page, verified on 2026-10-23. Prices change, so treat the result as a guide and check the source before you rely on it.

What is the cache-write duration toggle?

A cache write costs 1.25 times the input price for the 5-minute cache and 2 times for the 1-hour cache. The toggle switches the rate the cache-write tokens are charged at.

Is this what Claude Code actually bills me?

Only if you pay per token on the API. On a flat Claude plan your real cost is different. This is the API-equivalent cost: what those tokens would cost at list prices.