Claude prompt caching lets the Claude API reuse the start of a request it has already processed. You pay a fraction of the input price for it the second time. On Claude Opus 5.5 a cache read costs $0.20 per million tokens instead of $4. The catch is a timer: the cache expires after 5 minutes without use, and the first request after it expires pays to rebuild everything.

That timer is why a Claude Code session on an API key can feel cheap for an hour and then expensive after one coffee break. This guide explains what the cache stores and what it costs on every current Claude model. It shows which timer Claude Code gives you on a subscription and on an API key, and which actions throw the cache away. We also ran the Fello AI cache-timer test on our own Claude subscription to see the timer in the raw usage data.

The Key Takeaways

  • Reads are cheap: a cache hit costs 0.1x the input price on most Claude models, 0.05x on Opus 5.5 and Sonnet 5.5 and 0.025x on Fable 5.2.
  • Writes cost extra: storing a prefix costs 1.25x the input price for the 5-minute cache and 2x for the 1-hour cache.
  • The timer resets on every hit: the default cache lives 5 minutes after the last request that used it, and the clock starts when a request starts, not when it ends.
  • Claude Code picks the timer by billing: on a Claude subscription within plan usage the main conversation gets the 1-hour cache; on an API key, usage credits or a cloud provider it gets 5 minutes.
  • Some actions break it: switching models, toggling fast mode, adding an MCP server and /compact all force an uncached turn.

What Is Claude Prompt Caching?

De l'éditeur

Découvrez quelle IA répond le mieux

Posez la même question à GPT, Claude et Gemini et comparez les réponses. Sur Mac, iPhone et iPad.

Téléchargez maintenant !
De l'éditeur

Découvrez quelle IA répond le mieux

Posez la même question à GPT, Claude et Gemini et comparez les réponses. Sur Mac, iPhone et iPad.

Essayez gratuitement
De l'éditeur

Arrêtez de payer trois abonnements IA

GPT, Claude et Gemini dans une seule app, avec un seul abonnement. Sur Mac, iPhone et iPad.

Téléchargez maintenant !
De l'éditeur

Arrêtez de payer trois abonnements IA

GPT, Claude et Gemini dans une seule app, avec un seul abonnement. Sur Mac, iPhone et iPad.

Essayez gratuitement
De l'éditeur

Arrêtez de jongler entre les apps d'IA

Posez la même question à ChatGPT, Claude et Gemini dans une seule fenêtre et gardez la meilleure réponse. Sur Mac, iPhone et iPad.

Essayez gratuitement
De l'éditeur

Arrêtez de jongler entre les apps d'IA

Posez la même question à ChatGPT, Claude et Gemini dans une seule fenêtre et gardez la meilleure réponse. Sur Mac, iPhone et iPad.

Téléchargez maintenant !
De l'éditeur

Ne vous contentez pas de lire sur l'IA, essayez-la

Les derniers modèles d'IA, prêts à l'emploi dans une seule app. Sur Mac, iPhone et iPad.

Téléchargez maintenant !
De l'éditeur

Ne vous contentez pas de lire sur l'IA, essayez-la

Les derniers modèles d'IA, prêts à l'emploi dans une seule app. Sur Mac, iPhone et iPad.

Essayez gratuitement

Claude prompt caching stores the beginning of a request, called the prefix. The next request that starts with exactly the same content reads it from the cache instead of processing it again. The prefix runs in a fixed order: tool definitions first, then the system prompt, then the messages, up to the point you mark for caching.

The cache exists because Claude has no memory between requests. Every turn of a chat or a coding session re-sends the whole conversation: the instructions, every earlier message, every file the model read and every tool result. Without caching, the model would reprocess that growing pile on every turn and bill all of it at the full input rate. With caching, only the newest exchange is new work. If AI billing units are unfamiliar, our guide to what AI tokens are explains what a million tokens buys.

The match is exact. Anthropic's documentation says cache hits require "100 percent identical prompt segments", so a single changed character early in the prefix forces everything after it to be processed again. The cache also has no effect on the answer: Anthropic states the response is identical to what you would get without caching. Caching saves money and time to first token; it never changes quality.

How Much Does Claude Prompt Caching Cost?

Claude prompt caching has three prices per model. A cache write costs 1.25x the input price for the 5-minute cache and 2x for the 1-hour cache, and a cache read costs 0.1x on most models. Anthropic cut the read multiplier further on its newest models: 0.05x on Claude Opus 5.5 and Claude Sonnet 5.5, and 0.025x on Claude Fable 5.1 and 5.2. These are the rates on Anthropic's pricing page on December 2, 2026, per million tokens:

ModelInput5-minute write1-hour writeCache readOutput
Claude Fable 5.2$8$10$16$0.20 (0.025x)$40
Claude Opus 5.5$4$5$8$0.20 (0.05x)$20
Claude Sonnet 5.5$2$2.50$4$0.10 (0.05x)$10
Claude Opus 5$5$6.25$10$0.50 (0.1x)$25
Claude Sonnet 5$2$2.50$4$0.20 (0.1x)$10
Claude Haiku 5.5 (prompts up to 100,000 tokens)$0.10$0.125$0.20$0.01 (0.1x)$0.50

For every plan and the rest of the API price list, see our full Claude pricing guide.

When Caching Pays Off

The 5-minute cache pays for itself after one cache read, and the 1-hour cache after two, according to Anthropic's pricing page. The write premium is small and the read discount is large, so any prefix you send more than once inside the timer should be cached.

Here is what that means on a long Claude Opus 5.5 coding session with a 200,000-token prefix, using the rates in the table:

What happens to the 200,000-token prefixCalculationCost
Warm cache read200,000 × $0.20 per million$0.04
Rebuild after the 5-minute cache expires200,000 × $5 per million$1.00 (25 times the warm read)
Rebuild on the 1-hour cache200,000 × $8 per million$1.60

On Claude Sonnet 5.5 the same prefix costs $0.02 to read and $0.50 to rebuild on the 5-minute cache. The gap between a warm turn and a cold turn is the number that matters, and on long sessions it is far bigger than the per-token price suggests.

How Long Does the Claude Cache Last?

The Claude cache lasts 5 minutes by default, and every request that reads it resets the timer for free. A session where you send something at least every few minutes keeps its cache warm indefinitely. A break longer than 5 minutes lets it expire, and the next request pays the full write price again.

The clock has one detail that catches people out. Anthropic measures the lifetime "from the start of the request that writes or reads the cache entry, not from the end of its response". If a response takes 4 minutes to stream, the follow-up has to start within about 1 minute of the response finishing to hit the 5-minute cache. Long reasoning turns eat into the timer.

5-Minute vs 1-Hour Cache: Which to Pay For

The 1-hour cache costs 2x the input price to write instead of 1.25x, and it keeps the prefix through breaks of up to an hour. Anthropic recommends it for prompts used less often than every 5 minutes but more often than every hour. Its examples are a chat where the user may not reply straight away and a side agent that runs longer than 5 minutes. For anything sent more often than every 5 minutes, Anthropic says to stay on the 5-minute cache, because each hit refreshes it at no charge.

The 1-hour cache has one more benefit for API users. Anthropic says cache hits are not deducted against your rate limit, so a warm cache also stretches how much you can send. Both durations behave the same for latency.

Does Claude Code Use Prompt Caching?

Yes. Claude Code uses prompt caching automatically on every request unless you disable it, and it chooses the cache timer for you based on how you pay. According to Claude Code's prompt caching documentation, on a Claude subscription, within your plan's included usage, the main conversation gets the 1-hour cache. On an API key, on usage credits after you pass your plan's limit, or through Amazon Bedrock or Google Cloud, it gets the 5-minute cache.

Request typeClaude subscription, within plan usageAPI key, usage credits or cloud provider
Main conversation (your turns, -p runs, Agent SDK)1 hour5 minutes
Everything else (subagents, workflows, compaction, session titles)5 minutes, except a few helper requests Anthropic sets to 1 hour5 minutes

Claude Code orders every request so the parts that rarely change come first. The system prompt and tool definitions lead, then your project context such as CLAUDE.md and auto memory, then the conversation. A new message only adds to the end, so the earlier layers stay cached. Anthropic's Claude Code team takes this seriously. In its engineering post on the design, Thariq Shihipar writes that the team runs alerts on the cache hit rate and declares an incident when it drops too low.

The cache cost shows up differently by plan. On an API key every rebuild is billed. On a subscription you do not get an invoice per request. Anthropic says a high cache hit rate helps it offer "more generous rate limits" on subscription plans. Claude Code's documentation says a cache miss makes the next response slower and more expensive while the cache rebuilds. Our guide to Claude usage limits covers how those limits are counted.

The Fello AI Cache-Timer Test

The Fello AI cache-timer test is our check of which timer Claude Code really uses and what a break costs on each one. We ran it on December 2, 2026, in Claude Code 2.1.333 on a Claude subscription, with Claude Opus 5.5 as the model. Each run was a short claude -p request, and we read the token counts straight from the JSON output. The dollar figures are Claude Code's own cost estimate at API rates, which a subscription does not bill but an API key would.

The first result settles the default. A plain request on the subscription wrote all 13,494 new tokens to the 1-hour cache and none to the 5-minute cache. The same request with FORCE_PROMPT_CACHING_5M=1 wrote all 11,209 to the 5-minute cache. Both cost estimates matched the published Opus 5.5 rates to the cent.

Then we took a break. We opened two sessions, one forced onto the 5-minute cache and one on the default 1-hour cache, sent a second message, waited about 6.5 minutes and sent a third:

TurnGap before itRead from cacheWritten to cacheCost estimate for the turn
5-minute cache, no break7 seconds26,280 tokens60 tokens$0.0057
5-minute cache, after the break6 min 39 s11,962 tokens14,398 tokens$0.0745
1-hour cache, after the break6 min 40 s26,154 tokens62 tokens$0.0058

The same break cost 13 times more on the 5-minute cache, because more than half the conversation had to be written again. On the 1-hour cache the break cost nothing extra. Our conversation was only about 26,000 tokens long. A real coding session with a 200,000-token history pays the same multiple on a much bigger number.

How to Check and Change Your Cache TTL

Run one command to see which timer your Claude Code session uses, then read the usage.cache_creation block in the output. One-hour writes appear under ephemeral_1h_input_tokens and five-minute writes under ephemeral_5m_input_tokens.

claude -p "hello" --output-format json

To change the timer, recent versions of Claude Code accept 5m or 1h through a setting or an environment variable. Set the main conversation to 1h on an API key if you often step away mid-task.

What you wantSettingEnvironment variable
Change the main conversation's timerpromptCacheTtlCLAUDE_CODE_PROMPT_CACHE_TTL
Change subagents and other side requestssubagentPromptCacheTtlCLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL
Force 5 minutes everywhere (overrides everything, useful for testing)noneFORCE_PROMPT_CACHING_5M=1

For a running total, type /usage. Since v2.1.251 it shows a Prompt cache (main) line with the session's hit ratio, the number of misses and whether the cache is warm right now. Since v2.1.260 it also names the likely cause of the last miss.

What Breaks the Claude Cache in Claude Code

Anything that changes the prefix before the newest message breaks the Claude cache, and the next turn is slower and costs a full rebuild. Claude Code's documentation lists the actions that do this:

ActionWhy the cache misses
Switching models with /modelEach model has its own cache, so the next request rereads the whole conversation. Claude Code asks you to confirm while the cache is still warm.
Changing the effort levelResets the cache on most models, but not on Fable 5.1 and later, Opus 5.5, Sonnet 5.5 and Haiku 5.5 with an API key or subscription.
Turning fast mode on or offFast and standard speed keep separate caches.
Adding or removing an MCP serverTool definitions sit at the very top of the prefix. With tool search on, the default on supported models, a mid-session server change no longer breaks it.
Running /compactThe summary replaces your history, so the conversation layer is rebuilt. Cheap while the cache is warm, most expensive when you resume an old session.
Piling up screenshotsWhen a request would pass the image limit, Claude Code drops the oldest batch, which changes earlier messages.
Upgrading Claude CodeA new version usually changes the system prompt, so the first session after a restart builds its cache from the top.

Our guide to Claude Code effort levels covers which level to pick before you start, so you never have to change it mid-task.

Several actions look risky but keep the cache. Editing source files Claude already read is safe, and so is editing CLAUDE.md mid-session, though the change waits until /clear, /compact or a restart. Changing permission mode, running skills and commands, and /recap keep it too. /rewind even helps, because it jumps back to a prefix that is already cached.

Why Switching to a Cheaper Model Can Cost More

Switching from Opus to a cheaper model mid-session can cost more than staying put, because the cheaper model has to rebuild the cache from zero. Anthropic's Claude Code post gives the example directly: 100,000 tokens into an Opus conversation, asking Haiku an easy question costs more than letting Opus answer it. The fix Anthropic uses is a subagent: Opus writes a short hand-off message, and the smaller model starts from that instead of the full history.

Why a Coffee Break Costs So Much on the 5-Minute Cache

A break of 5 to 30 minutes is the costliest pause on the 5-minute cache, because the cache has just expired and the conversation is still long. That is the finding of 30 days of coding traffic published by Requesty, an AI gateway, on December 1, 2026. Its data covers October 24 to November 22 across Claude Code, OpenCode, Codex, Pi and Kilo. By its count, 23.1% of the Claude bill went to rebuilding caches that expired while the developer was away. Pauses of 5 to 30 minutes alone cost 15.2% of the bill.

Requesty's figures come from traffic through its own gateway, which means API billing on the 5-minute default, not subscription Claude Code on the 1-hour cache. In its data, one 5-to-30-minute pause had an expected cost of $0.86 on Claude Opus 5.5 and $0.28 on Claude Sonnet 5.5. Requesty also found that putting every session on the 1-hour cache from the first turn made 87% to 89% of sessions more expensive. Most short sessions never idle long enough to use the extra hour.

The practical reading is simple.

If you code on an API key and regularly step away mid-task, set promptCacheTtl to 1h for the main conversation. If your sessions are short bursts, leave the default alone. On a subscription, Claude Code already makes that choice for you.

How to Use Claude Prompt Caching in the API

The simplest way to use Claude prompt caching in the API is automatic caching. Add one cache_control field at the top level of the request, and the API caches everything up to the last cacheable block. It moves the cache point forward as the conversation grows. Anthropic recommends it as the starting point for most uses.

{
  "model": "claude-opus-5-5",
  "max_tokens": 1024,
  "cache_control": { "type": "ephemeral" },
  "system": "You are a helpful assistant.",
  "messages": [{ "role": "user", "content": "Summarize the contract." }]
}

For the 1-hour cache, add "ttl": "1h" inside cache_control. Anthropic's prompt caching documentation has the full reference, including examples for each SDK.

Explicit Breakpoints and Minimum Length

Explicit breakpoints let you cache sections that change at different speeds, such as a fixed system prompt and a document that changes per user. You place cache_control on individual blocks, up to four per request, and automatic caching uses one of those four slots if you combine the two. Automatic caching is not available on Amazon Bedrock's bedrock-runtime endpoint, where only explicit breakpoints work.

A prefix also has to be long enough to cache. On the Claude API, the minimum is 512 tokens on Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, Opus 5 and the Fable 5 models. It is 1,024 tokens on Sonnet 5 and Sonnet 4.6, and 4,096 tokens on Opus 4.6 and Haiku 4.5. A shorter prompt is processed without caching and the API returns no error, so check the response.

How to Tell If the Cache Worked

Every API response reports the cache in its usage block. cache_creation_input_tokens counts tokens written to the cache on that request. cache_read_input_tokens counts tokens served from it, and input_tokens counts only what came after the last breakpoint. If both cache fields are 0, nothing was cached, usually because the prefix was below the minimum.

A high cache read with a small creation number is the healthy pattern, even if "cache read" dominates your usage report: those are the cheap tokens. If creation stays high turn after turn, something in the prefix keeps changing, such as a timestamp in the system prompt, a reordered tool list or a different tool_choice. To warm a cache before a user arrives, send the prefix with max_tokens: 0. The API writes the cache and returns without generating any output, though it rejects that request with streaming or extended thinking switched on.

The Verdict

Claude prompt caching is not a setting most people need to turn on. Claude Code and automatic caching already do it. What matters is the timer. On a Claude subscription, Claude Code gives the main conversation a 1-hour cache, so short breaks cost nothing extra. On an API key the default is 5 minutes, and a long session that sits idle for ten minutes pays to rebuild its whole history at the write price. If that describes how you work, set promptCacheTtl to 1h, pick your model and effort level before you start, and save /compact for natural breaks.

And if what you need is a quick answer rather than a coding agent, none of this meter is yours to watch. In Fello AI you ask Claude, GPT or Gemini from one window on one subscription, with no cache writes on a bill. For what Claude Code costs on each plan, see our Claude Code pricing breakdown.

Frequently Asked Questions

Is Claude prompt caching automatic?

In Claude Code, yes: it caches every request unless you set DISABLE_PROMPT_CACHING=1. In the API you turn it on with one top-level cache_control field, or by marking individual blocks.

How long does the Claude prompt cache last?

Five minutes by default, reset by every request that reads it. The optional 1-hour cache costs 2x the input price to write instead of 1.25x.

Does prompt caching change Claude's answers?

No. Anthropic says prompt caching has no effect on output, and the response is identical to an uncached one. It only changes cost and time to first token.

Why is my Claude cache read so high?

A high cache read is good news: those tokens cost 0.05x to 0.1x the input price. Worry when cache creation stays high on every turn, which means the prefix keeps changing or the cache keeps expiring.

Does switching models in Claude Code reset the cache?

Yes. Every model keeps its own cache, so after /model the next request rereads the whole conversation at the write price. Pick the model at the start of a session.