Claude's 5-minute cache write costs 1.25x base price and breaks even after 1 hit; the 1-hour cache costs 2x and needs 2 hits. Here's the real math, per model, with code.
Manager, Architect Technology at Cognizant
Claude's prompt cache comes in two flavors: a 5-minute cache that's free by default, and a 1-hour cache you opt into. The 5-minute write costs 1.25x the base input price and pays for itself after a single cache hit. The 1-hour write costs 2x the base input price and needs two hits to break even. Reads are cheap either way, as low as 0.025x base price on some models. Pick the TTL based on how long the gap between requests actually is, not on which one sounds more generous.
Prompt caching lets Anthropic's API skip reprocessing the part of your prompt that hasn't changed since the last call: your system prompt, a long document, your tool definitions, the first ten turns of a conversation. Instead of paying full input price every time, you pay a write fee once and a much smaller read fee on every reuse.
It's controlled with a cache_control field. The simplest version needs one line:
response = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
cache_control={"type": "ephemeral"},
system="You are a helpful assistant that remembers our conversation.",
messages=[
{"role": "user", "content": "My name is Alex. I work on machine learning."},
{"role": "assistant", "content": "Nice to meet you, Alex! How can I help?"},
{"role": "user", "content": "What did I say I work on?"}
]
)
That's automatic caching: Anthropic picks the breakpoint for you and moves it forward as the conversation grows. For more control, you can place cache_control on individual blocks (system prompt, a specific document, your tool list) and get up to four explicit breakpoints per request, per Anthropic's docs.
One catch: there's a minimum size. Most current models (Sonnet 5.5, Opus 5.5, Haiku 5.5, Fable 5.2) need at least 512 tokens in a block before it's cacheable. Older Opus 4-series models need 1,024 or more. A 50-token system prompt just won't cache. No error, it just silently processes normally.
Here's the part people skip past and then get surprised by their bill. The two TTLs aren't the same multiplier with a longer clock attached: the write price actually changes.
| TTL | Cache write | Cache read | Break-even after |
|---|---|---|---|
| 5-minute (default) | 1.25x base input price | ~0.1x base input price | 1 read |
| 1-hour (opt-in) | 2x base input price | ~0.1x base input price | 2 reads |
That break-even math comes straight from Anthropic's pricing page: "5-minute duration (1.25x write): after one cache read. 1-hour duration (2x write): after two cache reads." Read tokens cost the same regardless of which TTL wrote them — the only thing that changes is how much you paid up front and how long the clock runs before you'd need to pay it again.
Put real numbers on it with Claude Sonnet 5.5, which prices base input at $2/MTok, 5-minute writes at $2.50/MTok, 1-hour writes at $4/MTok, and reads at $0.10/MTok (Sonnet 5.5 gets a better 0.05x read multiplier than most models):
Caching wins either way here. The 1-hour version costs more than the 5-minute version for the exact same call pattern — the only reason to pay that premium is that the 5-minute cache would have expired between calls and forced a second full write.
| Model | Base input | 5m write | 1h write | Cache hit |
|---|---|---|---|---|
| Claude Opus 5.5 | $4/MTok | $5/MTok | $8/MTok | $0.20/MTok |
| Claude Sonnet 5.5 | $2/MTok | $2.50/MTok | $4/MTok | $0.10/MTok |
| Claude Haiku 5.5 (≤100K tokens) | $0.10/MTok | $0.125/MTok | $0.20/MTok | $0.01/MTok |
| Claude Fable 5.2 | $8/MTok | $10/MTok | $16/MTok | $0.20/MTok |
Numbers pulled directly from the live pricing page. Fable 5.2 and Mythos 5.2 get a steeper 0.025x read discount, which is why their $0.20/MTok hit price looks cheap relative to an $8 base despite being the priciest model on the list.
Only when the gap between reuses regularly exceeds 5 minutes but stays under an hour. That's a narrower window than people assume. The clearest cases:
If your traffic is a tight back-and-forth chat where replies come in under 5 minutes apart, the default is already correct and the 1-hour TTL just adds cost for nothing. Vincent Schmalbach's write-up on this exact tradeoff lays out the same conclusion with slightly different math and lands in the same place: check your actual request gaps before switching, don't guess.
Boris Cherny, who works on Claude Code, put it bluntly on X: "1h prompt cache is nuanced actually. It costs more for cache writes, and less for cache reads. Whether you benefit from cheaper cache reads depends on your usage pattern." That's the whole article in one sentence, from someone who'd actually have the usage data to back it up.
# 1-hour cache instead of the 5-minute default
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
cache_control={"type": "ephemeral", "ttl": "1h"},
system="Your long, stable system prompt here",
messages=[{"role": "user", "content": "Your message"}]
)
const response = await client.messages.create({
model: "claude-opus-5-5",
max_tokens: 1024,
system: [
{
type: "text",
text: "You are an expert software engineer...",
cache_control: { type: "ephemeral", ttl: "1h" }
}
],
messages: [{ role: "user", content: "How do I implement binary search?" }]
});
console.log(response.usage);
// cache_creation_input_tokens, cache_read_input_tokens, input_tokens
curl https://api.anthropic.com/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2026-10-21" \
-d '{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"system": [{"type": "text", "text": "You are an AI assistant analyzing documents.", "cache_control": {"type": "ephemeral", "ttl": "1h"}}],
"messages": [{"role": "user", "content": "Summarize the attached contract."}]
}'
Worth noting: the 1-hour TTL used to require an anthropic-beta header when Anthropic first shipped it. It doesn't anymore: it's a plain field on cache_control now, no beta flag needed, confirmed by Alex Albert's GA announcement. If you copied a code sample from an older blog post with a beta header in it, you can delete that line.
You can also mix both TTLs in one request: put a 1-hour breakpoint on your massive, rarely-changing system prompt and a 5-minute breakpoint further down on faster-moving conversation turns. Anthropic bills each section separately by its own TTL, as long as the 1-hour blocks come before the 5-minute ones in the request.
A handful of things quietly blow up your whole cache and force a full rewrite, per the docs:
Tool choice changes and image swaps only invalidate the messages section, not system or tools, so those are cheaper mistakes to make. Still, if your cache hit rate suddenly craters, check this list before assuming the feature is broken.
This is where the conversation on Hacker News gets interesting. A thread discussing a Requesty.ai comparison of Claude's cache against GPT's cache pointed out that OpenAI defaults to a 30-minute cache window with no write fee at all: you just get a discount on reads, full stop. DeepSeek goes further, offering multi-day retention at a fraction of Claude's per-token rate, though with the usual quality caveat that comes with comparing a much cheaper model.
Anthropic's own Edwin showed up in that thread to add a detail that's easy to miss: Claude Code running on a Max or Pro subscription already defaults to the 1-hour cache, not 5 minutes. The 5-minute default and its tradeoffs mostly matter if you're calling the raw Messages API yourself.
One workaround from that same thread: some developers send an empty max_tokens: 0 ping every 4-5 minutes purely to refresh the 5-minute cache before it expires. Since a cache refresh bills at the cheap read rate, not the write rate, this keeps a hot cache alive indefinitely for the price of a trickle of read tokens, cheaper than letting it lapse and eating a fresh 1.25x write. It's a hack, and it adds a background process you now have to babysit, but it's a legitimate way to avoid the 1-hour TTL's steeper write cost entirely if your actual need is just "don't let this one die."
The 5-minute default is right for most people, most of the time, and Anthropic made a reasonable call setting it there. The 1-hour TTL is a tool for a specific shape of workload (long agent loops, async review steps), not a general upgrade you flip on because "longer sounds better." If you're not sure which bucket you're in, don't guess: run both for a day, check cache_creation_input_tokens and cache_read_input_tokens in the response, and let the actual numbers tell you. Guessing wrong costs real money at scale, and the fix is one field in a JSON body.
For teams running agents inside Claude Code specifically, this mostly isn't your problem: the 1-hour cache is already the default there. It's API builders calling the Messages API directly who need to think about this.
If you're also watching Anthropic's pricing and model lineup, Claude Opus 5.5's launch coverage and the Haiku 5.5 breakdown cover the base rates this whole caching discussion sits on top of. And if your actual pain point is overall API or Claude Code spend rather than caching specifically, our usage and cost guide is a better starting point.
New AI tools, automation workflows, and course drops — straight to your inbox. Join 2,400+ builders.
Claude Fable 5.2 costs $8/$40 per million tokens (20% less than 5.1), adds a 1M context window and 2.5x Fast Mode, while Mythos 5.2 stays locked to vetted security and bio teams.
GPT-6.1 Terra launched Oct 26, 2026 at $1/$5 per million tokens, scoring 50.3% on Terminal-Bench 4.0. Here's how it stacks up against Claude Sonnet 5.5 and Haiku 5.5.
Anthropic launched Claude Opus 5: near-Fable 5 performance at half the price, with a Fast Mode that runs 2.5x faster and improved coding benchmarks. Here's what changed, what it costs, and who should switch.
Comments