LLM Inference Pricing Adjustments and Cache Cost Analysis
Recent adjustments to Large Language Model (LLM) inference pricing have sparked discussions, particularly regarding the noticeable increases in output and cache miss token prices, while cache hit prices remain moderate. Although surface-level pricing suggests a general price hike, the effective cost per token varies significantly depending on workload characteristics such as cache hit rates and input-to-output ratios. This article explores the mechanics behind three-tier pricing models, introduces a mathematical model for calculating effective token costs, and provides actionable strategies for optimizing cache hit rates and managing output costs to achieve better cost efficiency.
Recent pricing adjustments for Large Language Model (LLM) services have sparked significant discussion. Specifically, the unit price for output tokens has risen noticeably compared to the previous generation, prices for cache misses on input tokens have increased in tandem, and the price for cache hits has seen a relatively moderate adjustment. Looking only at the price tag might lead to the conclusion that costs have universally increased. However, analyzing the billing structure and workload characteristics reveals that the “effective unit price” can vary drastically among different users. This article does not tie itself to any specific vendor’s pricing but uses a hypothetical set of prices to illustrate the cost mechanism: cache hit at 1, input miss at 20, and output at 100 (currency units per million tokens). Through these parameters, the relationship between cache hit rate, input/output ratio, and overall cost becomes much clearer.
1. The Essence of Three-Tier Pricing: Breaking Down Inference Costs into Observable Stages
LLM inference typically consists of two phases: input processing and output generation. The input processing phase encodes the context into an intermediate representation. If the same prefix is reused multiple times, repeated computation can be reduced through cache hits. The output generation phase decodes tokens step-by-step, where computation and memory access occur continuously, making the cost harder to amortize. Therefore, the three-tier pricing—cache miss, cache hit, and output—essentially charges for different resource consumption patterns.
In our hypothetical pricing model, the cache hit cost is 1 and the cache miss cost is 20, a 20x ratio. The output cost is 100, which is 100 times the cache hit cost. Compared to earlier pricing structures, the cache hit tier is relatively gentle, while the output tier has seen a more pronounced increase. This conveys two signals: First, service providers aim to encourage stable prefixes and context reuse to lower repeated prefill costs. Second, output capacity remains a scarce resource; long outputs, complex reasoning, and multi-turn tool calls will significantly drive up costs. Developers must look beyond “cost per million tokens” and understand how much of their traffic actually hits the cache and what proportion is output.
2. The Effective Unit Price Model: Why the Same Model Can Incur Multiple-Fold Cost Differences
Let h be the cache hit rate, p_miss the cache miss unit price, p_hit the cache hit unit price, p_out the output unit price, I the number of input tokens, and O the number of output tokens. The effective input unit price is:
p_in_eff = p_hit h + p_miss (1 - h)
The overall cost per million tokens is:
C = (I p_in_eff + O p_out) / (I + O)
Using the hypothetical prices (p_miss=20, p_out=100), let’s examine two scenarios. Scenario A: An enterprise-level AI agent with an input/output ratio of about 20:1 and a cache hit rate of 90%. If we use a conservative hypothetical cache hit price of 2, the effective input unit price is 2 0.9 + 20 0.1 = 3.8. The overall cost is approximately (20 3.8 + 1 100) / 21 ≈ 8.4 currency units per million tokens. Scenario B: An individual developer with sporadic usage, different prompts each time, an input/output ratio of 5:1, and a cache hit rate of 20%. The effective input unit price is 2 0.2 + 20 0.8 = 16.4. The overall cost is approximately (5 16.4 + 1 100) / 6 ≈ 30.3 currency units per million tokens. The difference between the two is about 3.6 times.
This demonstrates that a nominal price adjustment does not mean all users’ costs rise proportionally. Enterprise workloads characterized by high reuse, long contexts, and stable system prompts can significantly amortize input costs through cache hits. Conversely, workloads with low reuse, short sessions, and frequently changing prompts will see costs closer to the original cache miss price, with output costs taking a higher proportion. If retries, tool call backfilling, context bloat, and failed reruns are factored in, the actual gap may widen further.
def effective_cost(p_hit, p_miss, p_out, input_tokens, output_tokens, hit_rate):input_eff = p_hit * hit_rate + p_miss * (1 - hit_rate)total_tokens = input_tokens + output_tokensreturn (input_tokens * input_eff + output_tokens * p_out) / total_tokens# Enterprise AI agent: input/output ratio 20:1, hit rate 90%print(effective_cost(2, 20, 100, 20, 1, 0.9)) # Approx. 8.4# Individual developer: input/output ratio 5:1, hit rate 20%print(effective_cost(2, 20, 100, 5, 1, 0.2)) # Approx. 30.3
3. The Source of Cache Hit Rates: Engineering Structure Matters More Than “Luck”
High cache hit rates rarely happen naturally; they are the result of careful prompt and context engineering. Common practices include placing stable system prompts, tool definitions, and output format constraints at the beginning of the context, while placing dynamic user inputs, retrieval results, and temporary states at the end. It also involves versioning tool schemas to avoid minor variations in every request, retaining reusable prefixes for multi-turn conversations, and implementing layered indexing for codebase contexts to separate stable layers from variable layers. General technical solutions like separated inference architectures, cache pooling, and routing affinity also help improve cache reuse efficiency.
A “prompt layering” pseudo-structure can be established in engineering:
Stable layer: System role + Security rules + Tool Schema + Output formatSemi-stable layer: Project background + Codebase index summary + Long-term memoryDynamic layer: Current user question + Real-time retrieval results + Temporary tool returns
Keeping the stable layer at the front and version-stable, and placing the dynamic layer at the back, minimizes prefix changes. Caching also requires attention to TTL, invalidation strategies, multi-tenant isolation, and privacy boundaries: more cache isn’t always better, as expired content, cross-tenant contamination, and residual sensitive information pose risks. It is recommended to monitor cache hit rate, input/output ratio, average output length, retry rate, and cost per task, attributing costs to business lines or tenants. On Baidu AI Cloud, this observation pipeline can be built using a general-purpose container platform, logging services, and monitoring alerts.
4. Low-Reuse Workloads: Output Control as a Direct Cost-Reduction Measure
For workloads with low cache hit rates, the optimization space on the input side is limited, making the output side more worthy of attention. Long outputs not only carry a high unit price but also increase the subsequent context length, creating a chain reaction of costs. In practice, you can limit the maximum output tokens, require structured short outputs, prioritize returning summaries and citations to avoid unconstrained expansion, cache results for repeated questions, merge batch tasks, and fix few-shot examples. Where quality is acceptable, using a smaller model or hierarchical routing is also viable. It is important to note that compressing output should not sacrifice correctness and auditability; quality should be validated through evaluation datasets.
5. Selection Advice: Calculate the “Effective Unit Price” Using Real Traffic
Faced with pricing adjustments, enterprises should not merely compare nominal prices. Instead, they should collect real traffic data for cost estimation: track the input/output ratio, cache hit rate, average output length, retry rate, number of tool calls, and failure rate. Use the effective unit price model to calculate the Total Cost of Ownership (TCO), stress-test cache hit and routing strategies, and evaluate SLAs, security compliance, and observability capabilities. For high-reuse AI agent scenarios, improving the cache hit rate by 10 percentage points may be more effective than simply switching to a lower-priced tier. For low-reuse scenarios, prioritizing output and retry control is key. The conclusion is that what appears to be a “universal price increase” is actually the billing structure re-stratifying based on workloads. Long-term stable enterprise customers with prefix reuse get closer to discount prices, while developers with frequently changing prompts and short, sporadic sessions pay closer to the original or even a premium price. Understanding the effective unit price is essential for making rational technical selections and managing costs effectively.
