Skip to content

Tokens to dollars

Claude Code Token Cost

Convert a Claude Code session into dollars by pricing each token type on its own. Cache reads are not input. Cache writes are not free. The formula below is the one the calculator uses.

Claude Code token cost by token type

Cost = (uncached input ÷ 1,000,000 × input rate) + (output ÷ 1,000,000 × output rate) + (cache reads ÷ 1,000,000 × cache-read rate) + (5-minute writes ÷ 1,000,000 × 1.25× input) + (1-hour writes ÷ 1,000,000 × 2× input). Fable 5.1, Opus 5.5, and Sonnet 5.5 use a lower cache-read multiplier than 0.1×. Those exceptions are stored as dollar rates, not assumed.

Cache read and cache write cost

Total input in a Claude usage record is input_tokens + cache_read_input_tokens + cache_creation_input_tokens. The first number is only the tail after the cache breakpoint. Pricing that tail at the full input rate and ignoring the cache fields understates a Claude Code session.

A 5-minute cache write is 1.25× the input rate. A 1-hour cache write is 2×. If a log has only the flat cache-write total, this calculator uses the cheaper 5-minute rate and says so.

Tokens to dollars for one Claude Code session

The worked example is the same heavy day loaded in the Claude Code cost calculator. It is an API-equivalent total, not a remaining Claude Pro balance.

One heavy Claude Code day on Sonnet 5.5Claude Sonnet 5.5 · Standard · total $8.97
Token typeTokensRateCost
Uncached input85,000$2.00 / MTok$0.17
Cache reads18,000,000$0.10 / MTok$1.80
1-hour cache writes1,200,000$4.00 / MTok$4.80
Output220,000$10.00 / MTok$2.20

Estimate Claude Code token cost from a session

Haiku 5.5 switches to a higher card when one request is over 100,000 input-side tokens. Sonnet and Opus on the current card do not add a long-context surcharge inside the published 1M window. Paste counts below, or open a local JSONL log. Nothing is uploaded.

Cache reads are $0.10 / MTok (0.05× input) on Sonnet 5.5.

Showing an example: One heavy Claude Code day on Sonnet 5.5. Edit a field, or clear it, to price your own usage.

$2.00 / MTok

$10.00 / MTok

$0.10 / MTok

$2.50 / MTok

$4.00 / MTok

Scales the dollar total after long-context pricing is chosen, so 20 short requests stay on the short-context rate.

Adjustments