Why Are LLM Bills Exploding? A Complete Guide to AI Cost Governance
A practical breakdown of why large language model bills rise even when traffic stays flat, and how to control them. The article explains the multiplicative billing factors behind each request, the three-part token structure of input, output, and reasoning tokens, prefix caching as the largest single cost lever, tiered model routing, per-million-token price samples used only to illustrate the calculation method, the hidden amplification from tool calls, retrieval, and retries, and the observability loop needed to sustain savings. Readers get a cost estimation function, concrete engineering requirements for cache stability, and a prioritization order for optimization: caching first, routing second, output constraints third, and retry governance as the fallback.
1. The Symptom and the Real Cause of a Surging Bill
Many teams see the same thing after launching an LLM application: call volume has not grown noticeably, and may even have dropped because of rate limiting, yet the monthly bill has multiplied. Break the bill apart and it becomes clear that cost is not driven by a single variable such as “number of requests.” It is pushed up by a set of billing factors that stack on top of each other. Understanding this is the first step in cost governance.
More precisely, the real cost of a single request is determined by all of the following:
- Number of input tokens
- Number of output tokens
- Ratio of cache-hit tokens to cache-miss tokens
- Multiplier applied for long context
- Consumption of reasoning (thinking) tokens
- Number of tool calls and external retrieval calls
- Whether the model routing strategy is sound
- Failure retry rate
These factors combine multiplicatively, not additively. If any one of them gets out of control, the later stages amplify it. For example, stuffing large blocks of redundant background into a prompt can double the input tokens; longer input lowers the cache hit rate; the cache miss then stacks with the long-context multiplier; add one failure retry on top, and the cost of a single request can end up more than ten times the original estimate. That is the mathematical nature of a “surging bill.”
2. Token Structure: The Three-Part Cost of Input, Output, and Reasoning
The traditional view is that cost equals word count multiplied by unit price. Under current mainstream billing models, however, tokens need to be viewed as at least three separate segments.
The first segment is input tokens, which include the system prompt, conversation history, retrieved document fragments, and tool return values. Their defining trait is that they expand without being noticed: accumulating history across many turns, retrieving results without truncation, and packing many examples into the system prompt all keep the input growing.
The second segment is output tokens. Their unit price is usually significantly higher than input, which makes them the main amplifier of the bill. In business terms, this shows up as the model “writing too much”: asking for a complete report, asking for point-by-point explanations, asking for formatted content to be repeated. Governance measures include constraining the output structure, limiting length, and splitting long-form generation into multiple segments returned as a stream.
The third segment is reasoning tokens, the consumption the model uses for internal thinking before producing an answer. They are billed on the output side and can far exceed the length of the final visible answer. For simple classification, extraction, and rewriting tasks, enabling high-intensity reasoning is pure waste; for complex code and multi-step agent tasks, it is a necessary cost of quality. The key is to set reasoning intensity by task difficulty tier rather than globally.
The illustrative cost estimation logic can be written as:
def estimate_cost(in_tok, out_tok, think_tok, cache_hit_tok, long_ctx_multiplier):# Unit prices are illustrative only; refer to the provider console for actual valuesprice_in, price_out, price_cache = 5.0, 30.0, 0.5billable_in = in_tok - cache_hit_tokcost = (billable_in * price_in+ cache_hit_tok * price_cache+ (out_tok + think_tok) * price_out) / 1_000_000return cost * long_ctx_multiplier
3. Caching: The Most Underrated Cost Lever
The unit price of a cache-hit token is often only about one tenth of a cache miss, which makes caching the single largest optimization lever. Whether a cache is hit, however, depends on the request prefix being byte-for-byte stable.
Engineering practice imposes a few hard requirements: the system prompt and tool definitions must come first and must not have timestamps, random IDs, or usernames dynamically concatenated into them; conversation history should be appended to rather than rewritten; retrieved fragments should be concatenated in a fixed order without a randomized reranking on every call; and the expiration window must cover business peaks so that frequent invalidation does not cause repeated billing.
A common anti-pattern is putting the “current time” at the start of the system prompt, which makes the prefix of every request different and invalidates the cache entirely. The correct approach is to place dynamic content at the end.
4. Model Routing: From a Single Model to a Tiered System
A mature LLM system should not rely on one model, but should have a model tiering and cost routing system. The basic idea is to tier tasks by difficulty: intent recognition, format conversion, and simple Q&A go to lightweight, low-cost models; summarization and ordinary generation go to mid-tier models; complex reasoning, long-chain agents, and business-critical work go to high-capability models. Routing decisions can be made by rules, a small classification model, or confidence thresholds, with a manually configurable forced-override switch kept available.
It is worth stressing that routing is not a one-time configuration but a policy that needs continuous tuning: monitor the actual call share, escalation rate, and failure rate of each tier to avoid the hidden degradation where “every request gets escalated to the most expensive model.”
5. Price Samples: Treat Current Models as Samples, Not Permanent Conclusions
The prices in the table below only illustrate the calculation method, in units per 1 million tokens; refer to the provider console for actual values:
| Model tier | Input price | Cache-hit price | Output price | Suitable scenarios |
|---|---|---|---|---|
| Flagship | $5.00 | $0.50 | $30.00 | Highly complex reasoning, agents, code, business-critical work |
| Lightweight | $0.75 | $0.075 | $4.50 | Medium tasks, summarization, ordinary generation |
| Long-task | $5.00 | $0.50 | $25.00 | Long context, complex code, agent workflows |
| Multimodal | $2.00 / $4.00 | $0.20 / $0.40 | $12.00 / $18.00 | Multimodal, long context |
| High-concurrency | $0.50 | $0.05 | $3.00 | Customer service, classification, light reasoning |
Models iterate quickly, so specific unit prices will change, but the analysis method of “input / output / cache / routing” holds up over the long term.
6. Hidden Amplification from Tool Calls, Retrieval, and Retries
Tool calls and search calls are billed per call, and each one turns the tool’s return content into input tokens for the next round, creating a second-order amplification. Governance means limiting the number of tools per round, summarizing and compressing returned results, and setting a maximum number of loop steps and an overall budget cap.
The failure retry rate is the most easily overlooked multiplier. Timeouts, rate limiting, and non-compliant content formats all trigger retries, and a single business request may consume three to five model calls. Distinguish “retryable errors” from “deterministic errors”: for the latter, fail directly and fall back to a smaller model, and use monitoring alerts and logging services to locate the root cause of a retry spike.
7. Observability and the Governance Loop
Cost governance must be built on observability: tag and instrument by business line, scenario, and model tier; collect input and output tokens, cache hit rate, reasoning tokens, retry counts, and cost per request; and configure budget alerts and quotas. If you use the relevant capabilities of Baidu AI Cloud, you can build this loop together with general cloud products such as monitoring and alerting and logging services.
The resulting governance rhythm is: quantify first, then locate the largest cost item, then optimize in the order of “caching first, routing second, output constraints third, retry governance as the fallback,” and use A/B testing to verify whether quality has been affected.
