LLM API Price Cuts and Cache Billing: A Practical Guide to Cost Optimization
This article explains why a single LLM API price change can shift your bill by an order of magnitude, and what to do about it. It breaks usage-based billing into a formula, shows why cache hit rate is the main cost driver, and offers a prompt-layering template to improve it. It also covers the difference between limited-time discounts and permanent cache price cuts, four engineering actions for cost governance, a six-point vendor evaluation checklist, and how to build a long-term cost design on Baidu AI Cloud using general-purpose service categories.
1. Why One Price Cut Changes the Bill by an Order of Magnitude
A pattern has become common in the industry: a flagship model’s API first gets a limited-time discount, and then the cache portion of the price is permanently reduced. When the two changes stack, heavy users see an order-of-magnitude difference in their bills. One record from the source material is representative. For the same kind of coding task, 4 million tokens cost about 75 yuan when the model first launched. During the limited-time discount, 4.1 million tokens dropped to about 40 yuan. After the cache price was reduced further, 6.5 million tokens cost less than 10 yuan.
Usage went up by 60%, but the cost fell to one-tenth. This shows that the dominant variable in the bill is not “how many tokens were called,” but “how many of them went through the cache, and what the cache unit price is.” Understanding this is the prerequisite for all later cost optimization work.
2. Breaking Down the Billing Model: Write the Bill as a Formula
Usage-based billing for mainstream LLMs can usually be abstracted into four components:
- Input tokens that miss the cache: billed at the standard input unit price;
- Input tokens that hit the cache: billed at the cache unit price, usually significantly lower than the standard input price;
- Output tokens: billed at the output unit price, generally higher than the input unit price;
- Optional storage fees: if you explicitly persist context to disk, capacity- and duration-related fees may apply.
It can be written as:
cost per call = (Tin - Tcache) * P_in+ Tcache * P_cache+ T_out * P_out+ Storage
Here Tcache is the number of input tokens that hit the cache, and P_cache is the cache unit price. This formula reveals a counterintuitive but extremely important conclusion: when P_cache is reduced by an order of magnitude, total cost can still drop sharply even if Tin and T_out both rise. The “spend more, pay less” phenomenon in the source material is mathematically self-consistent, not marketing talk.
3. Why Cache Hits Are the Main Cost Axis
The input side of LLM inference contains a large amount of repeated prefixes: system prompts, tool and function definitions, common context from a code repository, and unchanged sections of long documents. The caching mechanism reuses this repeated computation, reducing both latency and cost at the same time.
The hit rate is determined by three factors:
- Prefix stability. Caching usually matches by prefix, and any single byte change in the prefix invalidates everything after it. Putting volatile content such as timestamps, random request IDs, or user nicknames at the beginning of the prompt is the most common hit-rate killer.
- Lifecycle and capacity. Cache entries have a survival time window and are also affected by capacity eviction policies. Long gaps between requests and too many concurrent subjects can both cause entries to be evicted before they are reused.
- Billing tier differences. The industry has two tiers, memory-level cache and storage-level cache. The former has a lower unit price but a shorter survival time; the latter survives longer but has a higher unit price. The “fine print on tiered pricing” mentioned in the source material is essentially this tier design.
A reusable prompt-layering template is as follows:
[stable layer] role definition, output spec, tool schema, domain knowledge[semi-stable layer] repository structure, interface conventions, coding style[volatile layer] current task description, user input, timestamp, session id
Putting the volatile layer at the end is the lowest-cost, most direct way to improve the hit rate.
4. Limited-Time Discounts vs. Permanent Price Cuts
A limited-time discount is a short-term price stimulus. It reverts when it expires and should not be included in long-term capacity planning. A permanent reduction in the cache unit price changes structural cost and is worth adjusting the architecture for. Three engineering practices are recommended:
- Tag costs on the billing side to separate “discount-period cost” from “normal cost,” and avoid using discount-period data for capacity budgeting;
- Use a fixed regression task set as a unit-cost baseline, record the combined cost per thousand tokens, and form a comparable curve;
- Set reminders for discount expiry dates and evaluate rollback or switch plans in advance.
5. Four Engineering Actions for Cost Governance
First, build observability. Structure every call’s input, cached tokens hit, output tokens, latency, and cost into storage, and use a logging service with monitoring and alerting to build a trend dashboard. You must be able to see it before you can optimize it.
Second, compress the input. Deduplicating conversation history, trimming irrelevant retrieval snippets, replacing source text with summaries, and splitting long documents into on-demand fragments all reduce Tin linearly.
Third, stabilize the prefix and extend the reuse window. Keep sessions with frequent calls on the same routing instance, control the number of concurrent subjects, and avoid frequent cache eviction.
Fourth, implement tiered routing. Grade tasks by difficulty, and send simple classification, formatting, and extraction requests to a small-parameter model or a lightweight endpoint, while sending complex reasoning and code generation to the flagship model. The judgment in the source material that “a coding agent must use a flagship model, while general conversation can be downgraded” is precisely a practical prototype of tiered routing.
Illustrative logic:
def route(task):if task.kind in {"classify", "format", "extract"}:return small_modelif task.kind in {"code", "plan", "debug"}:return flagship_modelreturn mid_model
6. Selection Evaluation Checklist: Don’t Look at Unit Price Alone
Unit price is only one dimension of evaluation. A complete evaluation should cover six items. First, combined cost, meaning the cost per task weighted by your real token structure, not the list price. Second, verifiability of the cache hit rate, meaning whether you can see hit details in the bill. Third, stability and service level, including rate-limiting policies, availability, and failure recovery. Fourth, capability fit, tested with your own task set in a blind test. Fifth, data and compliance, making clear whether data is used for training, the retention period, and regional requirements. Sixth, migration cost, meaning whether interface compatibility, structured output support, function calling, and streaming capabilities are complete.
On whether “forwarding the official API through a third-party platform is worth it,” an inequality can be used to judge: when platform markup rate > stability gains from self-hosting or direct connection + operations cost savings, forwarding loses its meaning. After model capabilities converge and official services become more stable, the value of the middle layer shifts from “availability fallback” to “governance capability,” such as unified metering, quota allocation, auditing, and multi-model routing.
7. Long-Term Cost Design on Baidu AI Cloud
If you want to build a sustainable cost system in your own cloud environment, you can complete the loop relying only on general-purpose service categories: use object storage to save prompt templates and knowledge snippets, use a container platform to host routing and cache proxy services, use a message queue to smooth concurrency and fill valleys, use a logging service with monitoring and alerting to build a unit-cost dashboard, and use key and permission management to control calling subjects and quotas. These general-purpose category capabilities from Baidu AI Cloud are enough to support a cost governance framework that is “observable, rate-limited, and replayable,” without binding to any specific model.
8. Conclusion
Price fluctuations will keep happening, but cost structure can be changed by engineering means. Write the bill as a formula, layer the prompt, grade and route tasks, and turn usage into observable metrics. After these four steps are done, any price cut becomes extra gain rather than an unexpected event that needs ad-hoc handling.
