Why Cache-Hit Pricing Dropped: Agent Workloads and Smaller KV Footprints
A price cut on cache-hit input tokens is less a promotion and more a reflection of lower serving costs. This article explains how Agent request structures drive high prefix-cache hit rates, how smaller KV Cache footprints reduce the cost of cache serving, how exact-prefix caching works in practice, and what developers can check to make their workloads more cache-friendly.
What the Price Cut Actually Means
The V4 series models have adjusted cache-hit input pricing to one-tenth of the launch price. Many developers read this as a promotion. From a technical standpoint, it looks more like a repricing that follows a drop in serving cost. Only when the cost of a single cache hit falls does a vendor have room to cut the price like this.
LLM API input billing typically has two tiers: cache miss and cache hit. On a miss, the model must read and compute every input token, which is computationally expensive. On a hit, the system reuses previously computed prefixes and only processes the newly appended suffix. That is why hit prices are usually lower than miss prices.
Why Agent Requests Hit the Cache Often
Agent-style applications have a highly repetitive request structure. The common components include:
- System prompt: defines the role, behavioral boundaries, and output format, and usually stays unchanged within a session.
- Tool schemas: tool names, parameters, and return structures, which remain stable across a session.
- Project context: in coding scenarios, things like file trees, function signatures, and dependency lists that recur across turns.
- Memory and preferences: session summaries, user settings, and similar content carried verbatim on every request.
- Run identifiers: task IDs or turn numbers that change each call but are short.
Under this structure, most of the request’s beginning stays identical across consecutive calls. What actually changes each turn is mainly new environment observations, new task descriptions, and turn numbers. Exact-prefix caching fits this pattern well: as long as the prefix matches token by token, the system can reuse prior intermediate computations.
Ordinary chat is different. Each question may be on an entirely new topic, so even with a fixed system prompt, the reusable prefix is short and hit rates tend to be low.
Agent workloads do not automatically guarantee high hit rates, though. The hit rate also depends on:
- Prefix stability: how often system prompts and tool definitions change.
- Position of dynamic content: timestamps, random IDs, or per-turn re-sorted results inserted into the prefix will invalidate everything after them.
- Cache capacity and eviction policy: server-side cache space is finite, and prefixes left idle for too long may be evicted.
- Version changes: once the model or tokenizer is updated, old caches can no longer be used.
Smaller KV Footprint: Lowering the Cost of Cache Serving
Why the KV Cache Takes Up Space
When a Transformer generates output, it must store a Key and Value vector for every token for subsequent attention computations. This is the KV Cache. Its size scales with input length, number of layers, attention heads, and hidden dimensions. The longer the context, the larger the footprint. For long-context requests, a single request’s KV Cache can reach hundreds of MB. The more prefixes are cached, the greater the storage and memory pressure—one of the reasons cache pricing used to be high.
Common Compression Techniques
Techniques commonly used to reduce KV footprint include:
- Grouped-Query Attention (GQA): multiple query heads share one set of Keys and Values, reducing the KV data that must be stored. Compared to Multi-Head Attention (MHA), the reduction ratio depends on the number of groups.
- Quantization: storing KV data in INT8 or lower precision instead of FP16, cutting storage proportionally. Accuracy loss should be verified through evaluation.
- Cross-layer sharing: some layers reuse KV representations from other layers, reducing duplicate storage.
Specific configurations vary by model. For the V4 series architecture details, refer to the official technical documentation; this article does not commit to any specific multiplier.
Why Costs Fall
The cost of a single cache hit comes from two parts: reading the cached data, and the subsequent computation. The smaller the KV footprint, the less data must be read from GPU memory or storage, and the lower the loading cost. The same cache capacity can also hold more prefixes, reducing evictions caused by limited space.
Loading cost correlates with the amount of data read, but it is also affected by memory bandwidth, batch size, and scheduling strategy. So it is not a simple linear relationship with cache size.
How the Caching Mechanism Works
Basic Steps of Prefix Matching
- Tokenization and segmentation: split the input into a token sequence and compute a prefix fingerprint at fixed granularity.
- Longest match: search the cache index for the longest prefix that exactly matches the current input. Attention depends on token-by-token consistency, so matching must be exact, not approximate.
- State reuse: on a hit, load the KV Cache for that prefix and continue computing the appended suffix from the corresponding position.
- Writing new cache: after the missed portion is computed, the new prefix is written to the cache for subsequent requests.
Cache keys must be bound to the following information to prevent misuse: model version, tokenizer version, and tenant or account isolation identifiers. Once model weights are updated, the corresponding caches must be invalidated.
Eviction Policies
Cache space is finite. Common eviction methods include:
- LRU (Least Recently Used): evict prefixes that have not been hit for the longest time first.
- Frequency statistics: keep high-frequency prefixes based on hit counts.
- Generational management: store short-lived, single-task caches separately from long-lived, stable system-prompt caches.
LRU has one risk: high-frequency short-term requests can evict the cache for long system prompts. If your core prefix is long, consider pinning it or using generational management.
Running the Numbers with a Coding Assistant
The figures below are hypothetical prices chosen to illustrate the calculation method; they do not represent any vendor’s actual pricing. Assumptions:
- Cache-miss input price: 2 CNY per million input tokens
- Cache-hit price: 0.5 CNY per million tokens at launch, 0.05 CNY per million tokens after the price cut
- Total input per turn: 5K tokens, of which the first 4.5K are a stable prefix (system prompt, repo structure, file contents) and the last 0.5K are new modification instructions
- Input costs only; output tokens excluded
Results:
| Scenario | Calculation | Input Cost per Turn |
|---|---|---|
| All cache miss | 5000 ÷ 1,000,000 × 2 | 0.01 CNY |
| Prefix hit (after price cut) | 4500 ÷ 1,000,000 × 0.05 + 500 ÷ 1,000,000 × 2 | ~0.001225 CNY |
With a prefix hit, the cost is roughly one-eighth of the all-miss cost. This ratio reflects only the assumed prices and input structure in this example. Actual savings depend on prefix length, hit rate, and how much new content each turn adds.
What Developers Can Check
Cache-Friendliness Checklist
- Prefix length: the share of the request occupied by stable content.
- Prefix reuse frequency: how often the same prefix is called within a short window.
- Dynamic suffix share: the smaller the per-turn additions, the greater the savings from hits.
- Version change frequency: the more often system prompts and tool definitions change, the more easily the cache is invalidated.
- Hit rate: measured via the cache-hit fields returned by the API.
Integration Checklist
- Confirm that cache-related parameters or request headers are enabled on your requests; refer to the vendor’s documentation for the exact fields.
- Verify that the prefix is token-by-token identical, especially whitespace, line breaks, and JSON field ordering.
