Claude Prompt Cache TTL: The Coffee Break Tax
The Claude prompt cache TTL is 5 minutes, so a coffee break can rewrite your whole agent context at 25x the warm price. What it costs and which fixes work.
Your coding agent doesn’t charge you for thinking. It charges you for the chai break.
The Claude prompt cache TTL is five minutes. Step away for longer and the next turn pays to write your whole conversation back into the cache. On a long Opus 5.5 session, that turn costs 25 times what it would have cost warm. Most of us compare models on input and output price and never look at the timer.
On 1 December, Requesty published 30 days of coding-agent billing data from Claude Code, OpenCode, Codex and a couple of other tools. Rebuilding expired caches ate 23.1% of the Claude bill. On GPT it was 9.3%. The post crossed 355 points on Hacker News in about half a day. I suspect a lot of invoices got opened in another tab.
Short answer: the cache is warm while your next turn arrives inside the timer, and cold once the timer runs out. Claude Code tells you which one you are in. Run /usage and read the Prompt cache (main) line.
What is the Claude prompt cache TTL?
Five minutes by default, per Anthropic’s prompt caching docs. Every cache hit resets the timer for free. While the agent loops on tests and edits, the prefix stays warm and you keep paying the cheap read rate.
The clock starts when a request starts, not when the response ends. If Claude streams for four minutes, you have about one minute to send the next turn.
The prices are lopsided. A 5-minute cache write costs 1.25x the base input price. A read costs 0.1x, and only 0.05x on Opus 5.5 and Sonnet 5.5. There’s also a 1-hour TTL, where writes cost 2x.
OpenAI picked a longer clock. On GPT-5.6 and later the default cache lives at least 30 minutes, writes are still 1.25x, and the Responses API offers 12 hours at 2.5x. Same write multiplier, six times the timer. Amazon’s Ergo on Bedrock also has a 30-minute TTL, and the Ergo post has its prices.
What a cold cache costs on Opus 5.5
Use list prices. Opus 5.5 is $4 per million input tokens, $5 per million for a 5-minute cache write and $0.20 per million for a cache read.
Say your session has grown to 200,000 tokens of system prompt, tools, diffs and test output. A warm turn reads that prefix for $0.04. Refill your coffee for eight minutes and the same turn writes it all again for $1.00.
A dollar sounds like nothing until you multiply it by every pause, every developer and every working day. In Requesty’s data the expensive gap is the short one. Pauses of 5 to 10 minutes cost 8.0% of the Claude bill, more than every break over an hour put together. Overnight breaks cost GPT and Claude users about the same, because both caches are gone by morning.
Five to ten minutes is about what it takes to read a decent diff properly. So the timer punishes you for reviewing the code your agent just wrote.
Should you turn on the 1-hour cache?
Not blindly. Requesty replayed their traffic with the 1-hour TTL switched on from the first turn, and 87% to 89% of sessions came out more expensive. Most sessions never sit idle long enough to use the extra time, and they still pay 2x on every write.
Switching halfway is worse. In their live tests on the Anthropic API and Vertex, sending 1-hour cache markers to a conversation with a warm 5-minute cache read nothing from it and rewrote the whole prompt at the 2x rate. You pay to fix the problem by causing it.
What saved money in their replay was switching to 1 hour on the first turn after a pause longer than five minutes, when the cache is already dead anyway. That cut about 5% to 7% off the bill. Keeping long sessions warm on purpose did better.
How to keep the Claude Code cache warm
First check which timer you’re on. Claude Code’s docs say a Claude subscription within its included usage already gets the 1-hour TTL on the main conversation. API keys, cloud providers and subscriptions drawing on usage credits get five minutes. Subagents get five minutes everywhere unless you change it.
To choose for yourself on Claude Code v2.1.242 or later:
# main conversation: 5m or 1h
export CLAUDE_CODE_PROMPT_CACHE_TTL=1h
The same choice lives in the promptCacheTtl setting. Subagents and other side requests have their own knob, CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL. Leave them on five minutes unless they really do sit idle.
If you run your own agent on the API, Anthropic documents a cheaper trick: a pre-warm request with max_tokens: 0. It reads the cached prefix, returns no output tokens and restarts the clock. Requesty re-sent the last request body this way after about 4.5 minutes idle, with fewer pings on short threads, and measured roughly 8% to 9% off the Claude coding bill after paying for the pings.
def keep_alive(client, last_request: dict):
body = {**last_request, "max_tokens": 0}
body.pop("stream", None) # max_tokens: 0 rejects stream: true
return client.messages.create(**body)
Anthropic also rejects max_tokens: 0 with extended thinking enabled, structured outputs, a forced tool_choice, or inside a Message Batches request. And cap the pings. Once a developer has really left, every ping is money spent on nobody.
How do I check if my prompt cache expired?
Read the usage block. Every response splits input into cache_read_input_tokens and cache_creation_input_tokens. A continuing turn where reads drop to almost zero and creation jumps to the full prompt size is a pause you paid for. Count those per day and you have your pause bill.
In Claude Code, /usage shows a “Prompt cache (main)” line with your hit ratio and whether the cache is warm right now. To see which TTL your writes used, run claude -p "hello" --output-format json and compare ephemeral_1h_input_tokens with ephemeral_5m_input_tokens.
Model switches throw the cache away too, and so does a skill that sets its own model. If you’ve installed a pile of Claude Code skills, that’s one more reason to read them before you trust them.
It’s the same habit as tracking cost per finished task when you suspect a model got worse. Your bill often moves before anything else you’re watching does.
What does “prompt cache warm” mean in Claude Code?
Warm means the cached start of your conversation is still inside its lifetime, so the next turn reads it at the cheap rate. Cold means the timer ran out, and the next turn writes the whole prefix again.
The /usage line has more in it than a hit ratio. Anthropic’s cost docs show it like this, on Claude Code v2.1.251 or later:
Prompt cache (main): 14 requests · 91% of input tokens from cache · 2 misses (last 6m 10s ago, 310.2k tokens re-cached) · 1 expected rebuild (compaction or tool-result clearing) · warm (1h TTL, last activity 40s ago)
Read it from the right. warm (1h TTL, ...) says the prefix is alive and which timer you are on. When the cache is cold, the docs say the line shows how long the session has been idle. If the line ends with no prompt caching reported by the API, no response has reported cache tokens. That means caching is off, or your provider or gateway doesn’t report it, which is a different problem from a cold cache.
A miss, in the status line docs, is a request that re-processed content the cache already held: more than 5% and at least 2,000 tokens of what the request could have read from cache, with no compaction or tool-result clearing to explain it. From v2.1.260 the line can name a likely cause, for example likely cause: tool definitions changed. The same docs list cause names such as tools_changed, system_prompt_changed, ttl_expired_5m and likely_server_side.
The same data reaches a status line script as the prompt_cache object: warm, ttl, expires_at, and recache_tokens_if_cold, the tokens your next request would write back if the cache has gone cold. Claude Code re-runs the status line when a warm cache reaches expires_at, so it flips to cold without a timer of your own.
Two limits. The line covers the main conversation only, not subagents, and /clear resets it.
Checked on 2 December 2026 against Anthropic’s cost and status line docs.
Is this a reason to switch to GPT?
On this one line item, the longer timer wins. For pauses of 5 to 30 minutes, Requesty measured Sonnet 5.5 missing the cache 81.2% of the time and GPT-6.1 Sol 2.3%, at the same list price. At team scale that’s real money.
But you pick a model for the answers first. A cheap wrong answer is the most expensive token you’ll ever buy. Fix the timer before you switch the model. One is an environment variable. The other is a migration.
Also treat third-party billing studies the way you treat vendor promises. Useful, not gospel. I said it about zero data retention: if you can’t check it, it isn’t a control. Your own usage logs you can check this afternoon.
My Rule for 2026: A token price without a cache TTL next to it is half a price. Budget for the timer, or the timer budgets for you.
So how many of your agent’s turns last week started cold?
Get the next one by email.
Sent when a post is ready. Never filler.
Free / One email per post / Unsubscribe in one click
Next issue // when it is ready
No filler.
One lesson from production per issue. What broke, why, and the rule I took from it. No roundups. No launch-day cheerleading.