Skip to navigation

Claude Code Prompt Caching: Write Multipliers, TTLs and Real Savings

In short: Claude cache writes cost 1.25x for five minutes or 2x for one hour; reads cost 0.1x. The break-even point depends on prefix reuse.

Published 17 min read
On this page

Direct answer

Claude prompt caching saves money only when an eligible, identical prefix is reused enough to repay the write multiplier. Official: five-minute cache writes cost 1.25 times base input price, one-hour writes cost 2 times, and cache reads cost 0.1 times, with model-specific exceptions. The default TTL is five minutes, and extended TTL is one hour.

Under those standard multipliers, a cacheable prefix breaks even on total input-prefix cost after two uses with the five-minute TTL or three uses with the one-hour TTL. That calculation assumes the prefix stays identical, remains within the TTL, meets the model’s minimum size, and has no exception.

Do not assume every Claude Code prompt is cacheable. Cache hits require 100 percent identical prompt segments, and minimum cacheable sizes vary by model family. Put stable instructions and repository context early, changing task material later, then measure fresh, write, and read tokens separately.

The concrete win is cheaper repeated input when reuse is real. The honest loss is the write premium and the possibility of a miss after a prefix change or expired TTL. Caching is a pricing mechanism, not a guarantee of faster responses.

Official rates

The published multipliers apply to input-token pricing. Track generated output in a separate column because an input cache rate does not make output free or discounted.

Cache event Standard multiplier Meaning for the worksheet
Five-minute cache write 1.25 × base input price Initial reuse premium for the cached segment
One-hour cache write 2 × base input price Larger premium for a longer lifetime
Cache read 0.1 × base input price Discounted processing of an identical cached segment
Fresh input outside cache 1 × base input price Uncached input processing

Model-specific exceptions exist. Use the selected model’s official pricing and caching documentation before turning these multipliers into a dollar estimate. The prompt-caching documentation is the authority for rates, TTLs, minimums, and identity requirements.

A cache write is not a free reservation. The longer TTL can be useful when reuse is likely, but its higher write price needs more later reads to repay. A short TTL can be the better economic choice when requests are close together and idle gaps are unpredictable.

Decision Five-minute TTL One-hour TTL
Write multiplier 1.25 2
Standard break-even total uses 2 3
Best fit Dense reuse with short gaps Reuse spread across a longer window
Main risk Expiry before the next request Paying a higher write premium without enough reads

The cost documentation describes /usage for session metrics and plan bars. Use the available view to understand consumption, but do not assume every surface exposes the cache categories needed for a precise calculation.

TTL choices

TTL means time to live. It is the lifetime of the cached entry, not a promise that every session will retain a hit for that long. The default is five minutes, and the extended TTL is one hour.

Choose the TTL from observed request cadence. A burst of related requests may suit the five-minute option. A workflow that revisits the same stable prefix across a longer working period may justify the one-hour write, provided the prefix remains identical and enough reads occur.

Idle time is only one reason a later request can miss. A changed prefix can also break identity. The idle-session cache-miss analysis covers the time dimension, while the identity rule below covers content changes.

Do not claim every idle resume misses. Official: an idle session can miss if the TTL expires or the prefix changes. Measure cache state, prefix identity, and fresh-input tokens before assigning a cause.

The compaction cost worksheet is relevant when the prefix changes because older turns become a summary. Compaction can reduce context while creating a new sequence that needs fresh processing or a new write. Caching economics and compaction economics should be measured together, not added as independent assumptions.

Claude Code Prompt Caching evidence map comparing five-minute writes, one-hour writes, cache reads and the identical-prefix requirement
Claude Code Prompt Caching evidence map. Anthropic publishes the standard write and read multipliers, TTLs, and identity rule; model-specific exceptions and minimum sizes prevent a universal savings claim.

Identical prefix rule

Official: cache hits require 100 percent identical prompt segments. A cache is not a fuzzy similarity store. Changing one early token can affect the sequence that follows, depending on where the change occurs.

Put stable material first when the prompt format allows it. System instructions, durable repository guidance, and other repeated context are better candidates for the early prefix than timestamps, random identifiers, or rapidly changing task state.

Place changing material later. A new user question or current file diff can vary without forcing the stable beginning to change. This is prefix-design guidance, not a claim that every client exposes manual cache breakpoints or that every Claude Code request uses the same layout.

A prefix can also change outside the visible prompt. Tool results, retrieved context, and session transformations may alter the sequence. If the interface does not expose the exact cache boundary, mark it unknown and use observed cache tokens rather than guessing from prompt length.

The large-codebase guidance supports scoped discovery and repository guidance. Those practices can stabilize what an agent repeatedly reads, but the frozen record contains no controlled Claude Code token-reduction percentage.

The context-retention test for compaction belongs beside prefix design. A stable prefix that omits a critical constraint can produce cheap, repeated mistakes. Verify usefulness as well as identity.

Minimum checkpoint sizes

A prompt segment must meet the model family’s minimum cacheable size. Short prefixes are not automatically cacheable just because they repeat.

Model family in the frozen source Minimum cacheable prompt size
Current Fable/Mythos 5.x, Opus 5.5/5, Sonnet 5.5, Haiku 5.5 512 tokens
Several older models 1,024 tokens
Mythos Preview and Opus 4.7 2,048 tokens
Opus 4.6/4.5 and Haiku 4.5 4,096 tokens

These are model-family minimums from the supplied source, not a recommendation to pad a prompt. Check the current model documentation before relying on a row, because model-specific exceptions and lifecycle changes can alter eligibility.

Minimum size also changes the break-even interpretation. A short stable prefix may save nothing because it cannot be cached. A large stable prefix may offer more absolute savings, but only if the workload reuses it and the write premium is repaid.

The model lifecycle documentation is the official place to check model status over time. A caching worksheet should record the model and the date of the pricing source instead of assuming an old row remains current.

Claude Code Prompt Caching workflow from stable prefix design through cache write, TTL window, identical cache read and fresh-input fallback
Claude Code Prompt Caching workflow. Official rules define write pricing, TTLs, minimums, and identical hits; the workflow does not assert that every idle or changed prefix misses.

Break-even math

Break-even asks how many uses of the same cacheable prefix repay the write premium. Let k be total uses, including the initial write. Let B be the prefix’s uncached input cost at the base rate.

Without caching, total prefix input cost is k × B.

With five-minute caching, the first use is a write and the remaining uses are reads:

Cached cost = 1.25B + (k − 1) × 0.1B

Savings are positive when:

k × B > 1.25B + (k − 1) × 0.1B

Simplifying gives 0.9k > 1.15, so k > 1.277.... Since uses are whole events, at least two total uses break even under the standard assumptions.

With one-hour caching:

Cached cost = 2B + (k − 1) × 0.1B

Savings require 0.9k > 1.9, so k > 2.111.... At least three total uses are needed.

Total prefix uses k No cache Five-minute cache One-hour cache
1 1.00B 1.25B 2.00B
2 2.00B 1.35B 2.10B
3 3.00B 1.45B 2.20B
5 5.00B 1.65B 2.40B

Derived: the table measures only the repeated prefix. It excludes fresh task input, output, tool results, retries, and model-specific exceptions. A cache can reduce prefix cost while the total request becomes more expensive because another component grew.

The formula also assumes every later use is a hit inside the TTL. If a use misses and triggers another write, recalculate with the observed sequence instead of using the simple table.

Worked example: price the prefix, not the whole chat

Suppose an eligible stable prefix has an uncached input cost of B = $0.02 per use. That price is an invented input for arithmetic, not a quoted Claude model price. Assume the prefix stays identical and all reuse happens inside the selected TTL.

For two total uses, no caching costs 2 × $0.02 = $0.04. Five-minute caching costs $0.02 × 1.25 + $0.02 × 0.1 = $0.025 + $0.002 = $0.027. The saving is $0.013. One-hour caching costs $0.04 + $0.002 = $0.042, so it costs $0.002 more than no caching over that short window.

For five total uses, no caching costs $0.10. Five-minute caching costs $0.025 + 4 × $0.002 = $0.033, saving $0.067. One-hour caching costs $0.04 + 4 × $0.002 = $0.048, saving $0.052.

Uses No-cache prefix cost Five-minute cost Five-minute saving One-hour cost One-hour saving
2 $0.040 $0.027 $0.013 $0.042 −$0.002
3 $0.060 $0.029 $0.031 $0.044 $0.016
5 $0.100 $0.033 $0.067 $0.048 $0.052

The negative saving in the two-use one-hour row means a loss, not a typo. It shows why a longer TTL is not automatically the cheaper choice.

Now add a changing task question after the stable prefix. Its fresh-input and output costs belong outside B. If that changing portion doubles, a cache win on the prefix may not offset the total increase. Compare complete request cost and verified work, not only the cached segment.

The cost per verified change framework is the right final measure. A cheaper repeated prompt that causes rework is not an economic win.

Claude Code Prompt Caching tradeoffs showing two-use and five-use break-even comparisons for five-minute and one-hour writes
Claude Code Prompt Caching tradeoffs. Multipliers come from Anthropic; the dollar prefix price and use counts are invented arithmetic inputs, not a benchmark or quoted model rate.

A cache checklist

Audit the prompt before calculating savings. The checklist separates eligibility, identity, reuse, and measurement.

Check Pass condition Failure effect
Model eligibility The selected model supports the expected cache behavior Multipliers may not apply
Minimum size Prefix meets the model-family minimum Segment may not be cacheable
Stable prefix Repeated instructions and context stay identical Hits can be lost
Dynamic content Changing task material sits later where possible Early changes can disrupt reuse
TTL fit Observed reuse occurs within the chosen lifetime Entries can expire
Reuse count Enough uses repay the write multiplier Cache can cost more
Usage visibility Fresh, write, and read tokens can be observed Savings remain an estimate
Output separation Output pricing is modeled independently Total cost can be understated

The per-key controls reference is useful for gateway-side key policy, but it does not establish Claude Code cache behavior. Separate provider caching and gateway key controls.

Use the proof-of-work packet to pair cost with correctness. A cache hit should not be treated as proof that the returned answer is current or complete.

The MCP output truncation guide helps when tool output changes the prefix. Preserve the decisive error in a compact, stable structure instead of allowing large variable logs to dominate every request.

Measurement

Measure cache state across a fixed task. Record the model, prompt version, timestamp, TTL, fresh-input tokens, cache-write tokens, cache-read tokens, output tokens, and retry count. If a field is unavailable, mark it unknown.

The usage tracking and cost API guide explains the historical Usage and Cost API. Official: data typically arrives within five minutes of request completion, usage buckets can be 1m, 1h, or 1d, and cost data is daily. Priority Tier costs are excluded from the cost endpoint, and the API is legacy; new integrations should use the Analytics API.

That API is not a real-time cache tracer. Use it for reconciliation after a test, not as the only source for diagnosing why one request missed. A client-visible usage record may be more specific, but its fields should be reported rather than assumed.

Latency needs its own measurement. The long-context prefill latency test separates prompt processing, time to first token, decode, tool execution, and retries. The frozen sources publish no universal Claude Code prefill or decode rate, so do not attach an invented speed number to a cache hit.

Measurement Question it answers Common mistake
Prefix identity Was the cached segment unchanged? Assuming similar text is enough
TTL and timestamps Was the entry still eligible? Blaming every idle resume
Token categories What was fresh, written, or read? Treating all input as full price
Total request cost Did another component offset the saving? Measuring only the prefix
Latency stages Where did waiting occur? Equating cache price with speed
Acceptance result Did the work remain correct? Treating cheaper as better

The monorepo search and token-budget guide can help stabilize repository context. Scoped retrieval may reduce repeated discovery, but any token effect should be measured on the actual workload.

Caching inside a multi-agent workflow

Parallel scouts can benefit from a shared stable brief, but only if each task still receives the changing question later in its prompt. The subagent context and duplicate-work analysis explains how explicit handoff facts reduce rediscovery without pretending that isolated agents share hidden memory.

Separate worktrees do not create separate provider caches. The parallel-agent worktree isolation guide separates file state and branch ownership, while cache identity remains a provider pricing rule. Record both boundaries instead of assuming one proves the other.

Cancellation can change the request sequence too. The subagent stop and resume semantics distinguish a stopped task from completed history, and either path should trigger a fresh cache-state check before the next measured request.

A running badge also says nothing about cache state. The background running-count diagnosis is the right reference when a task appears active after returning a result. Use observed token categories to explain cost, not interface activity.

Budget controls remain separate. The task budgets versus hard stops guide explains why an advisory token hint is not an enforced spending cap. A cache estimate should never replace a hard control in a production workflow.

Stable security wording belongs in the reusable prefix, but enforcement belongs outside the model. The agent harness security boundaries make that distinction explicit. Repeating a rule cheaply does not make it self-enforcing.

Finally, record model dependence. The single-model lock-in and exit-cost analysis is relevant because cache rates, minimums, and exposed usage fields can differ across providers. A portable measurement worksheet should survive a model change even when the pricing formula does not.

Practical response: design for reuse, then verify it

Use this sequence before changing a prompt for caching. It prevents a pricing optimization from becoming a correctness regression.

  1. Identify the selected model and its cache minimum.
  2. Separate stable instructions from changing task material.
  3. Preserve the stable segment identically across intended reuse.
  4. Choose five-minute or one-hour TTL from observed cadence.
  5. Estimate total uses and apply the break-even formula.
  6. Run a fixed task and capture cache-token categories.
  7. Check prefix identity after every intentional change.
  8. Compare total request cost, not only prefix cost.
  9. Measure latency separately if speed matters.
  10. Verify the acceptance result before keeping the new layout.

If a session is compacted, re-check the prefix. The compaction cost worksheet models the summary event and resumed prefix, while this article models reuse. Together they prevent a cache assumption from hiding a state-transition cost.

If requests return stop reasons instead of normal completion, investigate that first. The stop reasons documentation lists states such as max_tokens, tool_use, and pause_turn. A retry after an incomplete turn can change both cache behavior and total cost.

Rate limits are another separate domain. The 429 error decision tree starts with the error and account state. Do not treat a retry storm as evidence that caching failed.

Claude Code Prompt Caching control checklist for model minimums, identical prefixes, TTL choice, reuse count and token-category measurement
Claude Code Prompt Caching control checklist. The checklist applies official rates and identity rules with conservative measurement; it does not promise that every prompt is eligible or every cache hit is faster.

Honest loss and data gaps

The concrete win is discounted repeated input. Under the standard multipliers, enough identical uses can reduce prefix cost substantially. The honest loss is the write premium, eligibility limits, and the possibility that a changed prefix or expired TTL removes the expected hits.

Unknown: the frozen sources provide no universal Claude Code cache-hit rate, token-saving percentage, or latency improvement. They also do not establish that every interactive prompt exposes a cacheable prefix or that every model follows the standard rates without exception.

Future updates should revisit the official caching documentation, record model and client versions, and publish a fixed-task comparison with fresh, write, and read tokens. A screenshot of a lower total without prompt identity and TTL evidence is not enough to explain the change.

The prompt-caching documentation supplies the pricing rules. The compaction documentation supplies a mechanism that can change the prefix. Neither source guarantees a net saving for a specific Claude Code session.

Do not turn a subscription allowance into a made-up token price. Use actual API pricing for API arithmetic, and keep subscription cost in a separate column. The context-portable migration guide is useful when a prompt workflow moves between harnesses that may cache differently.

Claude Code Prompt Caching verdict requiring eligible identical reuse, TTL fit and measured token categories before claiming savings
Claude Code Prompt Caching verdict. Official rates make break-even arithmetic possible, while minimums, exceptions, identity, and missing hit-rate evidence keep actual savings workload-specific.

A limited OpenAI-format test route

To test a similar measurement workflow in another agent, One AI API Key offers an OpenAI-format lane. On 2026-11-27, its catalogue showed 76 listed models and 46 available-now free IDs across 22 families. The free IDs share 100 requests and 5,000,000 tokens per day per account, resetting at 05:30 IST / 00:00 UTC. Accounts can have up to three keys, with one request in flight per key on free models.

The free IDs are OpenAI-format only. They are not a Claude Code route. Claude Code uses the Anthropic-format endpoint, and all four Claude IDs were marked unavailable on 2026-11-27. Do not paste a free ID into Claude Code or transfer Claude cache multipliers to another model without checking that model’s documentation.

An OpenAI-format agent such as OpenCode, Cline, or Cursor can use the endpoint quickstart for the base URL and first request. The prepaid pricing page documents signup credit and billing without a subscription or seat fee. Use the LLM cost calculator for a separate estimate and review the privacy and retention policy before sharing prompts.

The loss is comparability. Another model or harness may expose different cache fields and may not follow Anthropic’s rates. A smoke test can validate routing and your instrumentation, not certify Claude Code savings. The coding-agent model selection guide helps choose a test model without confusing provider pricing rules.

FAQ

When does prompt caching break even?

Under the standard multipliers, at least two total uses repay a five-minute write and at least three repay a one-hour write. This assumes an eligible identical prefix, no expiry, no model exception, and enough reuse.

Are cache reads free?

No. Official: cache reads cost 0.1 times base input price under the standard rules, with model-specific exceptions. Output and fresh input still have their own costs.

Does every repeated prompt hit the cache?

No. Hits require 100 percent identical prompt segments, the prompt must meet the model’s minimum cacheable size, and the entry must remain valid. A changed prefix or expired TTL can miss.

Is the one-hour TTL always better?

No. Its write multiplier is 2 times, compared with 1.25 times for five minutes. The longer TTL needs more reads to repay the higher premium and is useful only when reuse fits that window.

Does a cache hit guarantee a faster response?

No universal speed guarantee appears in the frozen sources. Measure prompt processing, first token, decode, tool execution, and retries separately. Cache pricing is not a published tokens-per-second figure.

More Claude Code troubleshooting

Sources

More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
  • 100requests
    per day
  • 3Mtokens
    per day
  • 47free
    models
  • $0per
    token
  • No card
  • No end date
Claim $10 credit →