Cost guide
Prompt Caching Cost Savings: Token-Level Discounts and Examples
· · Estimated read: 7 min
Prompt caching stores repeated input prefixes on the provider's servers, reducing the effective input cost by 75-90% for cached tokens. This guide explains how caching works across major providers, quantifies savings with real model data, and shows best practices for increasing the share of eligible cached input tokens.
1. How Prompt Caching Works
When you send a request to an LLM API, the provider processes your input tokens. With prompt caching, the provider stores the initial prefix of your input (system prompt, few-shot examples, documents) on its servers. If the next request starts with the same prefix, the provider skips reprocessing those tokens and charges a lower cached-input rate.
The key constraint is exact prefix matching: the cached tokens must appear at the start of the prompt in the same order. Variations in system prompts, different document ordering, or even whitespace changes will miss the cache.
Pricing structure
Most providers use a three-tier pricing model for cached workloads:
- Standard input — the normal per-token rate for non-cached input
- Cached input — a discounted rate (typically 10-25% of standard) for tokens that hit the cache
- Cache write — an optional premium charged on the first request that populates the cache (some providers charge nothing extra)
Output tokens are always billed at the standard rate regardless of caching.
2. Provider Caching Comparison
Caching behavior and pricing vary by provider. Here is how the major providers compare:
| Provider | Cached discount | Cache write fee | Cache TTL | Min prefix size |
|---|---|---|---|---|
| OpenAI | 50-90% off input | GPT-5.6+: 30m at 1.25× input, 12h at 2.5×; earlier models: no separate write premium | GPT-5.6+: at least 30 min after write/reuse; earlier models vary by retention mode | 1,024 visible tokens (GPT-5.6+); earlier models depend on request settings |
| Anthropic | 90% off input | 5 min writes: 1.25× input; 1 hr writes: 2× input | 5 min default; optional 1 hr TTL | 2,048 tokens (Claude 3+), 1,024 (Haiku) |
| Google Gemini | 75-90% off input | Explicit caching (Gemini 2.5/3 only) adds token-hour storage cost, not a separate write premium | Implicit: provider-managed; explicit: configurable, 1 hr default | Implicit: 2,048 tokens (Gemini 2.5), 4,096 (listed Gemini 3/4 models); explicit thresholds vary |
| DeepSeek | 90% off input | None | ~5 min | Not published |
| xAI | 75-90% off input | None | ~5 min | Not published |
The table below shows 1023 models with cached input pricing across 40 providers in our catalog. Use the compare page to inspect cached pricing rows side by side.
3. Which Models Support Caching
The following table shows representative models from each major provider that support cached input pricing. For the full list, filter by "cached input" on the compare page.
| Provider | Model | Input $/1M | Cached $/1M | Output $/1M | Cache savings | Context |
|---|---|---|---|---|---|---|
| OpenAI | gpt-4o | $$2.50 | $$1.25 | $$10.00 | 50% | 16,384 |
| OpenAI | gpt-4o-mini | $$0.150 | $$0.075 | $$0.600 | 50% | 16,384 |
| OpenAI | GPT-4.1 | $$2.00 | $$0.500 | $$8.00 | 75% | 32,768 |
| OpenAI | GPT-4.1 mini | $$0.400 | $$0.100 | $$1.60 | 75% | 32,768 |
| OpenAI | gpt-4.1-nano | $$0.100 | $$0.025 | $$0.400 | 75% | 32,768 |
| OpenAI | o3 | $$2.00 | $$0.500 | $$8.00 | 75% | 100,000 |
| OpenAI | o4-mini | $$1.10 | $$0.275 | $$4.40 | 75% | 100,000 |
| Anthropic | Claude Sonnet 4 | $$3.00 | $$0.300 | $$15.00 | 90% | 64,000 |
| Anthropic | claude-sonnet-4-5-20250929 | $$3.00 | $$0.300 | $$15.00 | 90% | 64,000 |
| Anthropic | claude-haiku-4-5 | $$1.00 | $$0.100 | $$5.00 | 90% | 64,000 |
| Anthropic | claude-3-7-sonnet-20250219 | $$3.00 | $$0.300 | $$15.00 | 90% | 64,000 |
| Gemini 2.5 Flash | $$0.300 | $$0.030 | $$2.50 | 90% | 65,535 | |
| gemini-2.5-pro | $$1.25 | $$0.125 | $$10.00 | 90% | 65,535 | |
| gemini-2.0-flash | $$0.100 | $$0.025 | $$0.400 | 75% | 8,192 | |
| DeepSeek | DeepSeek Chat | $$0.280 | $$0.028 | $$0.420 | 90% | 8,192 |
| DeepSeek | deepseek-reasoner | $$0.280 | $$0.028 | $$0.420 | 90% | 65,536 |
| xAI | grok-4.5 | $$2.00 | $$0.300 | $$6.00 | 85% | 500,000 |
4. Quantified Savings Examples
These estimates use the cached-input-token share: the fraction of total input tokens billed at the cached rate, not the fraction of requests with any cache hit. A request can contain both cached and uncached tokens. These examples assume the stated share across requests and exclude cache writes, storage, expiration, and retries.
When does caching actually save money?
A cache read can be cheaper than normal input while a cache write costs more. If each
cache-eligible input token is charged either at the write rate or at the read rate,
caching breaks even when read share = (write price - normal input price) / (write price - read price).
This share is a fraction of eligible input tokens, not the fraction of requests
that report any cache hit.
Hypothetical example, per 1M tokens: $2.00 normal input, $2.50 cache write, and
$0.20 cache read. The break-even read share is about 21.7%
((2.50 - 2.00) / (2.50 - 0.20)); below that, writes cost more than
the reads save. These are illustrative rates, not a provider quote. Actual savings
also depend on cache expiration, eligible-prefix size, any storage charges, and
model-specific pricing tiers. Use the Calculator's
advanced options to split planned input into ordinary, cached-read, and cache-write
tokens instead of applying a blanket discount.
Scenario: 10k input tokens, 1k output tokens, 10,000 requests/month
This represents a typical RAG workload where the system prompt and retrieved context stay consistent across requests.
| Model | Strategy | Monthly cost | Savings vs no cache |
|---|---|---|---|
| GPT-4o | No caching | $350.00 | — |
| 50% of input cached | $287.50 | -18% | |
| 80% of input cached | $250.00 | -29% | |
| Claude Sonnet 4 | No caching | $450.00 | — |
| 50% of input cached | $315.00 | -30% | |
| 80% of input cached | $234.00 | -48% | |
| Gemini 2.5 Flash | No caching | $55.00 | — |
| 50% of input cached | $41.50 | -25% | |
| 80% of input cached | $33.40 | -39% | |
| DeepSeek Chat | No caching | $32.20 | — |
| 50% of input cached | $19.60 | -39% | |
| 80% of input cached | $12.04 | -63% |
When 80% of input tokens are cached, input-token savings equal 80% of the model-specific cached-token discount. This is not an 80% cut to the entire API bill: output tokens still cost the same.
5. Cost Scenarios: Cached vs Non-Cached Workloads
These three scenarios model real-world workloads where caching delivers measurable savings. Each uses the cache reuse preset from the calculator as a starting point.
Customer support chatbot
10k input tokens (system prompt + history), 500 output tokens, 50k requests/month, 70% of input tokens cached
| Model | Without cache | With cache (70% input tokens cached) | Monthly savings |
|---|---|---|---|
| gpt-4o (OpenAI) | $1500.00 | $1062.50 | $437.50 saved |
| Claude Sonnet 4 (Anthropic) | $1875.00 | $930.00 | $945.00 saved |
| Gemini 2.5 Flash (Google) | $212.50 | $118.00 | $94.50 saved |
| DeepSeek Chat (DeepSeek) | $150.50 | $62.30 | $88.20 saved |
RAG with long system context
8k input tokens (system + retrieved docs), 1k output tokens, 20k requests/month, 60% of input tokens cached
| Model | Without cache | With cache (60% input tokens cached) | Monthly savings |
|---|---|---|---|
| gpt-4o (OpenAI) | $600.00 | $480.00 | $120.00 saved |
| Claude Sonnet 4 (Anthropic) | $780.00 | $520.80 | $259.20 saved |
| Gemini 2.5 Flash (Google) | $98.00 | $72.08 | $25.92 saved |
| DeepSeek Chat (DeepSeek) | $53.20 | $29.01 | $24.19 saved |
Agentic coding workflow
15k input tokens (code + instructions), 2k output tokens, 10k requests/month, 80% of input tokens cached
| Model | Without cache | With cache (80% input tokens cached) | Monthly savings |
|---|---|---|---|
| gpt-4o (OpenAI) | $575.00 | $425.00 | $150.00 saved |
| Claude Sonnet 4 (Anthropic) | $750.00 | $426.00 | $324.00 saved |
| Gemini 2.5 Flash (Google) | $95.00 | $62.60 | $32.40 saved |
| DeepSeek Chat (DeepSeek) | $50.40 | $20.16 | $30.24 saved |
Key insight
Caching does not reduce output costs — and output tokens are typically 3-4x more expensive than input tokens. The savings come entirely from the input side. For workloads where output dominates (long-form generation, reasoning), caching has less impact. For workloads where input dominates (RAG, classification with long contexts), caching is the single highest-leverage optimization.
6. Best Practices for Cache Optimization
Structure prompts for prefix stability
Place static content (system instructions, few-shot examples, reference documents) at the beginning of the prompt. Put variable content (user queries, conversation history) at the end. This maximizes the shared prefix across requests.
Minimize prefix variations
Avoid dynamic system prompts that change per request (timestamps, session IDs, random instructions). If you need dynamic elements, place them after the static prefix rather than before it.
Keep the cached prefix large enough
Minimum cacheable input length varies by provider, model, and API. OpenAI GPT-5.6+ requires at least 1,024 visible tokens; older models depend on request settings. Gemini implicit caching requires at least 2,048 input tokens for Gemini 2.5 and 4,096 for the listed Gemini 3 and Gemini 4 models. Explicit Gemini caching has different model-specific requirements. Check the provider docs before assuming a short prompt will be cached.
Monitor cached token usage
Use the cached-input-token count reported in provider usage data divided by total input tokens to estimate the share used in these tables. Request-level hit rate is different: a hit may apply to only part of one prompt. Use the actual-usage calculator to estimate reported token buckets, then check bills for storage charges and expiry effects.
Account for cache TTL
Cache lifetime varies by provider and model. Treat the documented or configured TTL as a workload constraint, and remember that reuse can refresh some providers' entries. Low-traffic workloads may still lose reuse between requests, while clustered requests are more likely to stay within the active cache window.
Combine with model routing
Use a model routing cascade with caching: route simple queries to a budget model and complex queries to a premium model. Both routes benefit from cached system prompts, compounding the savings.
7. Frequently Asked Questions
How does prompt caching work?
Prompt caching stores a prefix of your input tokens on the provider's servers. When the same prefix appears in subsequent requests, the provider charges a lower cached-input rate instead of the standard input rate. The prefix must match exactly — same tokens in the same order — from the start of the prompt.
How much can prompt caching save?
Most providers offer 75-90% savings on cached input tokens. For example, Anthropic charges $0.30/M cached input vs $3.00/M standard for Claude Sonnet 4 (90% savings). OpenAI charges $0.50/M cached vs $2.50/M for GPT-4o (80% savings). The exact discount depends on the provider and model.
Is there a cost for writing to the cache?
Cache-write billing depends on the provider and model. Anthropic charges 1.25× base input for 5-minute cache writes and 2× for 1-hour writes. OpenAI GPT-5.6 and later charges 1.25× the uncached input rate for default 30-minute writes, or 2.5× for 12-hour writes in the Responses API; earlier OpenAI caching models do not add a separate write premium. Google Gemini explicit caching (on supported Gemini 3 and 2.5 models, not Gemini 4) adds token-hour storage charges rather than a separate cache-write premium.
Which models support prompt caching?
Over 1,100 models across 30+ providers support cached input pricing in our catalog. Major providers include OpenAI (100+ models), Anthropic (23 models), Google Gemini (50+ models), DeepSeek (12 models), xAI (38 models), and Mistral via Azure. Check each model's pricing page for cached-input rows.
Does prompt caching affect output quality?
No. Cached prompts produce identical output to non-cached prompts. The cache only affects how input tokens are billed — the model processes the same tokens either way.
How long does the cache last?
Cache lifetime varies by provider and model. OpenAI GPT-5.6 and later defaults to a 30-minute minimum TTL, with a 12-hour option in the Responses API; 30-minute reads refresh coverage. Earlier OpenAI models use different retention modes, including short in-memory retention and supported extended retention. Anthropic uses a 5-minute default TTL and offers a 1-hour option; cache hits refresh the entry without another write charge. Gemini implicit caching is provider-managed, while explicit cached-content objects use a configurable TTL that defaults to 1 hour. When an entry is no longer reusable, the next eligible request must establish cacheable content again under that provider's rules.
Can I use caching with streaming?
Yes. Prompt caching works with both streaming and non-streaming responses. The cache applies to the input tokens regardless of how the output is delivered.
When should I not use prompt caching?
Caching offers limited benefit if requests lack reusable prefixes or only a small share of input tokens qualify for discounted billing. Compare the measured cached-input-token share with any write or storage charges before assuming savings.
Estimate your caching savings
Use the calculator with cache reuse preset to model your exact workload and see how much caching saves.
Pricing data sourced from our catalog. Check data sources for provenance and freshness.