Email me

Explainer · 7 min read

Filed under LLMs Coding agents

What is prompt caching?

Short answer

Prompt caching is a discount for repeating yourself. The provider stores the processed start of your prompt (tools, system prompt, documents, conversation so far), and when the next request begins with exactly the same text it bills those tokens at 5 to 10% of the normal input price. For agents, which resend everything on every step, that is most of the bill: across 68,935 of our Claude Code calls, 98.1% of input tokens were cache hits, and the list-price cost came to about $5,420 instead of $66,800.

Bar chart titled Same 68,935 agent calls, 92% cheaper. Our Claude Code calls from September 24 to October 25, 2026, priced at Anthropic API list rates: billed as normal input $66.8K, with prompt caching $5.42K.
The same month of agent work, priced two ways at Anthropic's list rates read Oct 25 2026. The gap is prompt caching. Our estimate from the usage fields in our own Claude Code session logs. Chart by Tensorust from our session logs and Anthropic's published prices.

Part of the article I stopped paying twice for the same LLM answer (and why embeddings alone can't dedupe prompts). This page answers one question from it in depth.

On this page · 8 sections
  1. Key numbers
  2. How it works
  3. What it did to our bill
  4. When it pays off
  5. Common misconceptions
  6. Related
  7. FAQ
  8. Sources

The per-token prices on model launch pages are the headline. For anyone running agents, the cache hit rate is the real price, and it is the part providers do not put in the press release.

Key numbers

What Number Source (checked Oct 25 2026)
Claude Opus 5.5: input / cache hit / output $4 / $0.20 / $20 per million tokens Anthropic pricing
Cache write cost, 5-minute / 1-hour 1.25x / 2x base input same
Cache hit price on Opus 5.5 and Sonnet 5.5 0.05x base input (0.1x most others) same
Smallest cacheable prefix, Opus 5.5 512 tokens Anthropic prompt caching docs
Cache breakpoints per request up to 4 same
OpenAI: default lifetime / write / read (GPT-5.6+) 30 min / 1.25x / 0.1x OpenAI prompt caching guide
Our calls / input tokens, Sep 24 to Oct 25 2026 68,935 / 16.6 billion our session logs
Average input per call 240,915 tokens our session logs
Share that were cache reads 98.14% our session logs
List-price bill with / without caching $5,420 / $66,800 (-92%) our estimate

How it works

A language model reads your prompt before it writes anything, and that reading is real compute. When request two starts with the same 200,000 tokens as request one, the work is identical, so the provider keeps it.

The rules are strict and simple:

  1. Prefix only. The cache covers everything from the start of the request up to a marked point. Anthropic builds it in a fixed order: tools, then system, then messages.
  2. Exact match. One changed character before the cache point (a timestamp in the system prompt is the classic) and the prefix no longer matches. You pay for a new write and get no read.
  3. Short life. Anthropic's cache lives 5 minutes by default and the clock resets on every hit; a 1-hour cache costs more to write. OpenAI's default on GPT-5.6 and later is 30 minutes, with a 12-hour option.
  4. A minimum size. Prefixes under the model's minimum (512 tokens on Opus 5.5, 1,024 on OpenAI's GPT-5.6 and later) are not cached at all, and no error is returned.

On Anthropic you turn it on with one field. Automatic caching moves the cache point forward as the conversation grows:

{
  "model": "claude-opus-5-5",
  "max_tokens": 1024,
  "cache_control": { "type": "ephemeral" },
  "system": "...your long, stable instructions...",
  "messages": [{ "role": "user", "content": "..." }]
}

Add "ttl": "1h" inside cache_control for the 1-hour cache. On OpenAI caching is on by default for supported models. Either way, check the usage block of the response: Anthropic reports cache_creation_input_tokens and cache_read_input_tokens, OpenAI reports cached_tokens.

What it did to our bill

We run a lot of agents (the setup is in how we run 20 coding agents on one PC). Every Claude Code session writes a log with the usage block of every API call, so we added them up: 1,427 log files, 68,935 unique calls, September 24 to October 25, 2026.

Bar chart titled 98% of what our agents send is a cache hit. Share of 16.6 billion input tokens across 68,935 Claude Code API calls: cache reads 98.14%, cache writes 1.86%, uncached about 0.001%. Of 16.6 billion input tokens, 16.3 billion were cache reads and only 149,222 were sent uncached. Tally of the usage fields in our session logs, Oct 25 2026.

Priced at Anthropic's list rates on October 25, 2026 (our estimate; it ignores any plan or discount and assumes today's prices for the whole month):

  • Without caching, all 16.6 billion input tokens at base price plus output: about $66,800.
  • With caching, the same calls: about $5,420. Almost all of it is Opus 5.5: $3,199 for 16.0 billion cache reads, $1,489 for 278 million cache writes and $554 for output.

The surprise is the writes. They were 1.7% of Opus input tokens and 32% of its input bill. When a cache expires or a prefix changes, the full context gets written again at 1.25x, and on a 240,000-token context that is the expensive moment.

Line chart titled The cache hit rate, day by day. Cache reads as a share of all input tokens on each day with 50 or more calls, September 24 to October 25, 2026: 92.4% on the first day, then between 96.2% and 99.4% every day after, 98.1% on October 25. Our hit rate never dropped below 96% after the first day. Every new session starts with a full write, so a day of many short sessions sits lower than a day of long ones. Our session logs.

When it pays off

The math is simple enough to do in your head. On Opus 5.5, writing a prefix costs 1.25x and each read costs 0.05x, so:

  • Used twice: 1.25 + 0.05 = 1.30x, against 2x uncached.
  • Used ten times: 1.25 + 9 x 0.05 = 1.70x, against 10x. That is 83% off.
  • Used once: 1.25x, against 1x. A cache nobody reads is a 25% surcharge.

So caching wins whenever a prefix gets reused within its lifetime: agents, chat with long system prompts, the same document asked many questions. Our LLM API cost calculator and token counter help size the prefix first.

Common misconceptions

Myth

"Prompt caching stores the answer."

The recordThe record: it stores the processed prompt prefix, not the response. Every request still runs the model and can give a different answer. Storing whole answers for repeat questions is a different trick, a semantic cache, which we tested in Stop paying twice for the same LLM answer.

Myth

"It only matters for big companies."

The recordOur 98% hit rate came from ordinary coding-agent sessions on one PC. A single agent loop resending a 200,000-token context is exactly the case it was built for.

Myth

"Caching is always cheaper."

The recordA write costs 1.25x (2x for the 1-hour cache). A prefix that is never read again costs more than not caching it.

Myth

"Any similar prompt hits the cache."

The recordOnly an exact prefix does. Put stable content first (tools, instructions, documents) and anything that changes (dates, user input) last.

FAQ

What is prompt caching in simple terms?

Prompt caching lets an AI provider keep the processed start of your prompt (system prompt, tools, documents, earlier conversation) for a few minutes. When the next request starts with exactly the same text, the provider reuses that work and bills those tokens at a fraction of the normal input price: 0.05x to 0.1x on Anthropic, 0.1x on most current OpenAI models.

How much does prompt caching save?

It depends on how much of each request repeats. Coding agents resend their whole context on every step, so the share is huge: across 68,935 of our Claude Code API calls from Sep 24 to Oct 25 2026, 98.1% of input tokens were cache reads, and the list-price bill came to about $5,420 instead of $66,800 (our estimate at Anthropic's Oct 25 2026 prices).

Is prompt caching the same as KV caching?

It is built on the same idea. A KV cache holds the attention keys and values a model computed for earlier tokens inside one request. Prompt caching keeps that computed prefix across requests, so a later call with the same prefix can skip recomputing it, and the provider passes part of the saving to you as a discount.

Does prompt caching change the answer?

No. The provider reuses the work for the exact same prefix, so the model sees the same input. If any byte before the cache point changes (a timestamp in the system prompt, reordered tools), the prefix no longer matches and you pay for a fresh write instead.

How long does a prompt cache last?

On Anthropic the default is 5 minutes, refreshed for free every time the cache is read, with a 1-hour option that costs 2x base input to write. On OpenAI's GPT-5.6 and later the default minimum lifetime is 30 minutes, with a 12-hour option at 2.5x.

Sources

All checked October 25, 2026.

Provider docs

  • Anthropic, Pricing: Claude Opus 5.5 at $4 input, $5 5-minute cache write, $8 1-hour cache write, $0.20 cache hit, $20 output per million tokens; Sonnet 5.5, Fable 5.1, Opus 4.8 and Haiku 5.5 rates used for the small share of our calls on those models; cache hits at 0.05x base input on Opus 5.5 and Sonnet 5.5.
  • Anthropic, Prompt caching: automatic caching and explicit breakpoints, up to 4 breakpoints, tools then system then messages, 5-minute default lifetime refreshed on each read, 1-hour option at 2x, 512-token minimum on Opus 5.5, the timestamp example.
  • OpenAI, Prompt caching guide: on by default, 1,024-token minimum for GPT-5.6 and later, 30-minute default at a 1.25x write rate, 12-hour option at 2.5x, reads at 0.1x on most of these models and 0.05x on GPT-6.1 Sol, "discounted up to 95%", the cached_tokens usage field.

Our data

  • Tensorust Claude Code session logs on our studio PC: the usage block (input_tokens, cache_creation_input_tokens with its 5-minute / 1-hour split, cache_read_input_tokens, output_tokens) of 68,935 unique API calls in 1,427 log files, September 24 to October 25, 2026, deduplicated by message id. Only token counts were read; no prompt or response text.
  • Cost estimate: each model's tokens priced at the list rates above, with cache writes split 88.3% 5-minute / 11.7% 1-hour as in the logs overall. It assumes October 25, 2026 prices for the whole period and ignores plans, credits and discounts; it is our estimate, not an invoice.

Images

  • All charts by Tensorust from the data above.

Next question

Every number on this page links to its source and was checked on Oct 25, 2026. Spot an error or a newer figure? Email matt@tensorust.com and it gets fixed. Related: LLM API cost calculator, Token counter.

Read next

Back to The Manual →   All articles →

Get the next one by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Up next

The article this answer comes fromI stopped paying twice for the same LLM answer (and why embeddings alone can't dedupe prompts)Retries, double clicks and parallel workers send the same prompt twice. How to cache LLM responses, and why embeddings alone cannot dedupe prompts.Read it next →

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Did this answer your question?

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ

Disagree, or have a number to add? Discuss this on The Floor →

What are people saying about this? Read and post on The Floor →