Claude Code prompt cache TTL calculator
Is the 5-minute or the 1-hour prompt cache cheaper for the way you work? Every pause longer than the cache lifetime makes the next turn rebuild the whole context at the write price. Enter your working day to 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 short answer
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 [2].
One vendor study of coding-agent traffic [4] 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.
How it works
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, and pinging is treated as keeping the cache alive until five minutes after the stop time you set. Output tokens are the same in every option.
Prices and multipliers are pre-filled from the published pricing table [1]; every one of them can be edited. The working-day figures are sample data, not measurements.
Questions
What does "prompt cache warm" mean?
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.
How do I enable the 1-hour cache in Claude Code?
Set promptCacheTtl to 1h in settings, or the environment variable CLAUDE_CODE_PROMPT_CACHE_TTL=1h (v2.1.242 or later [2]). Subagents have a separate setting, subagentPromptCacheTtl. On the API, add "ttl": "1h" to the cache_control block.
Does a cache warmer or keep-alive save money?
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.
How do I see my cache hit rate?
In Claude Code, /usage shows a prompt cache line with the hit ratio and misses (v2.1.251 or later, per the documentation [3]). On the API, compare cache_read_input_tokens with cache_creation_input_tokens in each response.
Sources
- Anthropic, "Prompt caching", Claude API documentation. platform.claude.com/docs/en/build-with-claude/prompt-caching. Read . Used for model prices, the 5-minute and 1-hour write multipliers, the cache read multipliers and the
ttlfield. - Anthropic, "Prompt caching", Claude Code documentation. code.claude.com/docs/en/prompt-caching. Read . Used for the default cache lifetimes, the setting and environment variable names and the minimum version.
- Anthropic, Claude Code documentation, costs page. code.claude.com/docs/en/costs. Read . Used for the prompt cache line shown by
/usage. - Requesty, "Claude's 5-minute timer is 23% of your coding bill". Published 1 December 2026, read . Vendor-reported figure from its own traffic. It is quoted for context only, is not used in any calculation and has not been checked here, so it is not linked.
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.