How KV Cache and Cache Hits Cut LLM API Prices
A major LLM API provider recently announced a permanent price cut to a quarter of its original rates, sparking wide discussion in developer communities. At first glance it looks like ordinary price competition, but after real usage it becomes clear this is not just a promotional subsidy—it rests on a genuine, substantial drop in inference costs. Its cache hit rate in real-world scenarios can approach 99%, compressing marginal inference costs to a minimal level. This article explains how that works, covering KV Cache principles, GPU memory usage, and the cost model behind tiered cache pricing, along with practical tips developers can use to optimize their own costs.
Why LLM API Prices Can Drop So Sharply: KV Cache and Cache Hits Explained
A major LLM API service recently announced a permanent price cut to a quarter of its original price, triggering wide discussion among developers. It looks like routine price competition at first, but actual usage reveals the truth: this price cut is not a simple subsidy. It is built on a real, substantial reduction in inference costs—the service achieves a cache hit rate approaching 99% in real business scenarios, pushing marginal inference costs to an extremely low level. Experienced developers even joke that the cost “rounds down to zero.”
So how can cache hits drive costs this low? The answer lies in a core technology behind LLM inference: KV Cache. This article breaks it down across three dimensions: the underlying principle, GPU memory usage, and the cost model.
1. Why Inference Needs a Cache: Starting with Autoregressive Generation
Mainstream large language models are based on the Transformer architecture and generate text token by token in an autoregressive manner. In the attention mechanism, each token is used to compute three vectors: Q (Query), K (Key), and V (Value).
Suppose the model has already generated “The weather today is really,” and the next step is to predict the following token. In a naive implementation without any cache, the model must run the full forward computation again over the three historical tokens to regenerate their K and V vectors. But those K and V values were already computed in the previous inference step, and the results are identical.
This creates massive redundant computation: the longer the sequence, the greater the waste. When generating the Nth token, all computation for the preceding N-1 tokens is repeated work.
The idea behind KV Cache is straightforward: store the K and V vectors of historical tokens (in GPU memory) and read them directly in subsequent inference steps. Only the newly generated token needs a full Q, K, V computation. The new Q is then used to compute attention scores against all cached K vectors, followed by a weighted sum over the cached V vectors.
This reduces the per-step computation from “processing the entire sequence” to “processing only the latest token,” dramatically lowering inference latency and significantly boosting throughput. It is fair to say that without KV Cache, practical large-scale LLM deployment would not exist today.
2. How Much GPU Memory Does KV Cache Use? A Calculable Formula
Caching is not free—it costs GPU memory. The size of a KV Cache can be estimated with a formula:
KV Cache size = 2 × number of layers × number of KV heads × head dimension × sequence length × bytes per value
The factor of 2 accounts for one copy of K and one of V. Consider a concrete example: a model with 32 layers, 32 heads, a head dimension of 128, a sequence length of 4096, and FP16 precision (2 bytes per value).
Per-token KV size per layer: 2 × 32 × 128 × 2 = 16,384 bytes, i.e., 16 KB.
Total KV Cache for the entire sequence: 16 KB × 32 layers × 4096 tokens = 2 GB.
With 10 concurrent requests (batch size 10), that becomes 20 GB. In long-context, high-concurrency scenarios, the KV Cache can even exceed the memory occupied by the model parameters themselves, becoming the primary bottleneck of inference services. This is why the industry keeps investing in optimizations such as MLA (Multi-head Latent Attention), KV quantization, and shared prefix caching.
3. Why Cache Hits Enable “Cliff-Like” Price Cuts
Once you understand KV Cache, the business logic of cache-based pricing becomes clear.
In real-world API usage, a huge share of requests share highly repetitive prefixes: the same system prompt, the same multi-turn conversation history, the same document context. If a provider retains the KV Cache from previous requests for a period of time, the repeated prefix portions of subsequent requests no longer need to be recomputed—they can simply reuse the cache, at nearly zero computational cost.
This has led to an industry-standard two-tier pricing model: cache-hit tokens are billed at a very low rate (sometimes one-tenth of the normal price), while cache-miss tokens are billed at the normal rate. When a service’s cache hit rate approaches 99%, the vast majority of tokens on the bill are settled at “bargain” prices—resulting in the dramatic price cuts users experience.
Achieving a hit rate close to 99% requires serious engineering:
- Stable cache routing: Requests with the same prefix must be routed, as much as possible, to the instances holding their caches, avoiding cache dispersion caused by naive load balancing.
- Longer cache retention times and larger cache pools: Many business workloads have long intervals between calls, so the cache survival window directly determines the upper bound of the hit rate.
- Precise prefix matching: The way system prompts and conversation histories are organized should facilitate prefix reuse—multi-turn conversations naturally have this property.
4. Practical Takeaways for Developers
Understanding this mechanism allows API users to optimize their costs proactively:
- Place stable, unchanging content (instructions, few-shot examples, long documents) at the front of your prompt and dynamic content at the end, maximizing prefix hit rates.
- Keep the same system prompt and message concatenation order across multi-turn conversations; avoid meaningless format changes that break prefix matching.
- When evaluating which provider is “cheaper,” don’t just look at the listed prices—factor in your own business’s cache hit rate to calculate the true blended cost. A high-hit-rate option can differ by an order of magnitude in actual cost for long-context, multi-turn workloads.
5. Conclusion
On the surface, this price cut is a business move; in essence, it demonstrates inference engineering capability. KV Cache frees autoregressive inference from redundant computation, prefix cache reuse drives the marginal cost of repeated content toward zero, and an extremely high cache hit rate converts the technical dividend into genuinely low prices. For developers, understanding cache mechanics is not only the key to understanding LLM pricing—it is an essential skill for cost optimization and architecture design.
