Claude's 5-minute cache timer quietly eats 23% of your coding bill
Claude's 5-minute timer is 23% of your coding bill

A 30-day analysis of coding-agent traffic across Claude Code, OpenCode, Codex, Pi, and Kilo found that 23.1% of Claude's total bill went to rebuilding prompt caches that expired during developer breaks, versus 9.3% on GPT models. Both labs charge identical per-token cache multipliers, so the gap comes entirely from default TTL: Claude expires caches after 5 minutes, GPT after 30. Breaks of 5 to 30 minutes cost Claude 15.2% of the bill and GPT just 0.8%.
On Claude, pauses between 5 and 10 minutes eat 8.0% of the entire coding bill. That single five-minute slice costs more than every break over an hour combined.
- Wowfunhappy
I find it really weird that Anthropic uses only a five minute cache on the API. Even in the course of active work, many commands—compiling, running tests, etc—take longer than five minutes to complete.
I of course don't know what it costs Anthropic to keep the cache warm—but since their subscription plans use one hour, Anthropic must have concluded a longer cache is more economical for most users. And there's a big difference between one hour and five minutes.
- Aurornis
On a subscription plan (not API requests) Claude Code defaults to 1-hour cache duration for the main conversation and 5 minutes for subagents.
So if you're not paying API rates, you need not worry. You can force the main conversation or subagents to either 5 minute or 1 hour in the Claude settings file if you would like.
If you are paying API rates, paying close attention to caching is important. 1 hour is best for sessions where you have to think a lot, examine output, or wait for long builds because 5 minute interruptions are very common. The price premium for 1-hour TTL isn't that high over 5-minute, so I use it by default.
It's also good to get in the habit of doing /compact when you know you might be AFK for more than the cache TTL. Doing the /compact on a long context conversation after the cache has expired is much more expensive.
- whatifitoldyou
Is there a pi plugin for resetting the keepalive? Sounds simple enough. From the article:
What is a keep-alive ping for prompt caching?
-
You send the last request again with max_tokens set to 0 about every 4.5 minutes. The API reads the cached prefix, returns no output tokens and restarts the cache timer. In our replay, keep-alive pings capped by session depth cut a Claude coding bill by about 8 to 9% net.
- compiler-guy
Everything old is new again. Something similar was a time honored technique for getting an OS scheduler to keep a long-running task at interactive priority by writing a character to the console every so often, so it looked like an interactive process.
How to defeat these countermeasures used to be covered in os courses. I suspect the llm vendors will adopt similar techniques.
https://algomaster.io/learn/operating-systems/multilevel-que...
- 8cvor6j844qw_d6
If I'm not mistaken, on subscription plans your main agent defaults to 1 hour cache with subagents spawned by the main session on 5 minute cache timer.
Best ensure your subagents avoid getting blocked if there's any wait or command that takes more than 5 minute.
- jueyi4
I prefer 1 hour because I think it is more effecient
- bensyverson
Isn't Claude Code on a 1hr cache?
- shllg
I wrote an article about claude subscription vs. API usage on that 5min ttl topic a couple of days ago: https://hillig.dev/blog/2026/11/one-hour-prompt-cache