Building with AI

Claude's 5-minute cache expiry drives higher coding costs than GPT

Production data shows Claude's short prompt cache TTL causes significant cost spikes during brief developer pauses, unlike GPT's longer window.

An hourglass illustrating time-based cost differences in AI caching
Illustration generated for this article

Analysis of thirty days of production traffic reveals that Anthropic’s default five-minute prompt cache expiration significantly increases costs for AI coding agents compared to OpenAI’s thirty-minute window. While both providers charge similar per-token rates, the difference in time-to-live settings creates a substantial financial gap during typical developer workflows.

What happened

Requesty analyzed billing data from October 24 to November 22, 2026, covering tools like Claude Code, OpenCode, and Codex. The study found that 23.1% of total Claude spending went toward rebuilding expired prompt caches while developers were briefly away. In contrast, only 9.3% of GPT spending faced similar cache misses. The disparity is most pronounced during breaks lasting between five and thirty minutes, where Claude loses 15.2% of its bill to cache rebuilds, while GPT loses just 0.8%.

The root cause is not different user behavior or tool efficiency, but the default time-to-live (TTL) settings. Claude Opus 5.5 and Sonnet 5.5 expire caches after five minutes of inactivity. GPT-6.1 Sol maintains its cache for at least thirty minutes. During a typical eight-minute coffee break, a Claude session often triggers a full cache rewrite, costing twenty-five times more than a warm cache read. GPT sessions remain warm during this same interval, avoiding the penalty entirely.

How it works

Prompt caching allows models to store the initial system prompt and conversation history, charging a lower rate for subsequent reads. When a cache is warm, reading the prefix costs 0.05x the standard input price. Writing new tokens to the cache costs 1.25x. Both Anthropic and OpenAI use these same multipliers. However, the cache has a timer. If no request arrives before the timer expires, the cache is evicted.

When a developer pauses to review code or take a break, the agent stops sending requests. On Claude, if this pause exceeds five minutes, the next request must rewrite the entire conversation history to the cache. This incurs the 1.25x write cost on all tokens, rather than the 0.05x read cost. On GPT, the thirty-minute window keeps the cache alive through most short breaks. The timer resets on every read, so active loops keep the cache warm on both platforms, but human-paced pauses expose the TTL difference.

Key details

  • Claude’s default cache TTL is five minutes, while GPT-6.1 Sol uses a thirty-minute minimum.
  • Breaks between five and ten minutes account for 8.0% of Claude’s total coding bill, more than all breaks over one hour combined.
  • On Claude Opus 5.5, a single eight-minute break on a 210,000-token session increases cost from $0.04 to $1.05.
  • GPT-6.1 Sol misses only 2.3% of breaks between five and thirty minutes, compared to 81.2% for Claude Sonnet 5.5.
  • Switching a warm five-minute Claude cache to a one-hour cache mid-session forces a full rewrite at 2.0x cost, negating savings.
  • For a team of twenty developers using Opus 5.5, short breaks can add approximately $1,380 per month in unnecessary cache write costs.

Why it matters

For engineering leads and technical founders, this data highlights a hidden variable in AI infrastructure costs. Many teams assume that per-token pricing is the primary driver of expense, overlooking the operational impact of cache management. The five-minute cliff means that normal human workflow patterns, such as reviewing a pull request or attending a stand-up, become expensive events on Claude. This inefficiency scales linearly with team size and session length, making long-running coding agents disproportionately costly.

Understanding these mechanics is crucial for budgeting and model selection. If a team’s workflow involves frequent short pauses, GPT’s longer TTL offers a structural cost advantage without requiring code changes. Conversely, teams committed to Claude must actively manage cache lifetimes or implement keep-alive strategies to mitigate the penalty. Ignoring the TTL difference can lead to bills that are 30% higher than necessary, even when base token prices are identical.

What you can do

  • Audit your current AI spend to identify the percentage of costs attributed to cache writes versus reads.
  • Implement adaptive keep-alive pings using max_tokens: 0 to maintain warm caches during short pauses, potentially saving 8% to 9%.
  • Avoid switching from five-minute to one-hour caching mid-session on Claude, as this triggers expensive full rewrites.
  • Consider enabling one-hour caching from the start of a session only if the expected session length justifies the higher 2.0x write cost.
  • Monitor pause durations in your agent logs to determine if your workflow aligns better with five-minute or thirty-minute cache windows.
  • Factor cache TTL into model selection criteria, especially for interactive coding tools where human latency is common.
  • #llm ops
  • #cost optimization
  • #prompt caching
  • #claude
  • #gpt

Tools from the Bytechap store

$89

DocBento

Self-hosted document management that reads every scan and answers with page citations.

Live demo

Keep reading

All stories