Claude 5-minute prompt cache vs GPT 30-minute cache: the cost of pauses
Claude's default 5-minute prompt cache TTL is causing developers to unnecessarily pay 23% more on their coding agent bills, a stark contrast to GPT's 30-minute cache. This detailed analysis reveals how short breaks disproportionately inflate costs, sparking Hacker News to dissect vendor pricing strategies and seek practical workarounds for expensive AI tool usage. The community is abuzz with strategies to avoid unexpected charges and debate whether this is a "footgun" or a reasonable default.
The Lowdown
A recent analysis by Requesty.ai uncovers a significant hidden cost in using Claude models for coding: its default 5-minute prompt cache Time-To-Live (TTL). This short expiry window leads to substantial overspending compared to GPT models, which typically offer a 30-minute cache.
- Cost Discrepancy: The study, based on 30 days of coding-agent traffic, found that 23.1% of the total Claude bill went to rebuilding expired prompt caches, versus only 9.3% for GPT models. Talk about paying for coffee breaks!
- Critical Window: The primary difference arises from breaks between 5 and 30 minutes, where Claude incurs 15.2% of its bill on cache rebuilds, while GPT incurs a mere 0.8%. Beyond 30 minutes, both caches are typically gone, and costs converge – because if you're gone that long, everyone forgets you.
- Caching Mechanics: Prompt caching reduces costs by allowing subsequent turns to read a cached prefix cheaply (0.05x price) rather than rewriting the entire growing context at a higher cost (1.25x). A cache expiry forces a full rewrite, dramatically increasing costs – like getting charged full price for a movie ticket every time you leave for popcorn.
- Developer Impact: A single 8-minute break on a 210,000-token Claude Opus 5.5 session can turn a $0.04 cache read into a $1.05 write. For a 20-person team using Opus 5.5, four short breaks a day can cost an extra ~$1,380 a month. That's a lot of premium coffee.
- Proposed Fixes: The article explores solutions, with "adaptive keep-alive pings" (sending
max_tokens: 0requests just before expiry) being the most effective, cutting 8-9% off Claude bills by refreshing the cache timer. Other methods, like blanket 1-hour caching, often prove more expensive due to higher write costs. - Recommendation: The author advises coding agent builders to implement keep-alives or cold-switch to a 1-hour cache after a miss, and model evaluators to test models across real workdays with human breaks.
The core takeaway is that prompt cache TTL is a critical, often overlooked, factor in LLM API costs, significantly impacting the true price of "per-token" billing and demanding attention in budgeting and agent design. Sometimes, a few minutes can cost you a fortune.
The Gossip
Cache Clarity: API vs. Subscription Snarls
Many commenters initially questioned the article's premise, pointing out that Claude Code (Anthropic's own product) actually defaults to a 1-hour cache for main agents, not 5 minutes. An Anthropic representative (edwinarbus) confirmed this, clarifying the article's findings primarily apply to API-billed traffic. However, the plot thickens: even with subscriptions, subagents often still use the 5-minute TTL, meaning complex agentic workflows aren't entirely off the hook for these unexpected costs.
Ping Poise and Proactive Palliatives
The discussion quickly turned to the proposed `max_tokens: 0` keep-alive ping strategy. Users inquired about existing implementations (like Pi plugins) and noted the technique's nostalgic similarity to old OS scheduling tricks used to keep tasks prioritized. A recurring question was whether providers would "allow" this workaround long-term, though consensus leans toward it being a paid cache read, not a true loophole. Other suggestions included using `/compact` or `autocompact` settings to manage context length and mitigate cache expiry impact.
Pricing Principles and Provider Predilections
A heated debate ignited around Anthropic's default 5-minute API cache. Some critics labeled it a "footgun" designed to covertly maximize revenue by inflating token consumption, questioning whether providers truly align with customer economic interests. Others sprang to Anthropic's defense, arguing that 5 minutes might be an optimal default for the diverse API use cases, and that defaulting to a more expensive 1-hour option would inevitably invite accusations of "gouging." The underlying tension highlights the struggle for transparency and fair billing in the opaque LLM economy.
Alternative Avenues and Local LLM Leniency
Commenters were quick to highlight alternatives with more generous caching policies or simply lower costs. DeepSeek emerged as a popular mention, lauded for its reported "days" of cache duration and significantly cheaper pricing. The enduring appeal of local models also got a shout-out; by running models locally, developers gain full control over caching (including persistence to disk), effectively sidestepping the entire remote API cost-control conundrum.