Start Building
Technical

Prompt Caching: How Much Can You Actually Save?

The headline discount is not your real savings figure. Here is how to calculate what prompt caching is actually worth for your traffic.

Author photo
packet.ai Team
August 27, 2026

Prompt caching, sometimes called context caching or prefix caching depending on the provider, is the single highest-leverage cost optimization available on nearly every major LLM API today, and most teams running one aren't measuring what it's actually saving them. This guide covers how the discount actually works, prompt caching anthropic, prompt caching openai, and Gemini and DeepSeek's own versions, how to calculate what it's worth for your own traffic, and the structural mistakes that quietly kill your hit rate.

Key takeaways

  • Every major provider discounts repeated input tokens, but the size of the discount, whether it's automatic, and whether there's a write cost varies meaningfully by provider
  • Anthropic's cache reads cost 0.1x base input (a 90% discount), with a write premium of 1.25x for a 5-minute cache or 2.0x for a 1-hour cache; minimum cacheable prompt length varies by model, so check the specific model you're calling
  • Gemini's implicit caching applies a 90% discount only when a cache hit actually occurs, with no guarantee it will; its explicit caching guarantees the discount (90% on Gemini 2.5+, 75% on Gemini 2.0) but requires manual setup and carries an hourly storage fee
  • OpenAI's caching is automatic and applies above a 1,024 to 2,048-token minimum depending on the model. Pre-GPT-5.6 models get a flat 50% discount with no write cost; GPT-5.6 and later models use a different structure with a 1.25x write cost and a discount that varies by the specific model
  • The single most common mistake that silences caching entirely: putting variable, per-request content (a user ID, timestamp, or session value) ahead of the static content in a prompt, which breaks the prefix match from the very first token

This post is the cost-and-savings companion to the mechanism itself. For exactly how vLLM's own automatic prefix caching works under the hood, block-level hashing, cache_salt isolation, hit-rate metrics, see the packet.ai vLLM prefix caching guide. This post stays on what the discount is actually worth in dollars and how to calculate it for your own workload, across both self-hosted and hosted-API caching.

What Prompt Caching Actually Saves You From Paying For

Every request to an LLM starts with prefill: the model processing your entire prompt before it generates the first token of a response. If two requests share the same starting content, a system prompt, a set of tool definitions, a retrieved document, a growing conversation history, the first request already did that computation. Prompt caching means the second request doesn't pay for it again.

Mechanically, this is the same idea whether you're self-hosting with vLLM or calling a hosted prompt caching api, and prefix caching llm implementations all share the same core mechanic: the provider stores the KV cache tensors for a prompt prefix, and a later request that starts with an identical prefix gets those tensors reused instead of recomputed. What differs between self-hosted and hosted setups is the billing: on a self-hosted deployment, the savings show up as more available GPU throughput, since less compute is spent per request. On a hosted API, the savings show up directly as a discounted per-token rate on the cached portion of your bill.

How Much Each Major Provider Actually Discounts Cached Input

Worth being direct about this before comparing numbers: these five rows are not five prices for the same thing. Anthropic cache pricing, context caching gemini, and OpenAI's own automatic version are genuinely different mechanisms wearing similar names, not one discount presented five ways. Anthropic requires you to manually mark cacheable blocks and charges a write premium; Gemini splits into two separate products with different guarantees; OpenAI needs no setup at all but won't commit to one fixed percentage. Reading the discount column alone, without the setup column next to it, will give you the wrong picture of what each provider actually offers.

Provider Discount on cached reads Setup
Anthropic ~90% (0.1x base input) Manual: cache_control markers on static blocks; write costs 1.25x (5-min) or 2.0x (1-hour) base input
Gemini (implicit) 90% when it fires; no guarantee it will Automatic on Gemini 2.5+, no setup required
Gemini (explicit) 90% guaranteed on 2.5+, 75% on Gemini 2.0 Manual cache creation; minimum cacheable size varies by model; hourly storage fee
OpenAI 50% flat on pre-GPT-5.6 models; varies by model on GPT-5.6+ Automatic above a 1,024-2,048 token prefix (model-dependent); no write cost pre-GPT-5.6, 1.25x write cost on GPT-5.6+
DeepSeek V4 Flash ~97% ($0.22 → $0.007/M) Automatic, disk-based, off-peak rate as of August 2026

Figures reflect each provider's published rates as of August 2026, verified directly against each provider's own current documentation. Providers change pricing and caching structure without much notice, sometimes by model generation rather than across the board; check current documentation for the specific model you're calling before budgeting off any single number here.

The genuinely important thing this table doesn't fully capture on its own: Gemini's implicit caching isn't a lower-guarantee version of explicit caching, it's a different risk entirely. Google's own documentation is explicit that implicit caching passes on the discount only when a cache hit actually occurs, with no guarantee that it will for any given request; explicit caching is the only path that guarantees the discount, at the cost of manual setup and a storage fee. OpenAI's variation is generational, not random: pre-GPT-5.6 models use a flat 50% discount with no write cost, while GPT-5.6 and later models use a different structure entirely, with a 1.25x write cost and a discount that varies by the specific model within that generation. Anthropic's structure has stayed the most consistent across model generations of the four, though its own documentation notes minimum cacheable prompt lengths differ by model, so even Anthropic's numbers should be checked against the specific model you're calling rather than assumed to be identical across the lineup.

Calculating What Caching Is Actually Worth for Your Traffic

The real prompt caching cost math is the same regardless of provider, once you know your discount rate and the cache hit rate llm teams should be tracking on their own traffic:

effective_input_cost = (uncached_fraction × full_rate) + (cached_fraction × discounted_rate)
savings_percent = 1 − (effective_input_cost / full_rate)

A worked example using DeepSeek V4 Flash's current off-peak rates ($0.22 per million tokens on a cache miss, $0.007 on a cache hit): a workload with a stable system prompt achieving a 90% hit rate on its input tokens pays an effective input rate of (0.10 × $0.22) + (0.90 × $0.007) = $0.028 per million tokens, an 87% reduction from the uncached rate, even though the cache discount itself is roughly 97%. That eleven-point gap between the discount rate and the actual savings is your hit rate showing up directly in the bill: a 90% discount at a 20% hit rate would save far less than this example, and a lower-discount provider at a higher hit rate can easily beat a higher-discount provider at a lower one. Ask what hit rate is realistic for your actual traffic before comparing headline discount numbers against each other.

The Structural Mistake That Silently Kills Your Hit Rate

Caching, on every provider, depends on an exact prefix match: the cached and new requests need to be identical from the very first token up to wherever the shared content ends. The single most common way teams accidentally defeat this: putting variable, per-request content, a user ID, a timestamp, a session token, ahead of the static system prompt or shared context in the prompt template.

If that variable content sits at the front, the prefix match breaks immediately, and none of the static content behind it gets any caching credit, no matter how much of it is genuinely identical across requests. The fix is structural, not a configuration flag: put static, shared content first (system instructions, tool definitions, shared documents), and put variable, per-request content last. This single reordering is frequently the difference between a near-zero hit rate and a high one, on any provider, with no other changes required.

⚡ Where else hit rate quietly leaks

Beyond prompt ordering: some providers' caches expire after a period of inactivity, so a workload with long gaps between repeated requests may see lower hit rates than the same traffic arriving more densely. Multi-workspace or multi-tenant setups can also unintentionally fragment what would otherwise be a shared cache into several smaller, less-effective ones. Both are worth checking directly against your traffic pattern rather than assuming a stable prefix alone guarantees a high hit rate.

Measuring Your Actual Hit Rate, Not Assuming It

Whether caching is earning its keep for a specific workload is an empirical question, not something to assume from having it enabled. Every major provider's API response includes the token breakdown needed to calculate a real hit rate: separate fields for cached versus uncached input tokens on a given request. Logging those two numbers over a representative traffic window, not a single request, gives you the actual ratio to plug into the savings formula above, rather than an assumed or hoped-for number.

For a self-hosted vLLM deployment specifically, the packet.ai vLLM prefix caching guide covers the exact Prometheus metrics to track and how to calculate hit rate from them.

Caching Without Managing the Infrastructure Yourself

Whether you're self-hosting or calling a provider's API, the underlying economics are the same: caching is close to a free win whenever your traffic has real, repeated structure, and something worth actively checking for rather than assuming. packet.ai's Token Factory is being built around per-token billing with these efficiency mechanisms applied at the serving layer, so the savings from patterns like prompt caching apply without requiring separate configuration on your end. Token Factory is currently in private preview, with its model catalog and pricing still being finalized.

Join the waitlist for early access once it opens.

Sources and Further Reading

Frequently asked questions

It depends on both the provider's discount structure and your actual cache hit rate, not the discount alone. Anthropic offers a consistent 90% discount across models. Gemini's implicit caching gives a 90% discount only when a hit occurs, with no guarantee; its explicit caching guarantees the discount (90% on Gemini 2.5+, 75% on Gemini 2.0). OpenAI's discount is 50% flat on older models and varies by model on GPT-5.6 and later. Your real savings are (uncached fraction × full rate) plus (cached fraction × discounted rate), so a workload with a low hit rate saves far less than the headline discount percentage suggests, regardless of provider.
No. OpenAI's caching is automatic on prompts over a model-dependent minimum (1,024 to 2,048 tokens), with no code changes required. On openai cache pricing specifically, models before GPT-5.6 get a flat 50% discount with no write cost; GPT-5.6 and later models use a different structure with a 1.25x write cost and a discount that varies by the specific model, so it's worth checking OpenAI's current pricing documentation for the exact model you're calling rather than assuming a fixed number.
The most common cause is variable content, a user ID, timestamp, or session value, sitting ahead of the static shared content in the prompt. Since caching requires an exact match from the first token, any early variation breaks the match for the entire prompt. Restructuring the template to put static content first and variable content last usually fixes this. Cache expiration after inactivity and fragmentation across multiple workspaces or tenants are the other common causes worth checking.
It depends on your traffic pattern and risk tolerance. Anthropic's 90% discount has a write premium (1.25x to 2.0x base input) that you pay once per new prefix before earning the discount on later reads, favoring genuinely repeated, long-lived prefixes. Gemini's explicit caching guarantees its discount (90% on Gemini 2.5+) plus an hourly storage fee, while Gemini's implicit caching is free but only applies the discount when a hit actually occurs, with no guarantee. Neither is universally cheaper; it depends on how often and how predictably your traffic actually repeats.
They describe the same underlying mechanism, reusing cached KV computation for a repeated prompt prefix, under different vendor terminology. Google calls it context caching, most other providers and self-hosted serving engines like vLLM call it prefix caching. The mechanics are conceptually the same: an exact-match prefix gets reused instead of recomputed.

Last reviewed: August 27, 2026. Provider pricing changes without much notice; verify current rates against each provider's own documentation before budgeting. For the mechanism itself in a self-hosted vLLM deployment, see the vLLM prefix caching guide.

Waste less compute.

Same models. Same API. Fraction of the cost. Start free — no credit card required.

Start Building →

More from the blog