Prompt Caching Pricing 3
Published: 2026-07-27 07:27:57 · LLM Gateway Daily · rag vs mcp · 8 min read
Prompt Caching Pricing: The Hidden Trap in Your LLM Bill
The promise of prompt caching sounds like an unqualified win for developers building AI applications: pay once for the initial prompt processing, then get discounted rates on repeated context tokens. In practice, the 2026 landscape reveals a fragmented mess where caching semantics, expiration policies, and pricing granularity vary wildly between providers. OpenAI charges a write cost for caching a prefix and a smaller read cost when it hits, but only if your prompt is exactly identical from token zero. Anthropic Claude takes a different approach, automatically caching the first 1024 tokens of a conversation, but charges a 1.25x multiplier on the initial cache write before giving you the discount. Google Gemini offers a completely separate pricing tier for cached content with a minimum storage duration of one hour, which means you pay for idle cache time even if your application only sees bursts of traffic. These differences aren't just academic; they directly determine whether caching saves you money or silently increases your bill.
The most common pitfall I see teams make is assuming all caching pricing models are interchangeable when comparing providers. A developer benchmarks OpenAI's cache hit rate at 60% and calculates a 40% cost reduction, then switches to Claude expecting similar savings, only to find their actual spend increased because Anthropic's cache write cost eats into the discount window. OpenAI charges nothing for cache writes beyond the base prompt token cost, while Anthropic explicitly adds a surcharge on the initial write. Worse, Claude's automatic caching on the first 1024 tokens incentivizes short, repetitive prefixes, but penalizes long, unique prompts that never get reused. If your application sends highly variable user contexts after a fixed system prompt, Anthropic's model might actually be worse than no caching at all. The real-world cost comparison requires you to model your specific traffic pattern: what percentage of requests share an exact prefix, how long between repeated calls, and whether you control the cache flush timing.

Another subtle but expensive mistake involves cache invalidation and expiration policies that do not align with your application's behavior. OpenAI's prompt caching expires after five minutes of inactivity on that prefix, while Anthropic's cache persists for five minutes as well but resets the timer on every cache hit. This means a burst of 100 requests in one minute keeps the cache hot, but a single request every six minutes never benefits from caching at all. Google Gemini's minimum one-hour storage requirement forces you to pay for cache retention even during off-peak hours, which can wreck cost projections for applications with spiky traffic patterns like a customer support chatbot that sees 90% of its traffic between 9 AM and 5 PM. DeepSeek and Qwen take a different approach entirely, offering prompt caching only at the API level with no guaranteed duration, making it a best-effort optimization rather than a reliable pricing lever. When you compare pricing across providers, you must account for these expiration behaviors or your spreadsheet will lie to you.
TokenMix.ai addresses this complexity by offering 171 AI models from 14 providers behind a single API with an OpenAI-compatible endpoint, making it straightforward to test caching economics across different providers without rewriting your integration code. You can swap between OpenAI, Anthropic, and Gemini models using the same SDK calls, then compare actual billed costs against your traffic patterns through pay-as-you-go pricing with no monthly subscription. The platform also provides automatic provider failover and routing, which means if one provider's cache miss rate spikes your costs, you can redirect traffic to a model with more favorable caching terms. Other solutions like OpenRouter, LiteLLM, and Portkey offer similar multi-provider abstractions, each with their own caching-aware routing capabilities, so the key is to pick the tool that lets you experiment with real usage data rather than theoretical pricing tables.
The pricing comparison itself is further complicated by how providers define "cache tokens" against "input tokens." OpenAI charges cache read tokens at about half the price of input tokens, but cache write tokens at the full input rate. Anthropic's cache write surcharge means the first request with a new prefix costs more than a standard request, and you only recoup that cost after multiple hits. Google Gemini separates cached content pricing entirely, with a per-character storage fee plus discounted read tokens, but the storage fee applies continuously even when no requests are hitting that cache. If your application has a long system prompt of 8,000 tokens that is reused across thousands of user sessions, but those sessions are spread over several hours, Gemini's storage fee might exceed the savings from discounted reads. Meanwhile, Mistral and Qwen offer no formal prompt caching pricing at all, relying purely on standard token rates, which can actually be simpler and more predictable for low-repetition workloads.
A particularly devious trap arises when providers change their caching policies without clear documentation. In early 2026, both OpenAI and Anthropic adjusted their cache expiration windows and pricing multipliers, catching teams who had hardcoded cost assumptions into their application logic. One team I consulted had built a caching estimator that assumed a five-minute window for both providers, only to discover Anthropic had silently reduced its window to three minutes for certain model tiers. Their cost projections were off by 30% for two months before they noticed. The lesson here is that prompt caching pricing is not a static comparison; it is a moving target that requires continuous monitoring. Build alerting around your actual cache hit rates and billed token costs per provider, not just your budgeted numbers.
For technical decision-makers, the most pragmatic approach is to treat prompt caching as an optimization layer you opt into, not a default assumption. Start with a simple baseline: compare total input token costs across providers without caching, then layer caching benefits on top only after you have actual traffic data. Use tools like OpenRouter or Portkey to A/B test caching-enabled vs. caching-disabled endpoints for the same model, measuring real cost per request over a full business cycle. If your prompt prefixes are highly dynamic or user-specific, caching may never deliver meaningful savings, and the overhead of managing cache state across a multi-provider architecture is not worth the complexity. Conversely, if you have a stable system prompt shared across millions of requests, Anthropic's automatic caching might be your cheapest option despite the write surcharge, provided your request frequency keeps the cache warm.
The final pitfall is neglecting to factor in latency improvements when comparing pricing. Prompt caching does not just reduce token costs; it also reduces time-to-first-token because the model does not need to re-encode the cached prefix. For real-time applications like conversational AI or code completion, this latency reduction can be more valuable than the token savings. A provider with slightly higher cache read costs but faster cache retrieval might be the better choice if your users experience sub-second response requirements. Google Gemini's cached content serving is notably faster than its standard inference path for long prompts, while OpenAI's cache read latency is less differentiated. When you build your pricing comparison, add a column for measured p95 latency with and without caching, then weight cost against user experience. The cheapest provider on paper may be the most expensive in practice if it drives users away with sluggish responses.

