Blog / Cost
Prompt Caching in Claude Code: Why Cold Resumes Cost Money
How prompt caching works in Claude Code, what a cold resume costs at Opus 5.5 prices, how the 5-minute and 1-hour TTLs differ, and what we measured ourselves.

Every Claude Code request resends the whole conversation. While the cache is warm, that costs 5% of the input price on Opus 5.5. After a long break, the same history is rewritten at 125% of the input price. In our sessions, those rewrites were 11.4% of the total.
Table of contents
- Why a resume can cost more than a turn
- How the cache works in Claude Code
- The price list
- What a cold resume costs
- Which TTL you get
- What we measured
- How to avoid cold resumes
- Things that break the cache without a break
- Frequently asked questions
Prices and behavior are as of 2026-11-23, from Anthropic's pricing page and the Claude Code prompt caching docs. Both change, so check them. Subscription users do not see these dollars on a bill, but the same work counts against plan limits, which we explain in our post on Claude Code usage limits.
Why a resume can cost more than a turn
You come back to a session after lunch and type one line. The answer takes longer than usual, and the session's cost jumps by more than a dozen ordinary turns would explain. Nothing is wrong. The cache expired while you were away, and the next request had to write your entire conversation back into it.
Claude Code's docs describe the cause: "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." Caching is how the API avoids reprocessing the part that did not change. When the cache is gone, nothing is skipped.
The cost of that is not small, because the conversation is large. In the sessions we measured, 63.8% of all cost came from requests carrying more than 200k tokens of context. Rewriting 300k tokens is a different order of money from reading them.
How the cache works in Claude Code
The API caches by prefix. The Claude Code docs say it "caches by matching the start of each request, called the prefix, against content it recently processed", and "the match is exact, so a change anywhere in the prefix recomputes everything after it." There is no per-file caching.
Claude Code orders each request so the stable parts come first:
| Layer | Content | Changes when |
|---|---|---|
| System prompt | Core instructions, tool definitions | The set of loaded tool definitions changes |
| Project context | CLAUDE.md, auto memory, unscoped rules | Session starts, or after /clear or /compact |
| Conversation | Messages, responses, tool results | Every turn |
Source: Claude Code prompt caching docs. On a normal turn, everything but the latest exchange is a prefix match, so it is read from cache. A cache entry lives for a limited time, and each request that reads it refreshes the timer at no extra cost. The API doc says: "By default, the cache has a 5-minute lifetime. The cache is refreshed for no additional cost each time the cached content is used" (source). So while you keep working, the cache stays warm. When you stop for longer than the lifetime, it expires.
Two other facts matter. Each model has its own cache, so switching models recomputes everything. And in Claude Code the cache is effectively scoped to one machine and one directory, because the system prompt embeds paths and the conversation opens with the working directory and OS. Parallel sessions in the same directory can read each other's cache; sessions in different directories cannot.
The price list
From the model table on Anthropic's pricing page, checked 2026-11-23, per million tokens:
| Model | Input | 5-minute cache write | 1-hour cache write | Cache read | Source |
|---|---|---|---|---|---|
| Claude Opus 5.5 | $4 | $5 | $8 | $0.20 | Pricing |
| Claude Sonnet 5.5 | $2 | $2.50 | $4 | $0.10 | Pricing |
| Claude Haiku 5.5 (prompt up to 100k) | $0.10 | $0.125 | $0.20 | $0.01 | Pricing |
The multipliers behind them: a 5-minute write is "1.25x base input price", a 1-hour write is "2x base input price", and a cache read is 0.1x on most models. On Opus 5.5 and Sonnet 5.5 the read is 0.05x, which is why $0.20 is a twentieth of $4. Anthropic's rule of thumb is that "caching saves money after a small number of cache reads: 5-minute duration (1.25x write): after one cache read; 1-hour duration (2x write): after two cache reads."
The asymmetry is the story. A cache read costs 5% of input. A cache write after expiry costs 125% (five minutes) or 200% (one hour). The gap between a warm turn and a cold one is 25x on a five-minute write and 40x on a one-hour write.
What a cold resume costs
Take Opus 5.5 and three context sizes. These are arithmetic from the list prices above, for the cached portion only, not a measurement.
| Context | Warm turn (cache read) | Cold resume, 5-minute write | Cold resume, 1-hour write |
|---|---|---|---|
| 100k tokens | $0.02 | $0.50 | $0.80 |
| 300k tokens | $0.06 | $1.50 | $2.40 |
| 600k tokens | $0.12 | $3.00 | $4.80 |
Add the output tokens and any new input, which are the same in both cases. The first request after a long break carries the extra cost, and then the cache is warm again. So a cold resume is a one-time charge of about $1.50 on a 300k-token session, and a session you leave and return to five times pays it five times.
Compaction can make this worse. The docs say that after a break longer than the cache lifetime, "there is no cache left to read, so the summarization request reprocesses that history as uncached input. This is why /compact costs the most when you resume an old session." Compacting at a natural break while the cache is warm costs "a fraction of what the context size suggests".
Sonnet 5.5 is half the price of Opus 5.5 on every line, and Haiku 5.5 is a twentieth of Sonnet's input price up to 100k tokens. Haiku 5.5 is also priced by prompt length: a request whose prompt goes over 100,000 tokens, counting cache reads and writes, pays $0.50 input and $0.625 for a 5-minute write. The model you choose changes the size of the cold-resume bill by the same ratio. Our post on Opus versus Sonnet in Claude Code covers that choice.
Which TTL you get
This is the part most articles skip. The Claude Code docs say Claude Code decides the cache lifetime per request, in two buckets, and the defaults depend on how you pay:
| Request bucket | Claude subscription, within plan usage | Usage credits, API key or cloud provider |
|---|---|---|
| Main conversation | One hour | Five minutes |
| Everything else (subagents, workflows, teammates, forks, compaction, session titles) | Five minutes (a few server-controlled helper requests get one hour) | Five minutes |
Source: Claude Code prompt caching docs. Three consequences.
On a subscription, a gap of up to an hour keeps the main conversation warm. On an API key, a gap of five minutes does not. A coffee break is a cold resume on the API and a warm one on a plan. If you pay per token and walk away from sessions often, the default is the more expensive of the two for you.
Subagents get five minutes even on a subscription. A subagent that sits waiting for a long task can lose its cache.
When you go over your plan's limit and draw on usage credits, Claude Code drops the main conversation to five minutes, because the one-hour write rate is higher.
You can set the lifetime yourself. The promptCacheTtl setting or the CLAUDE_CODE_PROMPT_CACHE_TTL environment variable takes 5m or 1h for the main conversation, and subagentPromptCacheTtl or CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL covers everything else. They need Claude Code v2.1.242 or later. If you sign in with an API key, set promptCacheTtl to 1h to get an hour. FORCE_PROMPT_CACHING_5M=1 forces five minutes for both, which helps when you are comparing the two.
To confirm what you are getting, run claude -p "hello" --output-format json and read usage.cache_creation: one-hour writes show up as ephemeral_1h_input_tokens and five-minute writes as ephemeral_5m_input_tokens.
Is the one-hour TTL worth it on the API? Use the break-even above. A 1-hour write costs 2x input against 1.25x, a difference of 0.75x input per cached token. It pays for itself if it saves one cold resume. If you rarely pause for more than five minutes, it costs more for no benefit. The docs make the same point: the longer TTL "costs more on short bursts of work that never idle past five minutes".
What we measured
We read our own transcripts. From 2026-10-02 to 2026-11-23 (about 7.5 weeks), one small team ran 792 Claude Code sessions with 54,344 requests across 17 products and Code Tycoon itself. We priced every request at Anthropic's list prices: Opus 5.5 was 99.2% of the cost, and cache writes at 1.25x input for five minutes and 2x for one hour. The total at list price was $5,998. This is dollar-equivalent usage, not what anyone was billed.
We defined a cold resume as a request more than 60 minutes after the previous one in the same transcript that wrote over 20k tokens to cache and read less than it wrote.
| Measure | Value |
|---|---|
| Cold resumes (gap over 1 hour) | 405 |
| Cost of those cache rewrites | $681, which is 11.4% of the total |
| Average per cold resume | about $1.68 ($681 divided by 405) |
| Gaps of 5 to 60 minutes between requests | 1,692 |
| Median session | $3.28 |
| 90th percentile session | $17.35 |
| Cost from requests with over 200k tokens of context | 63.8% |
Read this carefully. We used a one-hour threshold because that is the longest TTL. A resume after more than an hour is cold under either TTL. The 1,692 gaps of 5 to 60 minutes are different: they were cold only if the request got the five-minute TTL. We did not separate those, so the $681 is a floor for the API case, not a ceiling. This is one team, mostly one model, and a short window. Treat it as one team's usage rather than a benchmark.
Two things are still useful. First, the average cold resume at about $1.68 is the same order as our arithmetic for a 300k-token context. Second, 405 of them across 792 sessions means resumes were routine, not rare, which is what you would expect from people running several sessions and coming back to them.
A median session cost $3.28. One cold resume of $1.68 is about half of that. For a short task that you pick up the next morning, the resume can cost more than the work.
How to avoid cold resumes
Ranked by how much each saves:
- Finish or clear before you leave. If the task is done,
/clearbefore the break. A new session starts at a small context, so the first request writes little. Use/renamefirst if you want to/resumelater. - Compact at a natural break, while the cache is warm. The docs advise running
/compactbetween tasks, "instead of waiting for auto-compaction to trigger mid-task". Compacting a cold 400k session costs a full uncached read of the history. - Pick the TTL deliberately. On an API key with long pauses, set
promptCacheTtlto1h. On a subscription, the default already covers a one-hour gap. - Resume small sessions, not big ones. A cold resume is proportional to context. Coming back to a 90k session costs a fraction of coming back to a 500k one.
- Use
/rewindto abandon a dead end. The docs note that it "truncates back to a prefix that is already cached", unlike compaction. - Watch idle compaction. If you leave a long conversation idle on the one-hour TTL, Claude Code can compact it. You can turn that off with
idleCompaction: falseon v2.1.290 or later.
You can check how you are doing with /usage: after the first response it adds a Prompt cache (main) line showing the share of input read from cache, the misses with the number of tokens re-cached, and whether the cache is warm. It needs v2.1.251 or later. Code Tycoon reads the same transcripts and flags cold resumes and oversized contexts per session, and sends an alert when a cache has expired. The self-hosted version is free. If you run sessions on a server, see how in our guide to a dedicated Claude Code server.
Things that break the cache without a break
Time is not the only cause. The docs list actions that invalidate part or all of the cache:
- Switching models with
/model, includingopusplaneach time you toggle plan mode. - Changing effort level on most models. On Opus 5.5, Sonnet 5.5 and Haiku 5.5 with an API key or subscription, the cache stays intact.
- Turning fast mode on or off, since it keeps a separate cache.
- Connecting or removing an MCP server, when tools load upfront rather than deferred.
- Compaction, which replaces history with a summary.
- Accumulating many images, which makes Claude Code drop the oldest.
- Upgrading Claude Code, which usually changes the system prompt.
And actions that keep it: editing files, editing CLAUDE.md mid-session, changing permission mode or output style, invoking skills, running /recap, rewinding, and spawning a subagent. The practical rule from the docs: pick your model and effort at the top of a session, and save /compact for breaks between tasks.
Model switching is the one most people do without thinking. Moving from Opus to Sonnet halfway through a long session saves nothing on that turn, because the Sonnet cache is empty and the whole history is written to it. If you plan to run the cheaper model for a while, start the session on it. Our post on what Claude Code costs per month has more on how session size drives the bill.
Frequently asked questions
How long does the Claude Code prompt cache last?
It depends on the TTL. The API default is five minutes. On a Claude subscription within plan usage, Claude Code requests one hour for the main conversation. On an API key, usage credits or a cloud provider the main conversation gets five minutes unless you set promptCacheTtl to 1h.
How much does a cold resume cost?
At Opus 5.5 list prices, writing 300k tokens to a five-minute cache costs $1.50, and to a one-hour cache $2.40, against $0.06 for a warm read. In our 405 measured cold resumes the average was about $1.68.
Is the 1-hour cache worth it?
It pays for itself if it saves one cold resume, because a 1-hour write costs 2x input against 1.25x for five minutes. If you never pause longer than five minutes, it costs more for no gain.
Does prompt caching apply on Pro and Max plans?
Yes, Claude Code uses it on subscriptions, and the main conversation requests the one-hour TTL within plan usage. You do not see dollars, but cache misses reprocess your full context and count against your limits.
Why is my first message after a break slow?
The cache expired, so the API recomputes your full history before answering. The docs say the first turn back after stepping away "can be noticeably slower".
How do I check if my cache is working?
Run /usage and read the Prompt cache (main) line, which needs Claude Code v2.1.251 or later. A high share of input read from cache means it is working. For raw numbers, compare cache_read_input_tokens and cache_creation_input_tokens in your status line.
Conclusion
A cold resume rewrites your whole context at 125% or 200% of the input price instead of reading it at 5%. Clear before you leave, compact while the cache is warm, set the TTL on purpose, and start on the model you plan to stay on.
Related articles
- What does Claude Code really cost per month?
- Claude Code usage limits: 5-hour windows and weekly caps
- Claude Pro vs Max 5x vs Max 20x for Claude Code
About this research
Code Tycoon prices every session and flags cold resumes. Prices and cache behavior come from Anthropic's pricing page and the Claude Code and API prompt caching docs, read on 2026-11-23; quotes and URLs are in our sources file.
The measurements come from our own Claude Code transcripts (792 sessions, 2026-10-02 to 2026-11-23), priced at API list prices. The cold-resume table in the cost section is arithmetic, not a test.
Content reviewed and updated: 2026-11-26
Keep reading
Cost Per Committed Task: Benchmarking Your Claude Code Use
Cost per session hides what you got. Our 792 sessions show a $3.28 median overall and $6.59 for sessions that committed. How to measure yours, with caveats.
Context Size vs Cost: When to /clear and When to /compact
Long Claude Code contexts cost more per request. When to use /clear, when /compact pays for itself, with list-price arithmetic and numbers from 54,344 requests.
Claude Code Habits That Burn Usage Limits (Our Data)
Six Claude Code habits ranked against our own transcripts: huge contexts, Opus for everything, cold resumes, marathon sessions, idle gaps, model switches.