Safeguard
AI Security•

What prompt caching saves, using the vendors' own cache prices

Anthropic, OpenAI and Google publish cache write and cache read prices. Here is how to turn them into a saving for your own prompts, with a worked example and a calculator.

Safeguard Security Team
4 min read

Prompt caching is the largest discount most teams can get without changing models. The vendors publish the rules, and they differ enough that a saving quoted for one does not carry over to another. Every price below was read from the vendor's own pricing page on 18 October 2026. Prices change, so check the pages before you budget.

What the three vendors publish

VendorCache writeCache readLifetime
Anthropic1.25x base input for 5 minutes, 2x for 1 hour0.1x base input, except 0.05x on Opus 5.5 and Sonnet 5.5 and 0.025x on Fable 5.15 minutes, refreshed free on each use, or 1 hour
OpenAIGPT-5.6 and later: 1.25x inputGPT-5.6 and later: 0.1x input, 0.05x for GPT-6.1 SolGPT-5.6 and later: 30 minutes. Earlier models: in memory or 24h retention
GoogleGemini lists a context caching price per million tokens, plus a storage price per million tokens per hour on some modelsExample: Gemini 3.8 Flash caching is $0.075 against $0.75 inputBilled by storage time where a storage price is listed

Anthropic's page says a 5 minute write pays for itself after one cache read, and a 1 hour write after two. OpenAI's guide says cached input is discounted "up to 95%". Gemini 4 Argon is listed as implicit caching only, with no storage price.

A worked example

Take a made up agent session: 40 turns on Claude Sonnet 5.5, a 20,000 token prefix that never changes, 3,000 new input tokens and 600 output tokens per turn. Sonnet 5.5 is listed at $2 input, $2.50 for a 5 minute cache write, $0.10 per cache read and $10 output, all per million tokens.

Without caching: 40 turns x (23,000 x $2 + 600 x $10) per million, which is $2.08.

With caching: one write of the prefix ($0.05), 39 reads ($0.078), new input at full price ($0.24) and output ($0.24). Total $0.61.

That is about 71 percent less on this invented session. The same session on Opus 5.5 goes from $4.16 to $1.22, and on Fable 5.1 from $10.40 to $2.85. These are list price estimates for a scenario, not measured bills. Your saving depends on how much of each request really is a stable prefix.

Calculator

# prices in USD per million tokens, from the vendor page
inp, write, read, out = 2.00, 2.50, 0.10, 10.00   # Sonnet 5.5
turns, prefix, new, outt = 40, 20000, 3000, 600

no_cache = turns * (prefix + new) * inp / 1e6 + turns * outt * out / 1e6
cache = (prefix * write + (turns - 1) * prefix * read
         + turns * new * inp + turns * outt * out) / 1e6
print(round(no_cache, 2), round(cache, 2))

Change the four prices to another model and the saving changes with them.

When caching does not save money

  • The prefix is shorter than the minimum. Anthropic lists 512 tokens for its newest models and 4,096 for Opus 4.6, Opus 4.5 and Haiku 4.5. Shorter prompts are processed without caching and no error is returned. OpenAI lists 1,024 tokens for GPT-5.6 and later.
  • The prefix changes. Anthropic says cache hits need identical segments, and a change in tool definitions, tool choice or images invalidates parts of the cache.
  • Requests are too far apart. After the lifetime ends you pay the write price again.
  • The prompt is over a price bracket. Anthropic says Claude Haiku 5.5 prompts over 100,000 tokens pay higher prices, and that cache reads count toward that length.

How to check your own hit rate

Anthropic returns cache_creation_input_tokens and cache_read_input_tokens in usage. OpenAI returns usage.input_tokens_details.cached_tokens. If both Anthropic numbers are zero on every call, nothing was cached. OpenAI's guide suggests tracking cached tokens divided by total input tokens over time.

If you connect Safeguard to an agent over MCP, tool calls are unlimited, and you can bring your own model, so these provider settings are the ones that decide your model bill.

Quick check

Why can a long cached prompt still cost more on Claude Haiku 5.5?

The page prices a request by its total prompt length, including cache reads and writes. Over 100,000 tokens the higher bracket applies, even on a cache hit.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.