lowkeytools

Claude Code cache TTL: is the 5-minute or the 1-hour prompt cache cheaper for you?

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.

Model and prices (USD per 1M tokens)
Your working day sample data
Keep-alive pings

A break only counts when the gap between two requests is longer than the cache lifetime. Time the model spends streaming a reply counts toward the gap.

cache reads and output (same in every option) writing new tokens rebuilds after breaks keep-alive pings
One expired break on this context, 5-min cache
The same turn with the cache still warm
Share of the 5-min bill lost to breaks
1-hour cache pays off above
After a break of5-min cache1-hour cache5-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 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.

How the numbers are worked out

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.

Related 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, per the documentation). 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). 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.