Guide · AI coding
Claude API bill up after a coffee break? The 5-minute cache, what a pause costs, and 3 fixes
Claude's prompt cache expires after 5 idle minutes, so the next turn re-writes the whole context: $1.05 instead of $0.04 on a 210K-token Opus 5.5 session. Here's how to fix it.
The short version
- On the Claude API the prompt cache expires after 5 minutes without a request, so the first turn after a break pays the write price for the whole conversation again.
- On a 210,000-token Claude Opus 5.5 session that turns a $0.04 cache read into a $1.05 cache write, by Anthropic's list prices.
- Gateway vendor Requesty found that pauses of 5 to 30 minutes cost 15.2% of Claude coding spend in its traffic, against 0.8% for GPT models.
- Anthropic's rule: pick the 1-hour cache at the start of a conversation once about 1 turn in 20 follows a pause of 5 to 60 minutes.
Prices, checked daily Claude pricing · Claude API pricing
In this article · 6 sections
Claude's prompt cache stays alive for 5 minutes after the last request by default. If you stop to read a diff, answer a message or get a coffee and come back after six or eight minutes, the cache has expired. Your next turn then pays the cache write price for the whole conversation instead of the much cheaper read price. On a 210,000-token Claude Opus 5.5 session, that turns a $0.04 turn into a $1.05 one. The fix is to choose the 1-hour cache when the conversation starts, or to keep the 5-minute cache warm. Anthropic has explained which to pick and when.
Why a pause costs money
Every turn with Claude re-sends the whole conversation. With prompt caching, the part Claude has already processed is billed at the cheap cache-read price. Anthropic's docs give the rules:
- The default cache lives 5 minutes. Each hit restarts the timer at no extra cost.
- The timer runs from the start of the request, not the end of the answer. If a response takes 4 minutes to stream, you have about 1 minute to send the next request.
- A 1-hour cache is available with
"ttl": "1h", but writing to it costs more. - A miss on either cache bills the whole prefix at the write price.
Anthropic explained this to The New Stack in an article published on 5 December 2026. The company said the 5-minute default suits agents, which send requests seconds apart: "The 5-minute cache costs less to write, so it's usually the better value when requests come close together, as they often do when an agent is working." In Anthropic's own tests, the default cost about 19% less than the 1-hour cache on Sonnet 5.5 when turns arrived with no pauses, and 15% to 18% less on Opus 5.5.
A person in the loop doesn't send requests seconds apart, though. Requesty, a vendor that sells an AI gateway, looked at 30 days of coding-agent traffic through its service (24 October to 22 November 2026). It found that rebuilding caches after pauses of 5 to 30 minutes cost 15.2% of Claude spending, against 0.8% for GPT models, whose default cache lasts longer. These are a vendor's numbers about its own customers' traffic, and we haven't checked them ourselves.
What one break costs, by model
Prices from Anthropic's pricing page, checked 6 December 2026, per million tokens:
| Model | Input | 5-min write | 1-hour write | Cache read | Output |
|---|---|---|---|---|---|
| Claude Opus 5.5 | $4 | $5 | $8 | $0.20 | $20 |
| Claude Sonnet 5.5 | $2 | $2.50 | $4 | $0.10 | $10 |
| Claude Haiku 5.5 (prompts up to 100K) | $0.10 | $0.125 | $0.20 | $0.01 | $0.50 |
The Opus 5.5 input price is $4 per million tokens and the Sonnet 5.5 input price is $2 per million tokens. Here is what the input side of one turn costs with 210,000 tokens of context, the session size in Requesty's example (our arithmetic from the list prices):
| Model | Cache still warm (read) | After a 6-minute break (5-min write) | Same turn on a 1-hour cache |
|---|---|---|---|
| Opus 5.5 | $0.04 | $1.05 | $0.04 (read) |
| Sonnet 5.5 | $0.02 | $0.53 | $0.02 (read) |
So one coffee break on Opus 5.5 costs about $1 extra. The 1-hour cache isn't free either: every new part of the conversation is written at $8 instead of $5 per million tokens. Requesty found that putting every conversation on the 1-hour cache from turn 1 would have cost more for 87% to 89% of sessions, because every write is billed at 2x the input price instead of 1.25x. In its data, 76% of Claude coding conversations finished within five minutes.
Fix 1: pick the 1-hour cache at the start, when people pause
Anthropic's rule of thumb: use the 1-hour cache once about 1 turn in 20 follows a pause of between 5 minutes and an hour, and few pauses run over an hour. The break-even, by its count, is about 1 turn in 30 on Opus 5.5 and Sonnet 5.5. If most of your long pauses run past an hour, stay on 5 minutes, because both caches expire anyway.
Set it when the conversation starts. Switching a warm 5-minute cache to 1 hour partway through writes the whole prompt again. In Anthropic's test that cost $0.80 at 100,000 tokens on Opus 5.5. With automatic caching it's one field in the request:
{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"cache_control": { "type": "ephemeral", "ttl": "1h" },
"messages": [{ "role": "user", "content": "..." }]
}
Automatic caching isn't available on Amazon Bedrock's bedrock-runtime endpoint, which returns a 400 error for the top-level field.
Fix 2: keep the 5-minute cache warm
If only 1 or 2 turns in 20 follow a pause, and none lasts more than about half an hour, Anthropic says a 5-minute cache kept warm costs less than the 1-hour cache on Opus 5.5 and Sonnet 5.5: 8% to 13% less on Opus, 8% to 16% on Sonnet in its tests. The steps:
- Take the previous request, set
max_tokensto 0 and removestream. Don't change a byte of the prefix. - Send it with the same headers, including any
anthropic-betaheader. - Send it within 4 minutes of the previous request's start, then every 4 minutes until the next turn or the end of the session.
Each ping costs one cache read: about $0.04 on a 210,000-token Opus 5.5 conversation. The trick doesn't work with explicitly enabled thinking (thinking.type: "enabled"), structured outputs or a forced tool choice, which reject max_tokens: 0. For those, buy the 1-hour cache instead. Long pauses also undo it: at 45-minute pauses before every turn, keep-alive cost more than 50% more than the 1-hour cache in Anthropic's test.
Fix 3: in Claude Code, set the TTL yourself
Claude Code already uses the 1-hour cache for the main conversation, but only on a Claude subscription within the plan's included usage. On an API key, a cloud provider, or usage credits after you pass your plan limit, it uses 5 minutes. To change that (Claude Code v2.1.242 or later):
- set
"promptCacheTtl": "1h"in your settings, orCLAUDE_CODE_PROMPT_CACHE_TTL=1hin the environment; - leave subagents on 5 minutes unless they also wait on you (
subagentPromptCacheTtlcontrols them).
To confirm it worked, run claude -p "hello" --output-format json and look under usage.cache_creation: one-hour writes show as ephemeral_1h_input_tokens.
How to see if pauses are inflating your bill
Every API response reports cache_creation_input_tokens and cache_read_input_tokens. A turn that comes more than 5 minutes after the last one, with cache reads near zero and cache writes as big as the whole prompt, is a pause miss. Requesty suggests filtering your logs for exactly that pattern. In Claude Code, /usage shows a "Prompt cache (main)" line with the hit ratio and miss count (v2.1.251 or later).
Other things also break the cache and cost a full re-write, whatever the TTL: switching models, turning on fast mode, and adding an MCP server whose tools load up front. For the full price list and what typical setups cost a month, see our Claude pricing 2026 guide.