Every pause longer than the cache lifetime makes the next turn rebuild the whole context at the write price. Enter how you work and see what breaks cost per month under each option, and how many breaks a day it takes before the 1-hour cache pays for itself.
| After a break of | 5-min cache | 1-hour cache | 5-min + pings |
|---|
The 5-minute cache is cheaper while you work without pausing, because every new token is written at 1.25× the input price instead of 2×. The 1-hour cache is cheaper once you regularly step away for more than five minutes with a large context open, because each of those pauses otherwise re-bills the entire context at the write price.
With an API key or a cloud provider, Claude Code uses the 5-minute cache unless you change it. On a subscription within the plan's included usage, the main conversation already gets one hour, and subagents get five minutes. This is from the Claude Code prompt caching documentation as read on 2 December 2026.
One vendor study of coding-agent traffic (Requesty, 1 December 2026) put the cost of rebuilding after breaks at about 23% of Claude coding bills. That figure is theirs and has not been checked here. Use your own numbers above.
Each request reads the existing context at the cache-read price and writes its new tokens at the write price for the chosen lifetime. A request that arrives after the cache expired writes the whole context instead of reading it. A keep-alive ping is billed as one cache read of the whole context. Output tokens are the same in every option.
The provider still holds the processed copy of your conversation, so the next request is billed at the cheap read price. Once the lifetime passes with no request, the cache has expired and the next turn is slower and costs the write price for the full context.
Set promptCacheTtl to 1h in settings, or the environment variable CLAUDE_CODE_PROMPT_CACHE_TTL=1h (v2.1.242 or later, per the documentation). Subagents have a separate setting, subagentPromptCacheTtl. On the API, add "ttl": "1h" to the cache_control block.
It can. A ping every few minutes costs one cache read of the context and resets the timer, which is far less than a rebuild, as long as you come back. Pings during a break you never return from are wasted, so cap them. Users report this technique; whether your tool or plan allows it is for you to check.
In Claude Code, /usage shows a prompt cache line with the hit ratio and misses (v2.1.251 or later, per the documentation). On the API, compare cache_read_input_tokens with cache_creation_input_tokens in each response.
Model prices and cache multipliers are from Anthropic's published prompt caching pricing table as read on 2 December 2026. Prices change; check the current table before relying on a result. Workload defaults are placeholder sample data.
Independent tool. Not affiliated with or endorsed by Anthropic.