Claude prompt cache go save money from second use?
Cache write na 1.25x, read na 0.1x or less. See why Claude prefix fit break even on second use, calculate your own point, and verify am from the API.
Wetin prompt caching cost before e start save money
Prompt caching dey make Claude reuse the beginning of your prompt instead of reading am again for every call. The whole decision depend on two multipliers for your model base input price. As of October 2026, cache write cost na 1.25x of base input price for the 5 minute lifetime, or 2x for the 1 hour lifetime, for every model. Cache read cost na 0.1x for most models, but read multiplier no longer dey the same everywhere. E na 0.025x for Claude Fable 5.1 and Claude Mythos 5.1. Dem launch with that rate on September 1, 2026. E na 0.05x for Claude Opus 5.5 and Claude Sonnet 5.5. Sonnet 5.5 rate reduce from 0.1x go 0.05x on October 7, 2026. The worked figures below use the standard 0.1x read. The cheaper reads make break-even favor you small, and the next section show how much.
The trade-off na extra charge now against discount later. You pay extra once to store a prefix. Every later request wey start with exactly the same bytes go then pay one-tenth of the normal input price for that part, or less for the models wey dey above. If you no reuse a prefix inside its lifetime, you pay 25 percent extra for nothing.
Break-even, for one line of algebra
Make we call B the base input cost of the prefix if you send am without cache. Without caching, N requests go cost N times B. With the 5 minute cache, the first request write the prefix for 1.25B, while the other N minus 1 requests read am for 0.1B. Set the two sides equal and you get 0.9N = 1.15, so N = 1.28. The second request don already cheaper than no caching.
Do the same thing with the 2x write cost for the 1 hour cache and you get 0.9N = 1.9, so N = 2.11. The long cache need two reads before e reach break-even, na why e no be the default choice.
For cheaper reads, the line shift, but e no shift far. With 0.05x read, the 5 minute cache give 0.95N = 1.2, so N = 1.26. With 0.025x, e give 0.975N = 1.225, and N still be 1.26. The 1 hour cache drop to N = 2.05 and N = 2.03. The practical answer remain the same for every model: the 5 minute cache begin save money from the second request, while the 1 hour cache begin save money from the third.
The chart below calculate the cost for a 20,000 token prefix on Claude Opus 5. Its base input rate na $5 per million tokens as of October 2026, and e never change since August. Opus 5 don become legacy model now, although e still dey available. Its successor, Claude Opus 5.5, list $4 per million with 0.05x read, so the same prefix dey cost $0.10 to write and $0.004 to read. Multiply every figure by 0.6 for a $3 per million model with the standard 0.1x read. The curve shape no change.
Di data wey dey behind dis chart
[
{
"requests": 1,
"uncached_usd": "0.10",
"cached_5m_usd": "0.125",
"cached_1h_usd": "0.20"
},
{
"requests": 2,
"uncached_usd": "0.20",
"cached_5m_usd": "0.135",
"cached_1h_usd": "0.21"
},
{
"requests": 3,
"uncached_usd": "0.30",
"cached_5m_usd": "0.145",
"cached_1h_usd": "0.22"
},
{
"requests": 5,
"uncached_usd": "0.50",
"cached_5m_usd": "0.165",
"cached_1h_usd": "0.24"
},
{
"requests": 10,
"uncached_usd": "1.00",
"cached_5m_usd": "0.215",
"cached_1h_usd": "0.29"
},
{
"requests": 20,
"uncached_usd": "2.00",
"cached_5m_usd": "0.315",
"cached_1h_usd": "0.39"
}
]One request by itself cost $0.10 without cache and $0.125 with cache, so caching prompt wey you go use only once na pure loss. By the second request, the 5 minute cache cost $0.135, compared with $0.20. The 1 hour cache still dey more expensive at that point, $0.21 compared with the same $0.20, and e only become cheaper than the uncached option on the third request: $0.22 compared with $0.30. By 20 requests, the gap na $2.00 compared with $0.315.
Cache hit also refresh the entry. Na why the published price table call that column cache hits and refreshes. So, busy endpoint fit keep 5 minute entry alive forever at read prices, while the 1 hour lifetime only justify its 2x write cost when your traffic get real gaps.
Wetin poor hit rate dey cost
Real traffic fit miss. Request wey miss cache but still carry breakpoint, dem dey charge am as write. So, the correct way to model am na to calculate cost based on hit rate. The chart below show this for 1,000 requests, where each request carry the same 20,000 token prefix.
Di data wey dey behind dis chart
[
{
"hit_rate_percent": 0,
"cost_5m_usd": "125.00",
"cost_1h_usd": "200.00",
"uncached_usd": "100.00"
},
{
"hit_rate_percent": 25,
"cost_5m_usd": "96.25",
"cost_1h_usd": "152.50",
"uncached_usd": "100.00"
},
{
"hit_rate_percent": 50,
"cost_5m_usd": "67.50",
"cost_1h_usd": "105.00",
"uncached_usd": "100.00"
},
{
"hit_rate_percent": 75,
"cost_5m_usd": "38.75",
"cost_1h_usd": "57.50",
"uncached_usd": "100.00"
},
{
"hit_rate_percent": 90,
"cost_5m_usd": "21.50",
"cost_1h_usd": "29.00",
"uncached_usd": "100.00"
},
{
"hit_rate_percent": 95,
"cost_5m_usd": "15.75",
"cost_1h_usd": "19.50",
"uncached_usd": "100.00"
},
{
"hit_rate_percent": 99,
"cost_5m_usd": "11.15",
"cost_1h_usd": "11.90",
"uncached_usd": "100.00"
}
]For 0 percent hit rate, you go pay $125.00 instead of $100.00, and the 1 hour cache double the bill reach $200.00. Solve 1.25 minus 1.15h = 1, and the 5 minute cache start to save money when hit rate reach about 22 percent. Na why 25 percent already show $96.25. The same calculation for the 2x write give about 53 percent for the 1 hour cache. So, 50 percent hit rate still cost $105.00, wey pass the uncached line. For 90 percent, the two reach $21.50 and $29.00. For 99 percent, the short cache reach $11.15, close to the lowest cost of one tenth of the uncached price.
For model wey get 0.05x read, the thresholds drop to about 21 percent for the 5 minute cache and 51 percent for the 1 hour cache. For 0.025x read, dem drop to about 20 and 51 percent. The lowest cost dey drop as read price drop, reach one twentieth or one fortieth of the uncached cost.
Hit rate na the number you need instrument, because na the only input wey you fit control after prefix size don fixed.
Prefixes wey worth breakpoint
One request fit carry up to four cache breakpoints, so the question be which blocks deserve one. Candidates na blocks wey remain byte-identical across calls and big enough to matter. The chart below show price for four common shapes over 1,000 requests, with 90 percent hit rate for the 5 minute cache.
Di data wey dey behind dis chart
[
{
"label": "System prompt",
"prefix_size_tokens": "2,000",
"uncached_usd": "10.00",
"cached_usd": "2.15",
"saved_usd": "7.85"
},
{
"label": "System plus tools",
"prefix_size_tokens": "8,000",
"uncached_usd": "40.00",
"cached_usd": "8.60",
"saved_usd": "31.40"
},
{
"label": "Policy document",
"prefix_size_tokens": "25,000",
"uncached_usd": "125.00",
"cached_usd": "26.88",
"saved_usd": "98.12"
},
{
"label": "Codebase context",
"prefix_size_tokens": "120,000",
"uncached_usd": "600.00",
"cached_usd": "129.00",
"saved_usd": "471.00"
}
]A bare 2,000 token system prompt saves $7.85 for every 1,000 requests, compared with $10.00 without cache. This na real money at high volume, but na not wetin make caching interesting. Add the tool definitions and you don reach 8,000 tokens, with $31.40 saved. A 25,000 token policy document wey every request asks questions about saves $98.12. The last row na the one wey changes architecture: 120,000 tokens of codebase or transcript context costs $600.00 without cache and $129.00 with cache, so e saves $471.00.
Savings dey increase with prefix size and hit rate, and with nothing else. This changes wetin worth putting inside prompt at all: wetin one million Claude tokens really costs fit reduce to one-tenth of the listed price, or even less for models wey get cheaper reads, for anything wey you send more than once.
Wetin e go look like for monthly bill
The chart below dey use the 8,000 token prefix wey we mention above, plus system prompt and tool definitions, with 90 percent hit rate, then e scale am to monthly request volumes.
Di data wey dey behind dis chart
[
{
"label": "10k requests",
"uncached_usd": "400.00",
"cached_usd": "86.00",
"saved_usd": "314.00"
},
{
"label": "100k requests",
"uncached_usd": "4,000.00",
"cached_usd": "860.00",
"saved_usd": "3,140.00"
},
{
"label": "1M requests",
"uncached_usd": "40,000.00",
"cached_usd": "8,600.00",
"saved_usd": "31,400.00"
}
]For 10,000 requests every month, the saving na $314.00. Na the difference between $400.00 and $86.00. For 100,000 requests, e na $3,140.00. For one million requests, the uncached input bill na $40,000.00, and caching remove $31,400.00 from am. These ones na input tokens only. Output get separate pricing, and caching no affect am. Remember this before you promise anybody 90 percent bill reduction. Caching dey work together with the wider habits for keeping an AI agent bill under control for VPS.
How to confirm say cache dey work
No just trust the design. Read the usage block for the response. Every Messages API (application programming interface) reply dey report the cached tokens wey e write, the cached tokens wey e read, and the fresh tokens wey e need process.
from anthropic import Anthropic
client = Anthropic()
resp = client.messages.create(
model="claude-opus-5",
max_tokens=512,
system=[
{
"type": "text",
"text": POLICY_DOCUMENT,
"cache_control": {"type": "ephemeral"},
}
],
messages=[{"role": "user", "content": question}],
)
u = resp.usage
print("write:", u.cache_creation_input_tokens)
print("read: ", u.cache_read_input_tokens)
print("fresh:", u.input_tokens)Run am twice with the same document but different question. The first call go report non-zero cache_creation_input_tokens and zero cache_read_input_tokens. The second call go reverse this, because e find the prefix. input_tokens dey count only the tokens after the last breakpoint, so for healthy second call e go small, usually na just the new user message. Both calls dey incur charges, because Claude API no get free tier, although for the 20,000 token prefix price wey we show above, the two calls go cost about fourteen cents.
You fit do the same check from the shell against request body wey you save to request.json:
curl -s https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d @request.json | jq '.usage'Healthy second call go print something like this:
{
"input_tokens": 42,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 20143,
"output_tokens": 187
}One line go show you the truth. If cache_read_input_tokens remain 0 across calls, you dey pay the 1.25x write charge every time and you no dey get anything back for am.
For the 1 hour lifetime, the breakpoint get time to live (TTL):
{
"type": "text",
"text": "your stable prefix",
"cache_control": {"type": "ephemeral", "ttl": "1h"}
}Automatic caching dey available too: na one cache_control field for the top level of the request. After that, the API go manage breakpoints as the conversation dey grow. E go use one of your four breakpoint slots. Start with this option. Switch to explicit breakpoints when you need control over exactly where the boundary dey.
The ordering rule wey dey kill hit rates
Cache dey match prefix byte for byte from the beginning of the request, and dem dey assemble request for fixed order: tools, then system, then messages. If anything change for any level, e invalidate that level and everything after am. If you edit one tool description, system prompt and the whole message history go invalidate too, even though you no touch dem.
That give us one rule wey no get exception. Anything wey fit change between calls must come after everything wey no dey change.
Timestamp na the usual offender. A line wey read Current time: 2026-08-03T14:07:11Z for the top of system prompt go guarantee 0 percent hit rate, because prefix hash dey different for every call and no earlier entry fit ever match am. Move am enter user message, for the end. Session identifier or per-request nonce dey break things the same way, and the fix na the same. Retrieved documents wey different for each request belong after the cached block too. Otherwise, dem go push every stable token behind a boundary wey dey move.
The second offender na putting breakpoint on the block wey dey change. Cache writes happen for the breakpoint, so if that block different every time, nothing stable ever dey stored. The lookback go find only entries wey earlier requests write for their own moving breakpoints. Put cache_control on the last block wey content identical across requests.
The third one na parameter change wey you no see as prompt content. Different model get different cache. Changing tool_choice go invalidate message history, even though tools and system prompt remain cached. If you add or remove tool, e go invalidate everything.
The minimum prefix, and the silent no-op
Prefix wey shorter than the model minimum no dey cache, and nothing go tell you. No error, no warning. The request go succeed, and both counters go read 0. As of October 2026, the published minimums na:
- 512 tokens for Claude Opus 5 and Claude Fable 5, and for the newer Opus 5.5, Sonnet 5.5, Fable 5.1 and Haiku 5.5
- 1,024 tokens for Claude Sonnet 5 and Claude Opus 4.8
- 4,096 tokens for Claude Haiku 4.5
If both counters read 0 for request wey you believe say e dey cached, check the prefix length before anything else. Na this same reason make the cheapest model no automatically be the cheapest for caching workload. Haiku 4.5 need prefix wey long reach eight times the length wey Opus 5 need before caching go start at all, so a 2,000 token system prompt go cache for one, but the other one go silently ignore am. Na the same caution you need if you dey compare Claude with Amazon own models for Bedrock, because list price alone no go show you wetin your workload go really cost.
Where Claude Code dey cache for you, and where e no fit
Claude Code dey cache im own prefix. System prompt and tool definitions dey for front of every request and dem no dey move, so dem write once and read back for the rest of the session. Na why cost for each turn of long session dey far below wetin context size suggest, and e dey show for the counters wey how Claude Code dey report token usage describe.
Where e no fit help na when change happen near the beginning of context. Conversation history na append-only, so ordinary new turns dey extend prefix wey don already cache. If you edit file wey Claude Code read early for the session, e no break this, because Claude Code go append note say file don change instead of rewriting the earlier read. Wetin break am na switching models, because every model get im own cache. Connecting MCP server wey tools load into prefix go break am too, and compacting the conversation go do the same. Each one make the next turn write the prefix again. Long idle gap go do the same, because the entry expire and the next turn go pay for full write. None of these na bug. Na the prefix rule dey work exactly as e talk.
If na your own client you dey write instead, apply the layout from the first request; no try retrofit am later. Build the call the way a first Claude API app on a VPS dey do am, with stable blocks first and volatile ones last.
Failure modes, and wetin you go see
Every call na write. cache_creation_input_tokens no be zero for every request, while cache_read_input_tokens dey remain 0. Something for or before the breakpoint dey change between calls. Print the first 200 characters of the prefix wey you assemble for two requests one after another, then compare dem by eye.
Both counters na 0. The prefix dey below the model minimum, or the cache_control field no ever reach the API. Count the prefix tokens first, then log the request body wey you actually send.
Reads dey work, then dem stop. You get hits for some time, then one write, then hits again. The time between requests pass the lifetime. Accept the write, or move to the 1 hour TTL after you don check say your hit rate pass 53 percent, or about 51 percent for model wey get 0.05x or 0.025x read.
Hit rate drop after deploy. Person edit one tool description or change one model. Both things invalidate the whole prefix. Expect one expensive round of writes after every deploy wey touch the prompt.
The bill go up after you enable caching. Your hit rate dey below the break-even point. If e dey below about 22 percent for the 5 minute cache, sending the prefix without cache cheaper. The same thing apply below about 53 percent for the 1 hour cache. For the cheaper-read models, those limits dey about 20 to 21 percent and 51 percent.
FAQ
How many times you need reuse one prompt before caching go pay for itself?
Once, for the 5 minute cache. Write dey cost 1.25x base input, while read dey cost 0.1x for most models. So N uncached requests cost N, while N cached requests cost 1.25 plus 0.1 times N minus 1. The two costs meet for N = 1.28, so the second request don already cheaper. For models wey read dey cost 0.05x or 0.025x, the crossing point na N = 1.26, so the answer still be the same. The 1 hour cache writes at 2x and crosses at N = 2.11, or about 2.05 with the cheaper reads. So e need two reads.
Why cache_read_input_tokens always dey zero?
First check the prefix length. If e dey below the model minimum — 512 tokens for Claude Opus 5 and 4,096 for Claude Haiku 4.5 as of October 2026 — caching dey skip silently, and both counters go read 0. If the prefix long reach, check whether content wey dey change between calls dey at or before the breakpoint. Examples na timestamp or session identifier inside the system prompt. If the counters dey work before but stop later, the gap between requests don pass the cache lifetime.
Prompt caching dey change Claude answers?
No. The cache stores the processed form of tokens wey you don already send, and the model sees the same prompt either way. Na billing and latency feature, e no be behaviour change. This also mean say you fit enable am for prompt wey dey work without running your evaluations again.
I suppose pay for the 1 hour cache?
Only if your traffic get gaps wey pass 5 minutes and your hit rate go still reach roughly 53 percent, or about 51 percent for model wey get cheaper read. When cache miss happen, the 2x write cost four times the 1.25x write. A missed 1 hour write waste the full base input price of the prefix, while a missed 5 minute write waste only one quarter of am. A 5 minute entry dey refresh on every hit, so steady traffic keep am alive at read prices without ever paying for the longer lifetime.