Skip to content

What is prompt caching?

Paying once for the part of your prompt that never changes — and the write fee nobody mentions.

By Fiqhro Dedhen3 min readEdited by Fiqhro Dedhen

Every time you call an API, the model re-reads your entire prompt — the system instructions, the examples, the documents, all of it — and you are billed for every token, every time. Even though most of it was identical last time.

Prompt caching lets the vendor keep the processed form of that repeated prefix around, so subsequent requests skip most of the work and most of the cost.

The economics

The hit is the famous part: about 90% off. The write is where vendors quietly differ, and it is left out of every summary. Comparing like for like on a $5.00-per-million input rate, as published on 17 July 2026:

Anthropic (Opus 4.8)OpenAI gpt-5.6OpenAI gpt-5.5 / 5.4
Normal input$5.00$5.00$5.00
Cache write$6.25 (5 min) / $10.00 (1 hr)$6.25no charge
Cache hit$0.50$0.50$0.50

Two different deals are hiding in that table.

Where a write premium exists — Anthropic, and OpenAI's newest family — caching genuinely costs more than not caching, up front. You are buying an option, and it only pays if you exercise it. A cache that expires before anyone reads it is a pure loss. The break-even is early, from the second or third read depending on duration, but it is not zero; we work it through in how to cut your LLM API bill.

Where it does not — OpenAI's gpt-5.5 and gpt-5.4 families publish no cache write charge at all — caching is a free discount with no downside. Turn it on and stop thinking about it.

So the first question is not "should I cache?" but "does my model charge me to?" Nobody puts that on the feature page.

What can be cached

The mechanic that matters: caching works on a prefix. The cached portion has to be the beginning of your prompt, and it has to be byte-identical to last time.

That has a design consequence people hit late. Put the stable material first — system prompt, instructions, examples, reference documents — and the variable material last. A timestamp, a session id, or a user name near the top of your prompt invalidates everything after it, and you are paying full price while believing you are caching.

Order your prompt: static → semi-static → dynamic.

What it is not

  • It is not memory. Caching makes re-reading cheaper. It does not make the model remember your last conversation.
  • It is not a quality change. The output is the same. This is a billing and latency optimisation, nothing more.
  • It is not permanent. Caches expire — commonly five minutes or an hour, priced differently. Pick the duration from your real traffic pattern.
  • It is not automatic everywhere. Some vendors cache implicitly, others need explicit markers. Check the docs for the one you use.

Why you should care

Because for a typical application, the repeated prefix is most of the bill. A long system prompt plus a few reference documents, sent on every request, dwarfs the user's actual question.

Caching is usually the single largest saving available that does not require changing model or accepting worse output — which makes it the rare optimisation with no quality trade-off attached. The only cost is thinking about the order of your prompt.

What we addedThe write-premium mechanic that turns caching into a bet on how often you read back, rather than a free discount.

This article was researched and drafted with AI assistance from the sources listed below, then checked and edited by Fiqhro Dedhen before publication. How we work.

Sources

3 cited · 3 primary

  1. 1
    PrimaryAnthropic (Claude Platform Docs)
    Prompt caching

    Documents the prefix requirement, cache durations and the write-versus-hit pricing structure.

    docs.claude.com · accessed 17 Jul 2026

  2. 2
    PrimaryOpenAI (Platform Docs)
    Prompt caching

    OpenAI's implementation, for comparison of the same mechanic across vendors.

    platform.openai.com · accessed 17 Jul 2026

  3. 3
    PrimaryGoogle (Gemini API Docs)
    Context caching

    Google's equivalent feature and its caching semantics.

    ai.google.dev · accessed 17 Jul 2026

Primary sources are the company, paper or repository itself. Reporting is established press, used to corroborate. Community is used to find stories, never to establish facts.