Last week, we published A Week With Haiku, Sonnet and Opus: Which Model for Which Job. One finding was that about nine dollars in ten went to context, not to the words the model wrote back. A reader asked a sharp follow-up question on LinkedIn. If most of the money is context, isn’t caching a bigger lever than picking the model? And were most of those context tokens already cache hits?
We were already debating our own compaction strategy. We would compact constantly, except that compaction itself costs money. So, we went back to the logs to settle it with numbers.
Who this applies to: anyone who uses Claude Chat directly, uses Claude Code directly, puts their own harness around one of them, or runs a full agent on the Claude API. Our numbers come from Claude Code only. Near the end, we say which findings carry over to the other three and which don’t.
What a cache hit saves
When a request starts with the same text as a recent one, Claude can read that text from a cache instead of processing it again. Anthropic bills three prices for input:
- Cache hit: 0.05 times the normal input price on Claude Opus 5.5 and Claude Sonnet 5.5, and 0.1 times on most other models, including Claude Haiku 5.5. On Opus 5.5, that is $0.20 per million tokens instead of $4.
- Cache write with a 5-minute lifetime: 1.25 times the normal input price.
- Cache write with a 1-hour lifetime: 2 times the normal input price, or $8 per million tokens on Opus 5.5.
Each hit resets the lifetime clock at no extra cost. This is stated in Anthropic’s pricing and prompt caching documentation, which we checked on December 4, 2026.
The ratio that matters is between the write and the hit. On Opus 5.5 and Sonnet 5.5, a 1-hour write costs 40 times as much as a hit.

What we measured
We read every Claude Code session on one PC from October 21 to December 4, 2026: 429 sessions and about 43,800 replies. Each reply records how many input tokens were cache hits, cache writes, or plain uncached input. We priced them all at Anthropic’s list API prices.
The reader was right about the tokens. Cache hits were 97% of context tokens on Opus 5.5 and Sonnet 5.5, and 95% on Haiku 5.5. Cache writes were the rest, and uncached input was close to zero.
The dollars tell a different story. At list prices, the whole period came to $4,558:
- Cache writes: 47% of the dollars, from only about 3% of the tokens.
- Cache hits: 42%.
- Output: 11%.

Opus 5.5 and Sonnet 5.5 split almost exactly the same way, and Haiku 5.5 leaned a bit more toward hits. Claude Code wrote 95% of its cache with the 1-hour lifetime, so every write cost 40 times a hit. Caching was already doing its job. The money was in the misses.
Why caches miss
Some writes can’t be avoided. Every reply adds new text to the end of the conversation, and that new text gets written to the cache once. That came to $450, about 10% of the total. Starting a session or a subagent cost another $112.
The big one was idle time. When a session sat for more than an hour, the cache expired, and the next reply wrote the whole conversation again at the 1-hour write price. That happened 825 times. The median conversation was 207,000 tokens long, and the median gap was almost seven hours: overnight, a meeting, or a background session waiting for its next message. Those rebuilds cost $1,486, a third of everything we spent.

Gaps shorter than an hour almost never missed. We counted about 2,400 gaps between five minutes and an hour, and only 18 led to a rebuild. Past the hour, nearly every gap did. That matches the 1-hour lifetime.

The size of the conversation sets the price of each miss. On Opus 5.5, our median rebuild of 207,000 tokens cost $1.66. A 500,000-token session costs $4 to pick up again the next morning.

Model switches mattered less than we expected. A cache belongs to one model, so a switch starts over. In our logs that happened 61 times and cost $72, under 2% of the total.
What compaction costs
Compaction replaces a long conversation with a short summary and carries on. Our first count found 46 compaction markers. They turned out to be 28 compactions, because a compaction can leave more than one marker. We checked all 28: each had the compaction boundary, the summary, and a large cache write on the next reply. All 28 were automatic, at about 370,000 or about 970,000 tokens.
Each compaction has two costs:
- The summary call: the model reads the long conversation and writes a summary of about 4,500 tokens. Claude Code doesn’t log this call, so we estimated it from the conversation size and the summary length: a median of $0.15. That figure is our inference.
- The rebuild: the next reply writes the new, shorter conversation to the cache. We measured this: a median of $0.44.
So, a compaction cost about $0.59, and all 28 together cost about $17.
What it buys is a smaller conversation to carry. After compaction, the context dropped from about 370,000 tokens to about 100,000 in most sessions. Every later reply reads fewer cached tokens. At the median, compaction paid for itself after 11 replies, with a range of 4 to 28. Every one of the 28 was followed by at least 15 replies, and the median was 127, so all of them paid back.

The break-even depends on how big the conversation is when you compact. Compacting a 970,000-token conversation pays back in about 5 replies. At 370,000 tokens, it takes about 13. At 150,000 tokens, it takes about 70, because there is little to drop and the rebuild costs the same. The ratio between hit and write prices is the same on Opus 5.5 and Sonnet 5.5, so the curve is the same for both.

The strategy, with numbers
Compacting constantly doesn’t pay. Below about 200,000 tokens, it takes dozens of replies to earn the cost back, and every compaction loses some detail.
Compacting before you leave is a different story. Take a 400,000-token session on Opus 5.5 that sits overnight. Walk away, and the first reply in the morning rewrites all of it: $3.20. Compact first, and you pay for the summary and a rewrite of about 100,000 tokens: $0.97.

Had we done this before each of the 540 long idle gaps with more than 150,000 tokens in context, we estimate we would have saved about $914, or 20% of the total. This is one PC, one workload, and one person’s working pattern over six weeks.
For the groups at the top, the findings carry over like this:
- Claude Code: these are your numbers, if your sessions look like ours.
- A harness or a full agent on the Claude API: the prices and the break-even math apply as they are. The default cache lifetime there is 5 minutes, not an hour, so any gap over 5 minutes is a rebuild unless you choose the 1-hour lifetime. The idle-gap rule matters even more.
- Claude Chat: we have no logs from it, and its cache behavior isn’t visible to us, so treat the rule as reasoning, not measurement.
The bottom line
The reader’s question had a good answer. Caching was already working: 97% of the tokens were hits. The bill came from the moments the cache was lost, and most of those were us walking away from big sessions.
|
The short version 1. Leaving for more than an hour? Compact or end any session over about 150,000 tokens. For us, that was worth about 20% of the bill. 2. Still working? Compact once the conversation passes about 350,000 tokens and you expect at least 15 more replies. It pays back in about 13. Claude Code already does this on its own near that point. 3. Switching models? Don’t worry about it. It cost us under 2%. 4. Building on the API? Your cache lasts 5 minutes by default, so the same rule applies after a coffee break, not just overnight. |

Sources
- Anthropic, “Pricing,” Claude Platform documentation, accessed December 4, 2026.
- Anthropic, “Prompt caching,” Claude Platform documentation, accessed December 4, 2026.
- Anthropic, “Compaction,” Claude Platform documentation, accessed December 4, 2026.
- Distributed Logic, Claude Code session logs on one PC, October 21 to December 4, 2026 (measured, aggregates only).
