가이드 목록으로
Pricing·2026년 9월 4일·10분 분량

Claude prompt caching — the rates, the usage object, and why hit rates drop behind a gateway

Marked correctly it is a tenth of the rate. Marked wrong it costs more than not caching at all.

Last reviewed on .

Prompt caching is the largest single lever on an agent bill, and the one most likely to be quietly not working. Marked correctly, the repeated part of your request is billed at a tenth of the input rate. Marked incorrectly — or routed through something that rewrites your prefix — it is billed at more than the plain rate, because you are paying to write cache entries nothing ever reads.

The mechanism is well documented elsewhere. What is not documented anywhere is what changes when the request goes through a gateway, which is the situation of most people reading this. Both are below.

The mechanism, briefly

You mark a stable prefix — a system prompt, a tool schema, a document — and the provider stores its processed form. The next request whose prefix matches exactly reads it back instead of reprocessing.

POST /v1/messages
{
  "model": "claude-sonnet-4-6",
  "max_tokens": 1024,
  "system": [
    {
      "type": "text",
      "text": "<your long, stable instructions>",
      "cache_control": { "type": "ephemeral" }
    }
  ],
  "messages": [{ "role": "user", "content": "..." }]
}

Two properties do all the work and cause all the trouble. The match is on a prefix, so anything that changes early invalidates everything after it. And an entry has a lifetime, so a conversation with long gaps between turns rebuilds rather than reads.

What it costs

ModelInput, per 1MCache readCache write on Kunavo
Claude Haiku 4.5$0.40$0.04$0.40
Claude Sonnet 4.6$1.20$0.12$1.20
Claude Opus 5$2.00$0.20$2.00

The third column is the standard ratio: a read costs a tenth of input. The fourth is not standard. Anthropic prices a cache write above the input rate; Kunavo does not pass that surcharge through, so a write bills at the plain input rate here. That matters specifically for workloads that rebuild often — long-running agents, slow conversations, anything whose prefix churns — because those are the workloads where writes, not reads, dominate the cache line of the bill.

Both figures are read from the catalog at render time, the same source the pricing table and the Claude calculator read — there are no hand-typed rates on this page.

Reading the usage object

Do not infer cache behaviour from the bill; every response tells you directly, and the three token counts are the whole diagnosis.

// The four numbers that tell you whether caching is working.
// Read them from every response before you tune anything.
"usage": {
  "input_tokens": 312,                     // billed at the input rate
  "cache_creation_input_tokens": 0,        // billed at the write rate
  "cache_read_input_tokens": 24106,        // billed at the read rate
  "output_tokens": 890
}

// A healthy cached agent turn looks like the above: a small
// input_tokens, a large cache_read, and a zero creation.
// If cache_creation is large on EVERY turn, the cache is being
// rebuilt each time and you are paying more, not less.

Why hit rates drop behind a gateway

A cache lives at the upstream that created it, and the prefix match is exact. Those two facts together produce three failure modes that never occur when you call one provider directly:

Routing moved. If consecutive requests land on different upstreams, the second one finds no cache — the entry the first one wrote is not visible from where the second one ran. This is invisible in your own logs and shows up only as a cache-creation count that should have been a read. It is the single most common cause, and it is why a gateway that reroutes freely between upstreams can be cheaper per token and more expensive per session.

Something was injected ahead of your prefix. A layer that rewrites the system message, normalises tool definitions or reorders fields produces a different prefix, and a different prefix is a miss. Nothing errors; the bill just goes up.

The gap outlived the entry. An agent that thinks for several minutes between turns can rebuild every time. This one is a property of your workload rather than of the gateway, but it interacts badly with the first: a rebuild is also a re-route opportunity.

The diagnostic for all three is the same — watch cache_creation_input_tokens across a session. Flat and large means you are rebuilding. Large once and zero after means it is working. On Kunavo, request-level cost and cached-token counts are in the usage view, and the caching reference has the endpoint-level detail.

What to do about it

Keep the cached prefix genuinely stable — put anything that changes per request after the marked block, never before it. Batch an agent's turns closer together where you can, since idle time is the enemy of a short-lived entry. And measure a session end-to-end rather than a request: caching is a property of a sequence, and a per-request estimate cannot see it. The Claude token cost calculator has a cached-tokens field for exactly this reason — set it to the fraction of your prompt that really repeats and the monthly figure stops being fiction.

FAQ

How does Claude prompt caching work?

You mark a stable prefix of the request — usually the system prompt, tool definitions or a long document — with cache_control, and the provider stores the processed form of those tokens. On the next request whose prefix matches exactly, those tokens are served from cache and billed at a fraction of the input rate instead of being reprocessed. The match is on an exact prefix, so anything that changes early in the request invalidates everything after it.

How much does Claude prompt caching save?

A cache read is billed at one tenth of the model's input rate. On Claude Sonnet 4.6 that is $0.12 instead of $1.20 per 1M tokens; on Claude Opus 5, $0.20 instead of $2.00; on Claude Haiku 4.5, $0.04 instead of $0.40. The saving depends entirely on what fraction of your input repeats: a chat product where every prompt is different saves nothing, while a coding agent re-sending a 24,000-token repo map every turn turns most of its input bill into a tenth of itself.

Does Kunavo charge a cache-write surcharge?

No. Anthropic's own API prices writing a cache entry above the plain input rate, on the reasoning that the write costs more to process than an ordinary token. Kunavo does not pass that surcharge through — cache-write tokens are billed at the model's ordinary input rate. That is set in one place in the billing code as a write ratio of 1 for the Anthropic protocol, and the calculators on this site read the resulting rate from that same function rather than restating it, so the figure they print cannot drift from what is charged.

Why is my cache hit rate low through a gateway?

Because a cache is bound to the upstream that holds it, and prefix matching is exact. Three things break it in a gateway setup that would not break it against one provider directly. A request routed to a different upstream than the previous one finds no cache there, because the cache is not shared between them. Anything injected ahead of your prefix — a rewritten system message, a reordered tool list — produces a different prefix and therefore a miss. And a gap longer than the entry's lifetime expires it, so a slow-turning agent rebuilds on every turn. The usage object tells you which: a large cache_creation_input_tokens on every request means rebuilding, not caching.

How do I tell whether prompt caching is actually working?

Read the usage object rather than the bill. Every response reports input_tokens, cache_creation_input_tokens and cache_read_input_tokens separately. A working cache shows a small input count, a large cache_read count and a zero or occasional creation count. A cache that is being rebuilt shows a large creation count on every single turn — which costs more than not caching at all, because you are paying to write entries nobody reads.

What is the minimum size for a Claude prompt cache?

There is a floor below which a prefix is not cacheable, and it differs by model tier, so a short system prompt may silently never cache no matter how you mark it. The practical test is empirical rather than documentary: mark the prefix, send two identical requests, and look at whether the second one reports cache_read_input_tokens above zero. If it does not, the prefix is either below the floor or not byte-identical.

Does prompt caching change what the model returns?

No. Caching is a billing and latency optimisation on the processing of the prefix, not a change to what the model sees or produces. The same request with and without cache_control returns the same kind of answer; what changes is what the prefix costs and how fast the first token arrives.