Claude's 5-Minute Prompt Cache Turns a Coffee Break Into a Full Rewrite
Your coding agent is cheapest while it's busy. Here's what a pause really costs, and how to read it in Claude Code before you change anything.
A coding agent is cheapest when it's working and most expensive right after you stop watching it.
That sounds backwards. An agent that runs tests and edits files for an hour burns through tokens, and one sitting idle while you read a diff burns nothing. Except the idle one isn't free. When you come back and type your next message, the agent has to send the whole conversation again, and if the provider forgot it in the meantime, you pay to rebuild all of it.
On Claude, "the meantime" is five minutes.
A gateway company called Requesty published numbers on December 1 that put a price on that gap. In its own customers' coding-agent traffic, rebuilding caches that expired during pauses took 23.1% of the Claude bill, against 9.3% on OpenAI's GPT models (Requesty). Both providers charge the same cache multipliers relative to their own input prices. The big difference in the bills is the timer.
So the real question for anyone running Claude Code, OpenCode or another agent on Claude isn't "which model is cheapest per token." It's "how long do I walk away, and what happens when I do." Claude Code will tell you which timer you're on, and what your last break cost, in one line of /usage. That check comes first.
What a prompt cache actually saves you
Every time a coding agent takes a turn, it sends the model everything so far: the system prompt, the tool definitions, your messages, and every file and test result from earlier turns. By turn twenty, that can be hundreds of thousands of tokens, and almost all of it is identical to what it sent on turn nineteen.
Prompt caching lets the provider keep that repeated beginning (the prefix) in memory, so it doesn't have to process it again. Think of a restaurant that keeps your table set between courses. As long as you come back soon, the next course costs a fraction of the first. Leave too long and the table gets cleared, and you pay to set it again.
Anthropic's prices make the gap concrete. For Claude Opus 5.5, regular input costs $4 per million tokens. Writing tokens into the five-minute cache costs $5 per million, and reading them back costs $0.20 per million (Anthropic pricing table). A warm read is one twenty-fifth the price of a fresh write.
That 25-to-1 ratio is the whole story. Caching works beautifully until the cache expires, and then you're paying the write price again on your entire conversation.
The five-minute clock starts earlier than you think
Anthropic's docs spell out the rule: the default cache lifetime is five minutes, every read refreshes it for free, and the lifetime "is measured from the start of the request that writes or reads the cache entry, not from the end of its response" (Anthropic docs).
That last part matters more than it looks. If Claude spends four minutes writing a long response, your next request has to start within about a minute of that response finishing, or the cache is gone. The docs use exactly that example.
While the agent loops on its own, this never bites. Requests arrive every few seconds, and each one resets the clock. The trouble starts when the agent stops and waits for you: to review a diff, answer a question, or get coffee.
OpenAI's default runs much longer. Requesty's write-up lists GPT-6.1 Sol with a 30-minute minimum default, and its own live tests found GPT still reading the full prefix from cache after a 12-minute pause (Requesty). That is the source of the gap in the bills. Same per-token multipliers, different clocks.
What one break costs
Requesty walks through one case. A Claude Opus 5.5 session holding 210,000 tokens of context pauses for eight minutes. A warm read of that prefix would cost about $0.04. After the pause, the next turn has to rewrite the whole prefix, which costs about $1.05 at list price (Requesty).
The arithmetic checks out against Anthropic's own table: 210,000 tokens at $0.20 per million is $0.042, and at $5 per million it's $1.05.
A dollar doesn't sound like much. But pauses aren't rare. In Requesty's data, sessions running one to four hours averaged 3.3 pauses longer than five minutes, and sessions over a day averaged nearly 14. Across the 30-day window (October 24 to November 22), pauses of 5 to 30 minutes accounted for 15.2% of the Claude bill. On GPT, the same pauses cost 0.8%.
Breaks longer than 30 minutes cost both families about the same (7.8% on Claude, 8.5% on GPT), because every cache is gone by then. The expensive zone is the in-between: long enough to clear Claude's table, short enough that GPT's would still be set.
Who this actually hits
Before changing anything, figure out whether this is your problem at all. Claude Code treats accounts differently.
If you use Claude Code on a Pro, Max or other subscription and stay within your included usage, Claude Code already requests the 1-hour cache on the main conversation automatically (Claude Code env vars). The five-minute cliff mostly doesn't apply to your main chat.
If you run Claude Code on an API key, Amazon Bedrock, Google Cloud, Microsoft Foundry or Claude Platform on AWS, the default is five minutes. Same if you're a subscriber drawing on usage credits beyond your included usage. And other agent tools that talk to Claude through the API make their own choices: Requesty says OpenCode sent 0% of its large Claude cache writes at one hour in its window, and Claude Code used the 1-hour option on 2% to 10% of most routes it saw (Requesty).
So the people paying the timer tax are mostly API and cloud users: teams on a company key, people running agents through Bedrock, and anyone using a third-party coding tool with Claude.
Why "just turn on the 1-hour cache" is the wrong first move
The obvious fix is to make the cache last longer. Anthropic offers a one-hour lifetime, and Claude Code has a setting for it. The catch is the price: one-hour cache writes cost 2x base input instead of 1.25x (Anthropic docs). On Opus 5.5 that's $8 per million tokens instead of $5.
You pay that premium on every write, including all the writes during the stretches where the agent is looping and would never have hit the five-minute limit anyway. Requesty replayed its sessions with the 1-hour cache turned on from the first turn and found that 87% to 89% of sessions ended up paying more (Requesty).
It also found a trap in switching halfway. Flipping a warm five-minute conversation to the one-hour cache mid-session didn't reuse anything in Requesty's live tests on the Anthropic API and Vertex. It rewrote the entire prompt at the 2x rate.
The one-hour cache is insurance. It pays off when you pause often and your context is large. It costs you when you don't.
Put this into practice
Here's the lowest-effort order to work through it.
1. Read your own numbers first. In Claude Code version 2.1.251 or later, run /usage. After your first response, the Session block includes a "Prompt cache (main)" line (Claude Code costs docs). It looks like this:
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)
That example comes straight from the docs.
Look at three things: how many misses you have, how many tokens each miss rewrote, and which TTL (time to live, the cache lifetime) is in effect. If you see "5m" and a miss that rewrote 300,000 tokens after a six-minute gap, you've found the tax. When Claude Code can identify a likely cause for the last miss, it names it on the same line. The line covers the main conversation only, not subagents.
2. Match the setting to how you work. If your sessions are short, or you mostly let the agent run while you stay at the keyboard, stay on five minutes. If you run long sessions with frequent five-to-twenty-minute breaks to read diffs or review pull requests, the one-hour cache starts to pay for itself.
3. Set it at launch, not halfway through. For the main conversation, in a macOS or Linux shell (Claude Code v2.1.242 or later):
CLAUDE_CODE_PROMPT_CACHE_TTL=1h claude
Claude Code accepts only 5m or 1h. A separate variable, CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL, controls subagents, workflows and background work, so you can keep those on five minutes (they tend to run in tight loops) while the main conversation gets the longer cache (Claude Code env vars). If you ever need to force everything back to five minutes, FORCE_PROMPT_CACHING_5M=1 overrides the rest.
Setting it when you start the session matters because of the mid-session trap above.
4. Don't switch models casually in a long session. Claude Code's settings docs note that each model has its own prompt cache, so the first request after a /model switch re-reads the whole conversation uncached (Claude Code settings). Switching to a cheaper model to "save money" on turn forty can cost more than it saves.
5. Check again after a week. Run /usage at the end of a few real sessions and compare misses before and after. If the one-hour setting didn't cut the rewritten tokens, turn it off.
Requesty's write-up also tests a keep-alive approach, where a tool sends small ping requests during idle time to keep the cache warm. It reports roughly 7% to 9% net savings across its data, but also that 43% to 52% of long sessions spent more on pings than they saved individually. That's a gateway-level trick, not a Claude Code setting, and worth knowing about mostly so you can judge it if a tool offers it.
The honest limitations
The biggest numbers here come from one company measuring its own customers. Requesty sells an AI gateway with caching and routing, so it has a reason to find caching problems. Its dataset covers its traffic and its customers' tools, it says it used token and billing counters only, and it doesn't publish the raw data, so nobody outside can audit the math. Your mix of tools, models and pause habits will differ. Treat the 23.1% and 15.2% figures as a strong reason to check your own logs, not as your number.
The provider comparison is narrower than it looks. Requesty's GPT figures come from GPT-6.1 Sol on OpenAI and Azure. Other models and regions may behave differently, and cache behavior on Bedrock had its own wrinkles in its measurements.
Prices and defaults change. Everything here reflects Anthropic's pricing table and Claude Code's docs as read on December 1, 2026. Subscription plans behave differently from API billing, and your plan's limits matter more than list prices if you're a subscriber.
And the cache isn't the only reason a long session gets expensive. A conversation that has grown to 300,000 tokens costs more per turn no matter how warm the cache is. Sometimes the cheaper move is a fresh session with a short summary, not a longer cache.
What to do Monday morning
Price per token is the sticker. Cache lifetime is the meter, and it runs whether you're at your desk or not.
Open a long session, take a real break, come back, and run /usage. If you see a five-minute TTL and a six-figure rewrite after the break, you have a decision to make, and now you know what it costs both ways. If you don't see it, leave the setting alone and stop worrying about it.
The goal isn't the longest cache. It's knowing which timer you're on, and choosing it on purpose.
Sources: Requesty, "Claude's 5-minute timer is 23% of your coding bill" (December 1, 2026); Anthropic, Prompt caching docs and pricing; Claude Code environment variables; Claude Code, Manage costs effectively; Claude Code settings. All read December 1, 2026.