TEARDOWN Nº 7 / FIELD NOTES
Prompt cache TTL: 5 minutes, 30 minutes, 1 hour or 12 hours?
PUBLISHED · BY Llorenç Ballester — Chief Burn Officer
A cache write is a bet that the same prefix will come back before the cache expires. Providers now sell that bet in four sizes, and the longer ones cost more to write. So the question is how long your traffic actually goes quiet. We measured it on five months of Claude Code calls (91,133 of them) and re-priced the input side under each window.
Within one agent conversation, 95% of calls came less than five minutes after the previous one, and half came within 13 seconds. Only 2.0% of the gaps were longer than 30 minutes. On that traffic OpenAI's windows come out cheapest, and its new 12-hour option saves nothing over the default 30 minutes: what it saves on rewrites it pays back at 2.5x on everything new the agent writes. The 12-hour cache pays off for prefixes that come back hours apart, like an hourly job, where the default window costs more than not caching at all. A second team's logs, from another tool, show the same shape.
Four windows, two price ladders
Writes are priced as a multiple of the model's normal input price. Reads cost the same whichever window wrote them. What differs, besides the price, is what a read does to the clock.
| Provider | Window | Write | A cache hit… |
|---|---|---|---|
| Anthropic | 5 minutes | 1.25x | restarts the 5 minutes |
| OpenAI | 30 minutes | 1.25x | extends coverage to at least 30 minutes after the read |
| Anthropic | 1 hour | 2x | restarts the hour |
| OpenAI | 12 hours | 2.5x | does not restart the 12-hour clock |
From each provider's prompt caching documentation, read on 2026-10-27. OpenAI's windows apply from GPT-5.6 onward; the 12-hour one is set with prompt_cache_options.ttl in the Responses API and can be mixed with 30-minute breakpoints in the same request. Both call these minimum lifetimes: an entry may live longer, but only the minimum is promised.
The interesting asymmetry is at the bottom of each ladder. For the same 1.25x, OpenAI's default write lives 30 minutes and Anthropic's lives five.
How long an agent goes quiet
We took every call in five months of the author's Claude Code logs, grouped them by conversation (a subagent counts as its own, since it sends a different prefix) and measured the time between each call and the one before it.
Share of gaps between consecutive calls in the same conversation. Median gap 13 seconds, 90th percentile 1.7 minutes, 95th 4.6 minutes.
Most of the traffic is the agent talking to itself: call a tool, read the result, call the model again, a few seconds apart. Those calls keep any cache warm. The gaps that matter are the human ones, when you read a diff, go to a meeting or stop for lunch. They are rare, but each one lands on a conversation that may be carrying hundreds of thousands of tokens.
The same five months under each window
We replayed every conversation under each window. While the cache is alive, the part already cached is read and what the turn adds is written. After a gap longer than the window, the whole prefix is written again. Only the multipliers change between rows, so this compares the windows and leaves the models out of it. Sending everything uncached is 100.
| Window | Reads | New tokens | Full rewrites | Input index |
|---|---|---|---|---|
| Anthropic 5 minutes | 9.4 | 0.7 | 6.5 | 16.7 |
| Anthropic 1 hour | 9.8 | 1.1 | 3.6 | 14.5 |
| OpenAI 30 minutes | 9.7 | 0.7 | 2.8 | 13.2 |
| OpenAI 12 hours | 9.9 | 1.4 | 1.9 | 13.2 |
Reads at 0.1x input. "Full rewrites" includes the first call of every conversation, which no window can avoid. At the 0.05x read rate of GPT-6.1 Sol and Terra (and Opus 5.5 and Sonnet 5.5 on Claude) the picture holds: 11.9, 9.6, 8.3 and 8.3, in the same order as the table.
Three readings. First, the 1-hour window was the right default for Claude Code, which used it for 94% of its cache writes in these logs. It came out 13% cheaper than five minutes. Rewriting long conversations after short breaks cost more (6.5 against 3.6) than everything the hour charged extra on new tokens (1.1 against 0.7). Second, OpenAI's default terms fit this traffic better than either Anthropic option: the 1.25x write covers 98% of the gaps, so it gets most of the 1-hour benefit at the 5-minute price. Third, the 12-hour window lands at 13.2, level with the default. It trims rewrites from 2.8 to 1.9, but every new token an agent turn adds is now written at 2.5x, and that eats the saving.
Keep the scale in mind. These are differences of a few points on the input side. Picking a model at half the input price moves the bill far more than picking a window. The window is worth getting right because it is a one-line setting.
A second dataset, same shape
One developer's logs could be a habit. So we ran the same replay on the dataset from teardown #5: a different team, a different tool (opencode), 18,787 calls in 196 conversations between 2026-04-07 and 2026-08-29.
| Claude Code (this page) | opencode (teardown #5) | |
|---|---|---|
| Calls within 5 min of the last | 95% | 97% |
| Gaps over 30 min | 2.0% | 0.8% |
| Gaps over 12 h | 0.5% | 0.1% |
| Input index, Anthropic 5 minutes | 16.7 | 15.2 |
| Input index, Anthropic 1 hour | 14.5 | 13.7 |
| Input index, OpenAI 30 minutes | 13.2 | 12.5 |
| Input index, OpenAI 12 hours | 13.2 | 13.3 |
Same rules, same replay, read with npx tokenburnindex audit --source opencode. Input index with reads at 0.1x, no cache = 100.
The shape holds. This team's agent went quiet even less: only 0.8% of its gaps passed 30 minutes. The 1-hour window beats the 5-minute one again (13.7 against 15.2), and OpenAI's default is the cheapest of the four. Here the 12-hour window costs more than the default (13.3 against 12.5): with so few long gaps there are hardly any rewrites left to save, and every new token still pays 2.5x. Two datasets are still two anecdotes, but they point the same way.
When the long window pays
Take a prefix that keeps coming back, every time after the short window has expired. With the short window you write it again on each return. With the long one you write it once and read it afterwards.
- Claude, 1 hour against 5 minutes: the hour wins from the first return. One 2x write plus a 0.1x read is 2.1x, against 2.5x for two 1.25x writes. Anthropic's own advice matches: use the hour for prompts that come back less often than every five minutes.
- OpenAI, 12 hours against 30 minutes: it takes two returns. After one it is 2.6x against 2.5x, so a prefix that comes back exactly once is cheaper on the default. After two it is 2.7x against 3.75x.
- A window that always expires is worse than no cache. If your requests arrive further apart than the window, every one pays a 1.25x write and never a read. That is 25% more than sending the prompt uncached, and it is the default behaviour.
The case it was built for: an hourly job
A scheduled job sends the same 50K-token prefix (instructions plus reference material) once an hour, 12 times a day, to GPT-6.1 Sol. Prefix cost per day at today's board prices:
Left on the default, the cache makes this job 25% more expensive than not caching. With the 12-hour window it costs 25% of the uncached price. On Claude the same job sits right on the edge of the 1-hour window: a run that starts a little late finds the cache gone and pays a 2x rewrite.
Every long-window rate on the board
| Model | Input | Default write | Long write | Cache read |
|---|---|---|---|---|
| Claude Fable 5 | $10 | $12.50 (5 min) | $20 (1 h) | $1 |
| Claude Fable 5.1 | $10 | $12.50 (5 min) | $20 (1 h) | $0.25 |
| Claude Opus 5 | $5 | $6.25 (5 min) | $10 (1 h) | $0.50 |
| Claude Opus 4.8 | $5 | $6.25 (5 min) | $10 (1 h) | $0.50 |
| Claude Opus 5.5 | $4 | $5 (5 min) | $8 (1 h) | $0.20 |
| Claude Sonnet 5.5 | $2 | $2.50 (5 min) | $4 (1 h) | $0.10 |
| Claude Sonnet 5 | $2 | $2.50 (5 min) | $4 (1 h) | $0.20 |
| Claude Haiku 4.5 | $1 | $1.25 (5 min) | $2 (1 h) | $0.10 |
| Claude Haiku 5.5 | $0.10 | $0.125 (5 min) | $0.20 (1 h) | $0.01 |
| GPT-5.6 Cyber | $12.50 | $15.625 (30 min) | $31.25 (12 h) | $1.25 |
| GPT-6 Astra | $10 | $12.50 (30 min) | $25 (12 h) | $1 |
| GPT-5.6 | $4 | $5 (30 min) | $10 (12 h) | $0.40 |
| GPT-5.6 Terra | $2 | $2.50 (30 min) | $5 (12 h) | $0.20 |
| GPT-6.1 Sol | $2 | $2.50 (30 min) | $5 (12 h) | $0.10 |
| GPT-6 Sol | $2 | $2.50 (30 min) | $5 (12 h) | $0.20 |
| GPT-6.1 Terra | $1 | $1.25 (30 min) | $2.50 (12 h) | $0.05 |
| GPT-5.6 Luna | $0.20 | $0.25 (30 min) | $0.50 (12 h) | $0.02 |
| GPT-6 Luna | $0.10 | $0.125 (30 min) | $0.25 (12 h) | $0.01 |
Per million tokens, from the board, recomputed on every deploy. Google and the open-weight providers on the board publish no separate write rate, so they have no window to choose. Background on how caching is billed: prompt caching, explained.
Method and limits
Each dataset is n=1. The main one is one developer's Claude Code logs from 2026-05-18 to 2026-10-19, the same period as teardown #6, 1,090 conversations, calls deduplicated the way our CLI does it. The second is one team's opencode database. Both are people working with a coding agent at a desk. A team that runs agents unattended, or a product with steady user traffic, will have a different shape. Only proportions are published.
The replay assumes an ideal cache: no minimum length, no prefix broken by a compaction, no request routed to a machine that doesn't hold the entry. Real bills have all three. It also applies Claude Code's traffic to OpenAI's rules, which is a what-if: Codex might call the model at a different rhythm. And it only follows the prefix within one conversation. The 12-hour window is also pitched at material shared across conversations during the day, which we did not measure. The replay applies nothing beyond the rules in the first table and the gaps above, and npx tokenburnindex audit (from version 0.5.0) runs the same replay on your own Claude Code, Codex or opencode logs. It reads the time of each call to measure the gaps and prints only the counts, never a time or a date.
Corrected 2026-10-27, the day of publication. The first version counted about 275 log entries that Claude Code writes without calling the API (zero tokens) as calls. Each one added a cache read and made the next call rewrite the whole context, which hurt the 12-hour window most: it showed 13.5 instead of 13.2, and the other windows moved by 0.1. We caught it when the replay built into our CLI did not match this page. The conclusions stand, except that the 12-hour window now ties with the default instead of trailing it.
Frequently asked questions
What is OpenAI's 12-hour prompt cache?
From GPT-5.6 onward, OpenAI lets you choose how long a cache write lives. The default is 30 minutes at 1.25x the input price. In the Responses API you can ask for a 12-hour minimum lifetime instead, written at 2.5x input. Reads cost the same under both: 0.1x input on most models and 0.05x on GPT-6.1 Sol and Terra.
Does reading the cache reset the TTL?
On Anthropic, yes: each hit restarts the 5-minute or 1-hour window. On OpenAI, a read extends coverage to at least 30 minutes after that read, but it does not restart the 12-hour clock. Both providers document this in their prompt caching guides.
When is the 12-hour cache worth it?
When the same prefix comes back more than 30 minutes apart, at least twice. One write at 2.5x plus two reads costs 2.7x the input price, against 3.75x for rewriting it at 1.25x three times and 3x for not caching. For a chat or a coding agent that calls the model every few seconds, the default 30 minutes already covers almost every gap.
Should I use the 1-hour cache on Claude?
If your prefix comes back after more than 5 minutes but within the hour, yes. It wins from the first such return: 2x plus a read is about 2.1x the input price, against 2.5x for two 5-minute writes. On the agent traffic we measured, the 1-hour window came out 13% cheaper on the input side than the 5-minute one.
- AI Tokenomics: what tokens actually cost
- How much does ChatGPT actually cost per prompt?
- Prompt caching: the 90% discount most teams never claim
- Why your AI agent costs 10–40x more than a chat
- Why output tokens cost more than input
- Cut AI costs with model routing
- The cache minimum: why your prompt cache silently does nothing
- What a Cursor session costs, by model
- Where a Claude Code bill actually goes
- Four months of a coding agent, measured
- The tokenizer tax: a price rise with no price change
- The Sonnet 5 price cliff that never happened
- How to read your AI usage export
- → The Burnmeter: measure your own token waste