Requesty
Back|NOV '26AGENTS / COST OPTIMIZATION
5 MIN READ|

Claude Code prompt caching: hit rates by agent and how to raise them

Last updated

Claude Code caches prompts automatically. Requesty's October 2026 coding agent data measured an 85.22% cache hit rate for Claude Code, compared with 96.00% for Cline. As of November 2026, API-key users default to a five-minute cache and can set the main conversation cache to one hour for reuse across longer pauses.

Claude Code's cache hit rate was 85.22%

Cline led Requesty's October 2026 coding agent data with a 96.00% cache hit rate. Claude Code came in at 85.22%, 10.78 percentage points lower.

Coding agentCache hit rate
Cline96.00%
Roo Code95.57%
GitHub Copilot95.45%
Cursor95.42%
Pi94.58%
Kilo Code93.82%
OpenCode93.75%
Hermes Agent92.78%
Zed91.98%
Zoo Code89.66%
Claude Code85.22%
Qwen Code81.87%

The data note defines hit rate as the share of input tokens read from cache. Agents were identified from user agent and app title; each had at least 1,000 calls across at least five organizations.

Claude Code reuses the start of the prompt

A prompt prefix is the content at the start of a prompt. Claude Code puts stable content first and appends changes, so a later turn can read the earlier prefix from cache when it matches.

The match is exact. Change the prefix and the content after that change is processed again; switch models and the entire request is recomputed. Changing tool definitions can invalidate the cache at the system prompt layer.

Time matters too. With an API key, the default cache lifetime is five minutes, and a longer pause can mean the next turn has to write the prefix again. On Claude Code v2.1.242 or later, you can set the main conversation cache to one hour. The subagentPromptCacheTtl setting controls the cache lifetime for subagents and background requests.

Subscription users within plan usage have a one-hour main-conversation cache and a five-minute cache for subagents and background requests, according to the Claude Code cache lifetime docs. A subscription that has moved onto usage credits defaults to five minutes for both.

Editing CLAUDE.md mid-session leaves the current prefix intact. Root and user-level CLAUDE.md files are read at session start, so edited content loads on the next /clear, /compact or restart.

Running /compact replaces the message history, so the next request writes the conversation layer again.

When does one hour cost less?

In November 2026, Sonnet 5.5's base input price was $2 per million tokens. Anthropic's pricing sets a five-minute cache write at 1.25 times base input, a one-hour write at twice base input and a cached read at 0.05 times base input.

Sonnet 5.5 inputMultiplierCost per million tokens
Base input1x$2.00
Five-minute cache write1.25x$2.50
One-hour cache write2x$4.00
Cached read0.05x$0.10

A cache hit resets the cache's inactivity timer: the five-minute entry is refreshed at minute 2, so it expires before minute 8.

Take a fixed 100,000-token prefix used in four requests, at 0, 2, 8 and 10 minutes. The six-minute pause between the second and third requests expires the five-minute entry; the one-hour entry stays available.

Cache lifetimePrefix writes and readsPrefix cost
Five minutesTwo writes at $0.25, plus two reads at $0.01$0.52
One hourOne write at $0.40, plus three reads at $0.01$0.43

For that prefix, the one-hour cache costs $0.09 less. Its first write costs $0.15 more, but avoiding the second five-minute write saves $0.24 after paying for a cached read instead.

Change the pause pattern and the result flips. If all four requests arrive within five minutes of the preceding request, the five-minute cache needs one write and three reads, costing $0.28; the one-hour cache still costs $0.43. These figures cover the fixed prefix, and new input and output tokens add to the session bill.

For other models and providers, see our cache read price comparison.

Keep the prefix stable

Thariq Shihipar's account of building Claude Code says the team alerts on its cache hit rate and declares incidents when it drops. You can use the same signal to investigate a change in your own costs.

  1. 1
    Keep stable content at the start

    Keep the model and tool definitions consistent when you want to reuse a prefix. Switching models recomputes the request, and changing the set of tool definitions can invalidate the system prompt layer.

  2. 2
    Check model and version changes

    Look for model switches or Claude Code upgrades around a drop in cache reuse. An upgrade can change the system prompt or tool definitions, so resuming a session can reprocess its history.

  3. 3
    Account for pauses

    For API-key sessions, compare pauses with the configured cache lifetime. The default is five minutes; the main conversation can be set to one hour.

  4. 4
    Set a longer main conversation TTL

    On Claude Code v2.1.242 or later, set promptCacheTtl to "1h" for workflows with longer pauses. The TTL override docs cover the setting. A one-hour write costs twice the base input price, compared with 1.25 times for a five-minute write.

    To check which TTL your writes used, run claude -p "hello" --output-format json. In the output, compare usage.cache_creation.ephemeral_1h_input_tokens with usage.cache_creation.ephemeral_5m_input_tokens. If you route Claude Code through a gateway and the one-hour writes don't appear, confirm that the gateway forwards the anthropic-beta header unchanged.

  5. 5
    Watch cache savings

    On Claude Code v2.1.251 or later, /usage shows a prompt-cache summary for the main conversation. On v2.1.260 or later, it can also show the likely cause of the last miss when Claude Code can identify one. Requesty's usage analytics track cache savings alongside cost, tokens and latency.

If you use Requesty, open the usage analytics and check whether a change lines up with a model switch, version upgrade or longer pause. For a team-wide view, see Claude Code cost management for teams. If you are evaluating other agents, see our coding tools comparison.

Frequently asked questions
Does Claude Code cache prompts automatically?
Yes. Claude Code automatically caches stable prompt content and reuses it on later turns when the prefix matches.
What is Claude Code's prompt cache hit rate?
In Requesty's October 2026 coding agent data, Claude Code had an 85.22% cache hit rate, measured as the share of input tokens read from cache. Cline had a 96.00% hit rate in the same dataset.
How long does the Claude prompt cache last with an API key?
With an API key, Claude Code defaults to a five-minute cache. Subscription users within plan usage get a one-hour main-conversation cache and a five-minute cache for subagents and background requests. API-key users can set promptCacheTtl to 1h for the main conversation; see the Claude Code docs at https://code.claude.com/docs/en/prompt-caching.
What breaks Claude Code prompt caching?
A model switch, a change to tool definitions, a Claude Code upgrade or running `/compact` can break cache reuse. Running `/compact` replaces the message history, so the next request writes the conversation layer again. A pause beyond the configured cache lifetime can also require a new cache write.
How much do Claude cached prompt reads cost?
In November 2026, cached reads cost $0.10 per million input tokens for Sonnet 5.5 and $0.20 for Opus 5.5. Both prices are 5% of the respective model's base input price.
When is a one-hour Claude cache cheaper than a five-minute cache?
Using November 2026 Sonnet 5.5 prices, a one-hour cache can cost less when it avoids a five-minute cache rewrite. For a fixed 100,000-token prefix used at 0, 2, 8 and 10 minutes, the one-hour cache costs $0.43 for the prefix, versus $0.52 for the five-minute cache.
Related reading

Start building with Requesty

One line of code. 600+ models. Full control.

Speak to founders