Nick Kanel
← All writeups

The Claude price that matters is the cache price

Every model on Claude’s pricing page comes with two headline numbers: what a million input tokens cost, and what a million output tokens cost. They’re easy to compare, and they’re what gets quoted when a new model comes out. If you use Claude through an agent like Claude Code, though, they explain very little of the bill. In my own usage, input tokens were $0.04 of about $304. Cache reads and cache writes were 69% of it.

This post goes through why, starting with what you’d expect it to cost to fill Claude’s 1M-token context window, and ending with what it actually costs.

What a full context window looks like it costs

Take Opus 5.5, which lists at $4 per million input tokens and $20 per million output tokens.1 Filling a 1M-token window means about a million tokens. Say 160k of them were written by Claude, and the rest are things like file reads, command output and my own messages. That’s about $3.34 of input and $3.27 of output, so around $6.61. A few dollars to fill the window.

The window isn’t sent once

That estimate treats the context as something you pay for once, as you build it up. But the model doesn’t remember anything between requests, so every request carries the whole conversation so far: the system prompt, every message, every file read and every command output.2 The 1M window is the size of the last request, not the only one.

Getting there also takes a lot of requests. In an agent session, each turn is typically a tool call: Claude asks to read a file or run a command, and the result goes back in. Say each turn adds 3k tokens to the context, 500 of them written by Claude and the rest tool output, starting from a 20k-token system prompt and project context. That’s 327 requests to reach 1M.

  • Context sent with each request

Tokens sent with each request

0200k400k600k800k1.0M
Context sent with each request: 20k tokens sentContext sent with each request: 23k tokens sentContext sent with each request: 26k tokens sentContext sent with each request: 29k tokens sentContext sent with each request: 32k tokens sentContext sent with each request: 35k tokens sentContext sent with each request: 38k tokens sentContext sent with each request: 41k tokens sentContext sent with each request: 44k tokens sentContext sent with each request: 47k tokens sentContext sent with each request: 50k tokens sentContext sent with each request: 53k tokens sentContext sent with each request: 56k tokens sentContext sent with each request: 59k tokens sentContext sent with each request: 62k tokens sentContext sent with each request: 65k tokens sentContext sent with each request: 68k tokens sentContext sent with each request: 71k tokens sentContext sent with each request: 74k tokens sentContext sent with each request: 77k tokens sentContext sent with each request: 80k tokens sentContext sent with each request: 83k tokens sentContext sent with each request: 86k tokens sentContext sent with each request: 89k tokens sentContext sent with each request: 92k tokens sentContext sent with each request: 95k tokens sentContext sent with each request: 98k tokens sentContext sent with each request: 101k tokens sentContext sent with each request: 104k tokens sentContext sent with each request: 107k tokens sentContext sent with each request: 110k tokens sentContext sent with each request: 113k tokens sentContext sent with each request: 116k tokens sentContext sent with each request: 119k tokens sentContext sent with each request: 122k tokens sentContext sent with each request: 125k tokens sentContext sent with each request: 128k tokens sentContext sent with each request: 131k tokens sentContext sent with each request: 134k tokens sentContext sent with each request: 137k tokens sentContext sent with each request: 140k tokens sentContext sent with each request: 143k tokens sentContext sent with each request: 146k tokens sentContext sent with each request: 149k tokens sentContext sent with each request: 152k tokens sentContext sent with each request: 155k tokens sentContext sent with each request: 158k tokens sentContext sent with each request: 161k tokens sentContext sent with each request: 164k tokens sentContext sent with each request: 167k tokens sentContext sent with each request: 170k tokens sentContext sent with each request: 173k tokens sentContext sent with each request: 176k tokens sentContext sent with each request: 179k tokens sentContext sent with each request: 182k tokens sentContext sent with each request: 185k tokens sentContext sent with each request: 188k tokens sentContext sent with each request: 191k tokens sentContext sent with each request: 194k tokens sentContext sent with each request: 197k tokens sentContext sent with each request: 200k tokens sentContext sent with each request: 203k tokens sentContext sent with each request: 206k tokens sentContext sent with each request: 209k tokens sentContext sent with each request: 212k tokens sentContext sent with each request: 215k tokens sentContext sent with each request: 218k tokens sentContext sent with each request: 221k tokens sentContext sent with each request: 224k tokens sentContext sent with each request: 227k tokens sentContext sent with each request: 230k tokens sentContext sent with each request: 233k tokens sentContext sent with each request: 236k tokens sentContext sent with each request: 239k tokens sentContext sent with each request: 242k tokens sentContext sent with each request: 245k tokens sentContext sent with each request: 248k tokens sentContext sent with each request: 251k tokens sentContext sent with each request: 254k tokens sentContext sent with each request: 257k tokens sentContext sent with each request: 260k tokens sentContext sent with each request: 263k tokens sentContext sent with each request: 266k tokens sentContext sent with each request: 269k tokens sentContext sent with each request: 272k tokens sentContext sent with each request: 275k tokens sentContext sent with each request: 278k tokens sentContext sent with each request: 281k tokens sentContext sent with each request: 284k tokens sentContext sent with each request: 287k tokens sentContext sent with each request: 290k tokens sentContext sent with each request: 293k tokens sentContext sent with each request: 296k tokens sentContext sent with each request: 299k tokens sentContext sent with each request: 302k tokens sentContext sent with each request: 305k tokens sentContext sent with each request: 308k tokens sentContext sent with each request: 311k tokens sentContext sent with each request: 314k tokens sentContext sent with each request: 317k tokens sentContext sent with each request: 320k tokens sentContext sent with each request: 323k tokens sentContext sent with each request: 326k tokens sentContext sent with each request: 329k tokens sentContext sent with each request: 332k tokens sentContext sent with each request: 335k tokens sentContext sent with each request: 338k tokens sentContext sent with each request: 341k tokens sentContext sent with each request: 344k tokens sentContext sent with each request: 347k tokens sentContext sent with each request: 350k tokens sentContext sent with each request: 353k tokens sentContext sent with each request: 356k tokens sentContext sent with each request: 359k tokens sentContext sent with each request: 362k tokens sentContext sent with each request: 365k tokens sentContext sent with each request: 368k tokens sentContext sent with each request: 371k tokens sentContext sent with each request: 374k tokens sentContext sent with each request: 377k tokens sentContext sent with each request: 380k tokens sentContext sent with each request: 383k tokens sentContext sent with each request: 386k tokens sentContext sent with each request: 389k tokens sentContext sent with each request: 392k tokens sentContext sent with each request: 395k tokens sentContext sent with each request: 398k tokens sentContext sent with each request: 401k tokens sentContext sent with each request: 404k tokens sentContext sent with each request: 407k tokens sentContext sent with each request: 410k tokens sentContext sent with each request: 413k tokens sentContext sent with each request: 416k tokens sentContext sent with each request: 419k tokens sentContext sent with each request: 422k tokens sentContext sent with each request: 425k tokens sentContext sent with each request: 428k tokens sentContext sent with each request: 431k tokens sentContext sent with each request: 434k tokens sentContext sent with each request: 437k tokens sentContext sent with each request: 440k tokens sentContext sent with each request: 443k tokens sentContext sent with each request: 446k tokens sentContext sent with each request: 449k tokens sentContext sent with each request: 452k tokens sentContext sent with each request: 455k tokens sentContext sent with each request: 458k tokens sentContext sent with each request: 461k tokens sentContext sent with each request: 464k tokens sentContext sent with each request: 467k tokens sentContext sent with each request: 470k tokens sentContext sent with each request: 473k tokens sentContext sent with each request: 476k tokens sentContext sent with each request: 479k tokens sentContext sent with each request: 482k tokens sentContext sent with each request: 485k tokens sentContext sent with each request: 488k tokens sentContext sent with each request: 491k tokens sentContext sent with each request: 494k tokens sentContext sent with each request: 497k tokens sentContext sent with each request: 500k tokens sentContext sent with each request: 503k tokens sentContext sent with each request: 506k tokens sentContext sent with each request: 509k tokens sentContext sent with each request: 512k tokens sentContext sent with each request: 515k tokens sentContext sent with each request: 518k tokens sentContext sent with each request: 521k tokens sentContext sent with each request: 524k tokens sentContext sent with each request: 527k tokens sentContext sent with each request: 530k tokens sentContext sent with each request: 533k tokens sentContext sent with each request: 536k tokens sentContext sent with each request: 539k tokens sentContext sent with each request: 542k tokens sentContext sent with each request: 545k tokens sentContext sent with each request: 548k tokens sentContext sent with each request: 551k tokens sentContext sent with each request: 554k tokens sentContext sent with each request: 557k tokens sentContext sent with each request: 560k tokens sentContext sent with each request: 563k tokens sentContext sent with each request: 566k tokens sentContext sent with each request: 569k tokens sentContext sent with each request: 572k tokens sentContext sent with each request: 575k tokens sentContext sent with each request: 578k tokens sentContext sent with each request: 581k tokens sentContext sent with each request: 584k tokens sentContext sent with each request: 587k tokens sentContext sent with each request: 590k tokens sentContext sent with each request: 593k tokens sentContext sent with each request: 596k tokens sentContext sent with each request: 599k tokens sentContext sent with each request: 602k tokens sentContext sent with each request: 605k tokens sentContext sent with each request: 608k tokens sentContext sent with each request: 611k tokens sentContext sent with each request: 614k tokens sentContext sent with each request: 617k tokens sentContext sent with each request: 620k tokens sentContext sent with each request: 623k tokens sentContext sent with each request: 626k tokens sentContext sent with each request: 629k tokens sentContext sent with each request: 632k tokens sentContext sent with each request: 635k tokens sentContext sent with each request: 638k tokens sentContext sent with each request: 641k tokens sentContext sent with each request: 644k tokens sentContext sent with each request: 647k tokens sentContext sent with each request: 650k tokens sentContext sent with each request: 653k tokens sentContext sent with each request: 656k tokens sentContext sent with each request: 659k tokens sentContext sent with each request: 662k tokens sentContext sent with each request: 665k tokens sentContext sent with each request: 668k tokens sentContext sent with each request: 671k tokens sentContext sent with each request: 674k tokens sentContext sent with each request: 677k tokens sentContext sent with each request: 680k tokens sentContext sent with each request: 683k tokens sentContext sent with each request: 686k tokens sentContext sent with each request: 689k tokens sentContext sent with each request: 692k tokens sentContext sent with each request: 695k tokens sentContext sent with each request: 698k tokens sentContext sent with each request: 701k tokens sentContext sent with each request: 704k tokens sentContext sent with each request: 707k tokens sentContext sent with each request: 710k tokens sentContext sent with each request: 713k tokens sentContext sent with each request: 716k tokens sentContext sent with each request: 719k tokens sentContext sent with each request: 722k tokens sentContext sent with each request: 725k tokens sentContext sent with each request: 728k tokens sentContext sent with each request: 731k tokens sentContext sent with each request: 734k tokens sentContext sent with each request: 737k tokens sentContext sent with each request: 740k tokens sentContext sent with each request: 743k tokens sentContext sent with each request: 746k tokens sentContext sent with each request: 749k tokens sentContext sent with each request: 752k tokens sentContext sent with each request: 755k tokens sentContext sent with each request: 758k tokens sentContext sent with each request: 761k tokens sentContext sent with each request: 764k tokens sentContext sent with each request: 767k tokens sentContext sent with each request: 770k tokens sentContext sent with each request: 773k tokens sentContext sent with each request: 776k tokens sentContext sent with each request: 779k tokens sentContext sent with each request: 782k tokens sentContext sent with each request: 785k tokens sentContext sent with each request: 788k tokens sentContext sent with each request: 791k tokens sentContext sent with each request: 794k tokens sentContext sent with each request: 797k tokens sentContext sent with each request: 800k tokens sentContext sent with each request: 803k tokens sentContext sent with each request: 806k tokens sentContext sent with each request: 809k tokens sentContext sent with each request: 812k tokens sentContext sent with each request: 815k tokens sentContext sent with each request: 818k tokens sentContext sent with each request: 821k tokens sentContext sent with each request: 824k tokens sentContext sent with each request: 827k tokens sentContext sent with each request: 830k tokens sentContext sent with each request: 833k tokens sentContext sent with each request: 836k tokens sentContext sent with each request: 839k tokens sentContext sent with each request: 842k tokens sentContext sent with each request: 845k tokens sentContext sent with each request: 848k tokens sentContext sent with each request: 851k tokens sentContext sent with each request: 854k tokens sentContext sent with each request: 857k tokens sentContext sent with each request: 860k tokens sentContext sent with each request: 863k tokens sentContext sent with each request: 866k tokens sentContext sent with each request: 869k tokens sentContext sent with each request: 872k tokens sentContext sent with each request: 875k tokens sentContext sent with each request: 878k tokens sentContext sent with each request: 881k tokens sentContext sent with each request: 884k tokens sentContext sent with each request: 887k tokens sentContext sent with each request: 890k tokens sentContext sent with each request: 893k tokens sentContext sent with each request: 896k tokens sentContext sent with each request: 899k tokens sentContext sent with each request: 902k tokens sentContext sent with each request: 905k tokens sentContext sent with each request: 908k tokens sentContext sent with each request: 911k tokens sentContext sent with each request: 914k tokens sentContext sent with each request: 917k tokens sentContext sent with each request: 920k tokens sentContext sent with each request: 923k tokens sentContext sent with each request: 926k tokens sentContext sent with each request: 929k tokens sentContext sent with each request: 932k tokens sentContext sent with each request: 935k tokens sentContext sent with each request: 938k tokens sentContext sent with each request: 941k tokens sentContext sent with each request: 944k tokens sentContext sent with each request: 947k tokens sentContext sent with each request: 950k tokens sentContext sent with each request: 953k tokens sentContext sent with each request: 956k tokens sentContext sent with each request: 959k tokens sentContext sent with each request: 962k tokens sentContext sent with each request: 965k tokens sentContext sent with each request: 968k tokens sentContext sent with each request: 971k tokens sentContext sent with each request: 974k tokens sentContext sent with each request: 977k tokens sentContext sent with each request: 980k tokens sentContext sent with each request: 983k tokens sentContext sent with each request: 986k tokens sentContext sent with each request: 989k tokens sentContext sent with each request: 992k tokens sentContext sent with each request: 995k tokens sentContext sent with each request: 998k tokens sent
Turns 1–109110–218219–327
One session growing to a full 1M-token window, adding 3k tokens per turn.
Show numbers
RequestsTokens sent in totalLargest request
Tokens sent with each request327166.4M998k

The shaded area is everything sent to the model: 166.4M tokens in total, about 166 times the size of the window. If all of that were billed as ordinary input at $4 per million, filling the window would cost $669.04, not $6.61.

Three prices that aren’t input or output

It doesn’t cost $669.04, because of prompt caching. The API keeps the processed prefix of a request for a while, and when the next request starts with exactly the same content, it’s billed at a much lower rate for reading it, and only the new tokens at the end need processing.3 That makes three prices apply to a request, on top of output:

Token type Price per million tokens Relative to input
Input $4.00 1x
Cache write (5-minute cache) $5.00 1.25x
Cache write (1-hour cache) $8.00 2x
Cache read $0.20 0.05x
Output $20.00 5x

In a long session, almost every token falls in one of the cache rows. The start of each request is the whole of the previous one, so it’s a cache read. The new tokens at the end are written to the cache, and so are a cache write. Plain input is only what’s left over after that, which is next to nothing.

Here’s the session from the chart priced that way, on Opus 5.5 with the 5-minute cache:

Tokens Price per million Cost Share
Input about 0 $4.00 $0.00 0%
Cache read 165.4M $0.20 $33.09 80%
Cache write 998k $5.00 $4.99 12%
Output 164k $20.00 $3.27 8%
Total $41.35

The total is about 6 times the naive estimate of $6.61, and the line that explains most of the difference is the cache read. Each token is written to the cache once, and the $4.99 that costs is about what the naive estimate said the input would cost. What the estimate left out is that every one of those tokens is then read again on every later turn.

Caching is also why the total isn’t $669.04. Cache reads are 80% of the bill and also the reason the bill is about 16 times smaller than it would have been. Input and output are the prices everyone quotes, but the cache read is what you pay for most of the time.

Cost grows with the square of the context

Every turn reads everything before it, and every turn adds to what the next one will read. So the total isn’t proportional to the context size. After n turns of about the same size, the reads add up to about n²/2 turns’ worth of tokens. In this model, getting to 500k tokens costs $12.38 and getting to 1M costs $41.35: twice the context, more than three times the cost.

I went into this in Subagents make Claude Code cheaper, where it shows up in real sessions too. This is that post’s chart of 101 of my own sessions, with cost so far plotted against context size:

Cumulative session cost against context size for 101 Claude Code sessions. Cost rises along a curve rather than a line, reaching about $200 by 900k tokens. A power-law fit gives cost proportional to context to the power of 1.9. Orange points, where more than half of the context was written to the cache again, appear as upward jumps.

A fit to those sessions gives an exponent of 1.9, close to the 2 the reasoning predicts. The real curve is steeper than my model, though: it reaches $135 at 800k tokens, where the model above says about $27.85. I picked a generous 3k tokens per turn. Many real turns add much less, like a short search or a one-line reply, so the same context takes more turns to build, and each of them reads all of it. Real sessions also have cache expiries, the orange jumps in the chart.

What my own bill looks like

This is a breakdown of my own Claude Code spending by token type:

Cost by token type. Input $0.04, 0%. Cache write 5m $3.92, 1%. Cache write 1h $75.12, 25%. Cache read $132.11, 43%. Output $71.57, 24%. Not in transcripts $21.64, 7%.

The total is $304.40, and it splits like this:

Cost Share
Input $0.04 0.01%
Cache write, 5-minute and 1-hour $79.04 26%
Cache read $132.11 43%
Output $71.57 24%
Not in transcripts $21.64 7%

Input is $0.04 out of $304, about one dollar in every 7,600. The two headline prices account for the 24% that is output, and almost nothing else. “Not in transcripts” is cost the tool couldn’t break down by token type. It’s probably mostly compaction, web searches and other things the API doesn’t report as individual requests, so I’m leaving it out of the comparison. Cache reads and cache writes together are $211.15, or 69% of everything, and 75% of what the chart could attribute to a token type.

My model said 80% reads, 12% writes and 8% output, so the split is different. I can’t say how much each of these contributes, but they’re all things a simple model leaves out, and they all push the same way:

  • More output. Thinking tokens are billed as output tokens,4 and a real turn often has more to say than 500 tokens.
  • More writes. Every new session and every subagent writes its starting context from scratch, and every cache expiry writes the whole context again. Claude Code also uses the one-hour cache on a subscription, which costs 1.6 times the 5-minute write price.5
  • A smaller share of reads. Most sessions end far short of 1M tokens, and reads are the part that grows fastest with session size, so the many small sessions dilute them.

None of that changes the conclusion. The proportions move around, but input is still zero and the cache is still most of the bill.

The cache price decides which model is cheaper

If input and output prices aren’t what you pay for, then they’re a poor way to compare models. The cache read price is set separately from the input price, as a different fraction of it for each model:1

Model Input Cache read Cache read as share of input The 1M session
Claude Sonnet 5.5 $2 $0.10 5% $20.67
Claude Opus 5.5 $4 $0.20 5% $41.35
Claude Opus 5 $5 $0.50 10% $93.05
Claude Fable 5.1 $10 $0.25 2.5% $62.01

Opus 5 has an input price only 25% higher than Opus 5.5’s, so it looks like a small step up. Its cache read is 2.5 times as expensive, and the same session costs $93.05 instead of $41.35. Claude Fable 5.1 goes the other way: its input price is 2.5 times Opus 5.5’s, but its cache read is only 25% higher, so the session costs about 1.5 times as much, not 2.5.

  • Cache read
  • Cache write
  • Output
Sonnet 5.5
$20.67
Opus 5.5
$41.35
Opus 5
$93.05
Fable 5.1
$62.01
The same 327-turn session to a full 1M window at each model's list prices, with the 5-minute cache.
Show numbers
Cache readCache writeOutputTotal
Sonnet 5.5$16.54$2.50$1.64$20.67
Opus 5.5$33.09$4.99$3.27$41.35
Opus 5$82.72$6.24$4.09$93.05
Fable 5.1$41.36$12.47$8.18$62.01

This holds the token counts fixed, which isn’t how models compare in practice: a more capable model might finish a task in fewer turns, and a different tokenizer changes how many tokens the same text takes. What it shows is that the pricing page’s input and output columns don’t tell you the cost of a long session by themselves. The cache columns do.

The pricing page also says that Claude 4.6 and later models, other than Haiku 5.5, include the full 1M window at standard pricing,6 so there’s no extra charge for the big window itself. The cost of a big session comes from the replays, not from the size.

What this changes

  • Compare models by cache price. Look at cache read and cache write columns first, and treat input and output as the small part. Multiply by the number of turns you expect, not by the size of one request.
  • Context size is the multiplier. Anything that keeps the context small cuts the cost of every later turn. Clearing between tasks, compacting at natural breaks and handing reading-heavy work to subagents all do that.
  • An expired cache is expensive. At 1M tokens, one more turn with a warm cache costs $0.20. After the cache expires, the same turn is a write: $5.00 on the 5-minute cache and $8.00 on the 1-hour one. That’s 25 to 40 times as much, and the reason I keep a cache countdown in my status line.

References

Footnotes

  1. Claude API docs, Pricing. Prices as of October 2026. “Cache hits and refreshes on Claude Opus 5.5 and Claude Sonnet 5.5 are priced at 0.05x the base input price.” The other models use 0.1x, except Claude Fable 5.1 at 0.025x. ↩ ↩2

  2. Claude Code docs, How Claude Code uses prompt caching: “The model doesn’t remember anything between requests, so Claude Code re-sends the full context: the system prompt, your project context, every prior message and tool result, and your new message.” ↩

  3. Claude Code docs, How Claude Code uses prompt caching: “Without caching, the API would reprocess your full history on every turn. With caching, it reuses what it already processed, bills the re-read at the cached token rate, and fully processes only what changed.” ↩

  4. Claude API docs, Extended thinking: the usage.output_tokens_details.thinking_tokens field “reports how many of the billed output tokens were internal reasoning.” ↩

  5. Claude Code docs, How Claude Code uses prompt caching: on a Claude subscription within plan usage, the main conversation gets a one-hour cache; with an API key it gets five minutes. At Opus 5.5 prices a one-hour write is $8 per million tokens and a five-minute write is $5. ↩

  6. Claude API docs, Pricing, long context pricing: “(A 900k-token request is billed at the same per-token rate as a 9k-token request.) Prompt caching and batch processing discounts apply at standard rates across the full context window.” ↩

More writeups