Claude 5-Minute vs GPT 30-Minute Prompt Cache TTL: Why Code-Review Pauses Multiply Your API Bill
Verified: 2026-12-03 against Anthropic, OpenAI, and DeepSeek official prompt-caching documentation. Per-token dollar figures cited below are first-party vendor list prices, not byesu rates; on byesu, text models are billed pay-as-you-go using transparent multipliers (with cache reads down to
0.1x) and live rates shown in the console after sign-in.
Two engineers can run the exact same 10-turn refactor against two models that share an identical $2.00 / $10.00 per MTok official base rate card — claude-sonnet-5-5 and gpt-6.2-sol (≤272K input) — and finish with input bills that differ by more than 5×.
The culprit is not tokenizer bloat or hidden system instructions. It is human reading cadence colliding with cache time-to-live (TTL). Pause 6 to 10 minutes between turns to inspect a 400-line diff, run a local test suite, or debate an architecture plan, and a 5-minute sliding cache silently turns from a 90%+ discount into a recurring +25% write penalty on every single turn.
Executive summary
- Anthropic (
claude-opus-5-5,claude-sonnet-5-5,claude-fable-5-2): defaultcache_controlTTL is 5 minutes (sliding on each hit at zero extra write fee). Writing costs1.25xbase input (2.0xon optionalttl: "1h"); reads bill at0.05xon Opus/Sonnet 5.5 official list (0.025xon Fable 5.2) and down to0.1xmultiplier on byesu. Break-even: 1 hit within 5m on default ephemeral; 2+ hits within 60m on1hTTL. - OpenAI (
gpt-6.2-sol,gpt-6.1-sol): automatic prefix caching (≥1,024 tokens, 128-token steps) with a 30-minute standard retention window (plus optional 12h tier). Officialgpt-6.2-sollist (≤272K) is $2.00 input, $0.10 cached read (0.05x), and $2.50 30m cache write (1.25x). Survives 6–25 minute code-review pauses cleanly. - DeepSeek (
deepseek-v4-pro,deepseek-v4.1-flash): automatic prefix caching with zero write surcharge (1.0xon miss) and deep hit discounts — zero downside even when sessions go cold after a single call.
Side-by-Side Cache Mechanics Across Three Flagship Stacks
| Mechanism | Anthropic Claude 5.5 / Fable 5.2 | OpenAI GPT-6.2 / GPT-6.1 | DeepSeek V4 Pro / V4.1 Flash |
|---|---|---|---|
| Activation | Explicit cache_control: {"type": "ephemeral"} breakpoints | Automatic longest-prefix match (plus explicit retention tiers) | Automatic longest-prefix match |
| Minimum cacheable size | ~1,024+ tokens (model-dependent) | 1,024 tokens (128-token increments) | Automatic prefix blocks |
| Standard retention TTL | 5 minutes (refreshed free on each hit) | 30 minutes standard window | Dynamic server prefix pool |
| Extended TTL option | Optional ttl: "1h" (2.0x write cost) | Optional 12-hour retention tier | None needed (writes are free) |
| Write cost multiplier | 1.25x (5m) / 2.0x (1h) | 1.25x ($2.50/MTok vs $2.00 on gpt-6.2-sol ≤272K) | 1.0x (zero write surcharge) |
| Official read multiplier | 0.05x (Opus/Sonnet 5.5), 0.025x (Fable 5.2), 0.10x (Haiku 5.5); down to 0.1x on byesu | 0.05x ($0.10/MTok on gpt-6.2-sol ≤272K) | ~0.02x–0.033x ($0.044 on V4 Pro, $0.006 on V4.1 Flash peak) |
| Usage verification fields | cache_creation_input_tokens, cache_read_input_tokens | prompt_tokens_details.cached_tokens | prompt_cache_hit_tokens, prompt_cache_miss_tokens |
The Break-Even Math Most Teams Skip
Because Anthropic and current-generation OpenAI models charge a write surcharge when storing a prefix, prompt caching is not free insurance. Expressing a fixed prefix (for example, 100,000 tokens of system instructions, repo map, and MCP tool schemas) in base-input-token units (1.0x = one uncached call) reveals the exact crossover points:
Total Prefix Cost (units) = W + (H × R)
Uncached Baseline (units) = (1 + H) × 1.0where W (1.25x or 2.00x) is the initial cache write multiplier, H is the number of subsequent cache hits before TTL expiration, and R (0.05x to 0.10x) is the cache-read multiplier:
| Total Calls Within Single TTL Window | Hits (H) | Uncached Baseline | 5m Cache (1.25x write, 0.05x–0.10x read) | 1h Cache (2.0x write, 0.05x–0.10x read) | Engineering Verdict |
|---|---|---|---|---|---|
| 1 call (expires at min 6) | 0 | 1.00x | 1.25x (+25% loss) | 2.00x (+2× loss) | Net penalty — worse than never caching |
| 2 calls (1 reuse in window) | 1 | 2.00x | 1.30x–1.35x (−32.5% to −35%) | 2.05x–2.10x (+2.5% to +5% loss) | 5m breaks even on hit #1; 1h still loses |
| 3 calls (2 reuses in window) | 2 | 3.00x | 1.35x–1.45x (−51.7% to −55%) | 2.10x–2.20x (−26.7% to −30%) | 1h breaks even on hit #2 |
| 10 calls (9 reuses in window) | 9 | 10.00x | 1.70x–2.15x (−78.5% to −83%) | 2.45x–2.90x (−71% to −75.5%) | Massive compounding savings |
Two counter-intuitive rules fall straight out of that table:
- Expired writes punish slow cadences. Writing a 5-minute cache entry at
t = 0and sending the follow-up message att = 6m 30smeans you paid1.25xon turn 1 and1.25xagain on turn 2 (2.50xtotal vs2.00xuncached). - Never turn on
ttl: "1h"blindly for two-turn flows. At2.0xwrite cost, a single follow-up within the hour (2.05x–2.10x) still costs more than sending two uncached requests (2.00x). Only enable1hTTL when a workflow reliably fires at least 3 total calls (1 write + 2+ hits) per hour with gaps longer than 5 minutes.
Three Real Developer Cadences: 10 Turns Over an 80K Static Prefix
Watch what happens to a realistic 80K-token coding prefix across 10 turns under three everyday work patterns:
Cadence A: Autonomous Agent Loop (< 45s Between Tool Calls)
Tools like Claude Code and Cline execute Bash, grep, file reads, and test runs every 5–40 seconds. Because the gap never approaches 5 minutes, Anthropic's 5-minute sliding clock resets free on every step:
- Claude 5m ephemeral: 1 write + 9 hits →
1.70x–2.15xeffective cost instead of10.00x(>85%–95% of session input tokens are cache reads, as documented in our Claude Code token telemetry analysis). - GPT-6.2 30m cache: 1 write + 9 hits →
1.70xeffective cost. Both stacks perform at peak efficiency.
Cadence B: Interactive Diff Review & Plan Approval (8 Minutes Between Turns)
You ask the agent for a multi-file migration plan, spend 8 minutes reading the diff, verifying database constraints, and editing edge cases, then send the next instruction — repeating 10 times over 80 minutes:
- Claude default 5m ephemeral: every single turn misses because
8m > 5m. You pay10 × 1.25x =12.50x— 25% more than uncached and 5.8× to 7.3× more than Cadence A! - Claude
ttl: "1h": 1 write att = 0(2.0x), 7 hits throught = 56m, 1 re-write after the 1h mark (2.0x), and 1 hit →4.40x–4.80x(cuts the 5m bill by more than half). - GPT-6.2 Sol 30m standard cache: every 8-minute pause lands comfortably inside the 30-minute window, keeping the prefix alive across turns without paying
2.0xextended-tier writes!
Cadence C: Sporadic PR Bot / Support Webhook (45–90 Minutes Idle Gaps)
Requests arrive unpredictably once an hour:
- Both 5m and 30m caches expire between turns (
1.25xper call). - DeepSeek V4 (
deepseek-v4-pro,deepseek-v4.1-flash) charges1.0xon misses with zero write surcharge — if two webhooks happen to land 2 minutes apart you capture the cache-hit discount, and if they land 2 hours apart you pay zero penalty.
Four Engineering Rules to Stop Silent Cache Busts
1. Freeze Byte Order at the Front of Every Request
Both explicit breakpoints and automatic prefix matchers hash tokens from index 0 forward. Keep your prompt strictly layered:
- Static
systeminstructions (byte-identical string) - Deterministic
toolsarray (sort tool definitions by name; serialize JSON schemas without random dict-key shuffling) - Pinned repository summary / reference docs
- Append-only conversation history + all per-turn dynamic data at the very end
2. Ban Timestamps, UUIDs, and Live git status From the System Prompt
Injecting Current time: 2026-12-03T11:34:12Z or a changing git branch SHA into line 3 of the system prompt invalidates every token after line 3 on every call — forcing perpetual 1.25x cache writes with 0 cache reads. If the model needs the date, round it to YYYY-MM-DD (changes once per day) or append precise timestamps inside the final user message after the last cache_control breakpoint.
3. Match Model & TTL to Human Pause Distribution
import anthropic
client = anthropic.Anthropic(
base_url="https://byesu.com", # Anthropic-native; preserves cache_control
api_key="sk-YOUR_TOKEN",
)
# Use default 5m ephemeral for tight tool loops (<5m gaps);
# switch to {"type": "ephemeral", "ttl": "1h"} ONLY when pauses are 6–45m AND >=3 turns/hr.
cache_cfg = {"type": "ephemeral"}
resp = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=2048,
system=[
{
"type": "text",
"text": STATIC_REPO_ARCHITECTURE_AND_RULES,
"cache_control": cache_cfg,
}
],
messages=[{"role": "user", "content": dynamic_diff_review_prompt}],
)
print(
f"write={resp.usage.cache_creation_input_tokens} "
f"read={resp.usage.cache_read_input_tokens} "
f"uncached={resp.usage.input_tokens}"
)4. Alert When cache_read Stays Zero — and Check Your Gateway
Log (cache_read / total_input) per session. In healthy multi-turn agent sessions, cache reads should exceed 70% by turn 4. Beware of third-party proxies that normalize JSON payloads, strip cache_control, or prepend hidden routing prompts — doing so silently breaks prefix hashes. byesu passes cache_control blocks (https://byesu.com /v1/messages) and OpenAI/DeepSeek prefixes (https://byesu.com/v1) straight to official upstreams untouched, preserving 0.1x cache-read economics across Claude, GPT-6.2, and DeepSeek V4 on a single key.
Model your own monthly input/output and cache-hit ratios interactively with the LLM Token Cost Calculator, or review step-by-step setup examples in Prompt Caching, Explained.
FAQ
How many cache hits do you need to break even on Anthropic's 5-minute and 1-hour prompt cache?
On the 5-minute default tier (1.25x write), 1 cache hit within 5 minutes already beats uncached pricing by 32.5%–35%, whereas 0 hits loses 25%. On the 1-hour tier (2.0x write), 1 hit still loses 2.5%–5% versus uncached input, so you need at least 2 cache hits within 60 minutes to come out ahead.
Why does a 6-to-10-minute pause hurt Claude's default cache more than GPT-6.2?
Claude's default ephemeral cache expires after 5 minutes of inactivity, triggering a fresh 1.25x cache write on the next message. OpenAI's standard prefix cache on gpt-6.2-sol and gpt-6.1-sol holds entries for 30 minutes, absorbing typical 6–25 minute diff-reading pauses without re-writing the prefix.
Which LLM API has zero cache-write penalty for sporadic or idle sessions?
DeepSeek V4 (deepseek-v4-pro and deepseek-v4.1-flash) uses automatic prefix caching with zero write surcharge (1.0x on cache miss, steep discount on cache hit), eliminating write penalties on idle or single-turn workloads.
Does prompt caching work identically through the byesu API gateway?
Yes. https://byesu.com (Anthropic /v1/messages) and https://byesu.com/v1 (OpenAI-compatible) forward cache_control breakpoints and prefix tokens unchanged to official upstreams and return full cache usage counters in the response.