LLM API Pricing Increases: The Compute Logic and Cost Optimization Strategies
This article explains why large language model API prices are rising by examining compute supply constraints, inference cost structures, and billing models. It breaks down why output tokens cost more than input tokens, why subscription plans and pay-as-you-go APIs feel different in practice, and how prompt caching can cut costs by up to twentyfold. You will also find architecture practices such as model tier routing, semantic caching, streaming with budget limits, and cost observability, along with advice on running small-scale tests to estimate monthly spending.
Introduction: Why API Pricing Matters to Developers
A recent release of a general-purpose LLM service adjusted its API pricing to 20 RMB per million input tokens, 100 RMB per million output tokens, and 1 RMB per million cached tokens, roughly a fivefold increase over the previous generation. The change has sparked broad discussion in developer communities. To assess it rationally, pricing needs to be examined across three dimensions: compute supply, inference cost structure, and the billing model, rather than stopping at a surface-level comparison of how much more expensive it became.
1. The Compute Supply Logic Behind the Price Increase
LLM inference is a resource-intensive workload. A single request must load billions to hundreds of billions of parameters into GPU memory and continuously occupy compute and bandwidth resources during the decoding phase. When training clusters and inference clusters compete for the same pool of accelerators, available compute on the inference side is significantly squeezed. This is a constraint the industry broadly faces, including model vendors in China.
From a cost structure perspective, the output phase uses autoregressive token-by-token generation, which cannot be highly parallelized the way the input phase can. The compute cost per token is inherently higher. This explains why the output unit price is typically several times the input unit price. When overall compute supply is tight, vendors using price signals to regulate demand is a passive choice that follows market rules, not merely a commercial strategy.
2. Why the Suggested Retail Price Differs from the Actual Experience
Many platforms offer both subscription-based coding plans and pay-as-you-go APIs. Subscriptions exchange a fixed monthly fee for a certain quota, while APIs are billed on actual usage. The two target different scenarios but are measured against the same yardstick in developers’ minds, creating a perception gap.
The first reason for the gap is the difference in how generous the quotas are. Due to compute constraints, coding plan quotas from Chinese vendors are generally less generous than those of leading overseas offerings. Users hit the ceiling quickly in high-intensity coding scenarios, pushing up the effective unit cost and rapidly narrowing the gap with the API list price.
The second reason is how quota pools are divided and reset. Some overseas offerings split general conversation and code execution into two separate quota pools and periodically reset weekly quotas, so heavy users actually get far more usable capacity than the surface numbers suggest. Comparing only list prices while ignoring the “hidden subsidy” in quota supply inevitably leads to a distorted conclusion.
The third reason is how caching is priced. The new pricing lists cache hits as a separate tier: the hit portion is extremely cheap, while the miss portion is billed at the standard input price. This means the real bill depends heavily on request repetition and how context is organized. The same workload can differ by an order of magnitude in cost under different implementations.
3. Cache Hit Pricing: An Undervalued Cost Lever
The cache hit unit price is only about one-twentieth of the standard input price, making it the lever most worth developers’ attention in the entire pricing scheme. The principle is that when a request prefix (system prompt, tool definitions, long documents, code context) matches historical requests, the server can reuse the already-computed intermediate state and skip redundant forward computation.
To capture this benefit in engineering practice, follow three principles:
- Stable prefix: Put unchanging content at the very front of the prompt and variable content at the end, avoiding dynamic fields such as timestamps or random identifiers that break prefix consistency.
- Context convergence: Control the length of history concatenated into the context, using summary compression and retrieval recall instead of stuffing everything in.
- Batch homogeneity: Aggregate similar requests to increase the reuse count of the same prefix.
An illustrative way to organize requests:
SYSTEM_PREFIX = "You are a senior code assistant. Follow these guidelines: ..." # Stable prefix, helps with cache hitsdef build_request(user_query, repo_context):# Put variable parts at the end to keep the prefix byte-for-byte identicalreturn {"messages": [{"role": "system", "content": SYSTEM_PREFIX},{"role": "user", "content": f"Context:\n{repo_context}\n\nQuestion:{user_query}"}]}
4. Architecture Practices for Cost Control
Facing rising prices, architecture-level optimization is more effective than price negotiation.
First, model tier routing. Classify tasks by complexity: intent recognition, format conversion, and simple classification go to smaller models or a rules engine, while the flagship model is called only for complex reasoning and long-chain code generation. This significantly lowers the average unit price while maintaining quality.
Second, front-load semantic caching. Introduce vector retrieval on the application side to return historical results directly for highly similar repeated questions, preventing requests from reaching the model. The hit rate generally rises with business repetition.
Third, streaming output with budget circuit breakers. Use streaming responses to improve the interaction experience, and set a per-session token budget and timeout circuit breaker to prevent runaway bills from abnormal loops.
Fourth, build observability. Use monitoring, alerting, and logging services to create dashboards for token consumption, cache hit rate, and per-request cost, and incorporate cost as a first-class metric into the release process.
5. Cost Estimation and Selection Advice
Teams are advised to run a small-scale canary test with real business samples, measure the input/output token distribution and potential cache hit rate, then plug them into a unit price model to estimate monthly spending. Evaluation dimensions should not be limited to unit price but should also include quota supply, rate-limiting policies, context window, tool-calling capability, and data compliance requirements.
In general engineering practice on cloud platforms such as Baidu AI Cloud, it is common to combine a container platform to host the inference gateway, object storage to save context snapshots, a message queue to smooth request peaks, and logging and monitoring services for cost attribution, thereby maintaining architectural flexibility and cost transparency without binding to a specific model.
Conclusion
A severalfold price increase is a direct mapping of the compute supply-demand relationship onto pricing. What developers can truly control is how requests are organized, model routing strategy, and cost observability. Only by fully using cache hits, converging context, and implementing tiered routing can you maintain predictable unit costs during a period of rising prices.
