Why LLM Inference Costs Keep Falling: A Practical Guide to Token Pricing, Caching, and Scheduling
This article breaks down why large language model inference prices keep dropping and what it means for engineering teams. Using a recent price adjustment as an example, it shows how per-million-token pricing now varies by cache hit, cache miss, output, and time of day, then turns that structure into an actionable cost model. You will learn how sparse attention and prefix reuse, quantization, and better scheduling and batching lower the three price tiers; how peak and off-peak pricing turns load into a schedulable resource; why byte-stable prefixes and observable hit rates decide the bill under a 50x spread between hit and miss input; and how trimming input context and constraining output length cut token volume. It closes with a four-step process for validating optimizations against both cost and quality.
1. The Signal: Unit Token Prices Have Entered the “Cent” Era
Over the past year, the billing unit for LLM inference has been compressed again and again. Take one recent price adjustment on a major platform: during off-peak hours, per million tokens, cached input dropped from 0.05 CNY to 0.02 CNY (about 60% lower), uncached input fell from 1.5 CNY to 1 CNY (about 33% lower), and output fell from 4.5 CNY to 4 CNY (about 11% lower). Peak-hour rates are double the off-peak rates for every category.
These numbers carry a lot of information and deserve to be unpacked one by one.
First, the reductions form a clear gradient: cached input was cut hardest, uncached input next, output least. Second, there is roughly a 4x gap between input and output. Third, the same request can cost twice as much depending on when it is issued. Put together, the three observations say one thing: inference cost is no longer a static “one model, one price” problem. It is a dynamic problem determined jointly by cache structure, token composition, and the moment of the call.
For developers, this shifts the focus of cost optimization from “pick a cheaper model” to “get requests served in a lower-cost structure.”
2. Cost Model: Break the Bill Into Variables You Can Act On
To optimize, model first. The input side of a conversational request usually has three parts: the system prompt and tool definitions (long-lived and stable), retrieved or historical context (semi-dynamic), and the current user turn (fully dynamic). The output side is the tokens the model generates. Written as an approximation:
cost per call ≈ cached input rate × cached tokens+ uncached input rate × uncached tokens+ output rate × output tokens
The formula exposes three levers: raise the hit ratio, shrink the uncached prefix, and control output length. Time-of-day pricing multiplies the whole expression by a time factor, which adds a fourth lever: move deferrable load into off-peak windows.
The input/output price gap is not accidental. Input-side computation can be reused heavily (the attention intermediate states of an identical prefix can be cached), while the output side must be generated autoregressively token by token and is hard to reuse. The gap is essentially a price on “reusability.” Once you see that, it makes sense why a cache hit can be as cheap as 0.02 CNY: it saves not only compute but also queueing and scheduling overhead.
3. Architecture: Where the Reductions Come From
New architectures can usually cut all three tiers at once because several general-purpose techniques stack, not because of a single breakthrough.
The first is sparsification and prefix reuse. If the intermediate states of a history prefix can be reused reliably, the marginal cost of long context drops sharply; combined with sensible pruning of the attention computation range, wasted computation can be reduced with little effect on quality.
The second is lower precision and quantization. Reducing the storage precision of weights and cache states directly cuts memory footprint and bandwidth pressure, which raises how much concurrency a given piece of hardware can carry. As concurrency rises, the fixed cost amortized per token falls.
The third is scheduling and batching efficiency. Pooling short and long requests separately, and deploying the prefill and decode stages separately, keeps long requests from blocking short ones and lifts overall throughput. This is the key to “serving more requests on the same hardware.”
To be clear: these are industry-standard paths. Implementation details differ by provider, and results depend on the shape of your workload, so no fixed number should be copied blindly.
4. Time-of-Day Pricing: Treat Load as a Schedulable Resource
Charging double at peak and half off-peak is, in essence, using a price signal to shave peaks and fill valleys. In engineering terms, it requires an executable scheduling policy:
- Task tiering: split requests into online interaction (latency-sensitive), near-line tasks (minutes acceptable), and offline tasks (hours acceptable).
- Queue isolation: send offline tasks to a separate queue and run them in batches during low-demand windows so they do not compete with online traffic.
- Timeout and retry budgets: give offline tasks looser timeouts and use exponential backoff for retries, so pressure is not added in the wrong direction during peaks.
- Result caching: for idempotent offline tasks, cache results by content fingerprint and return repeats directly.
A simplified routing sketch:
def route(task):if task.latency_slo_ms is not None:return "online_pool" # peak rate, protect latencyif task.deadline_hours <= 6:return "nearline_pool" # schedule opportunisticallyreturn "offline_pool" # off-peak batch, off-peak rate
As a rule of thumb, if offline work accounts for more than about 30% of traffic, the drop in total inference spend is fairly noticeable. The exact magnitude depends on how much timing flexibility the business has, so always validate against your own load-test data.
5. Caching: The Most Sensitive Lever Under the New Price Structure
With a 50x gap between hit and miss input (0.02 vs 1.0), caching goes from a nice-to-have to the switch that decides the bill. A few engineering points matter.
First, the prefix must be byte-for-byte stable. Embedding a timestamp, a random request ID, or a fluctuating user nickname in the system prompt invalidates the prefix and degrades the entire context to a cache miss. The standard practice is to push variable content to the end:
[stable prefix] role setup + tool definitions + domain rules + a few fixed examples[semi-stable] retrieved snippets (organized by document version)[dynamic] current user turn + new content within the session
Second, hit rate must be observable. Instrument the client to record cached tokens, uncached tokens, and output tokens per request, build a cost dashboard split by business line, and alert on sudden hit-rate drops. A falling hit rate usually means a template was changed or an upstream field started to drift.
Third, watch out for “fake caching gains.” If you stuff large amounts of irrelevant content into the prefix just to force a hit, the hit rate is low-priced but total token volume inflates, and total cost may actually rise. The judgment criterion is always the total bill, not the unit price.
6. Optimizing Input and Output Structure
Beyond unit price, token count is a lever that operates an order of magnitude larger.
On the input side: compress retrieved snippets and truncate by relevance instead of concatenating everything; summarize long documents into structured form before adding them to context; replace full replay of every turn with rolling summaries of the conversation history.
On the output side: constrain generation length and state explicitly “at most N items, each at most M words”; use constrained decoding for structured results to cut filler; keep the intermediate “think before answering” process within what is necessary.
A before/after sketch:
Before: system prompt 1800 tokens + 5 retrieved snippets, 4200 tokens + 3000 tokens of historyAfter: system prompt 900 tokens (floating fields removed) + 2 snippets, 1100 tokens + 600-token rolling summary
Uncached tokens fall from roughly 9000 to roughly 2600. Even with an unchanged hit rate, input spend drops by about 70%.
7. Make Optimization a Verifiable Process
Move forward in four steps rather than tuning by feel.
Step 1, establish a baseline. Sample real traffic for a week and measure the input/output token distribution, the time-of-day distribution, and the current hit rate.
Step 2, run single-variable experiments. Change one thing at a time (prefix stability, number of retrieved snippets, output cap, scheduling policy) and watch two curves: total cost and quality metrics.
Step 3, guard quality. Cost optimization must not come at the price of collapsing quality. Keep a fixed evaluation set, set a quality-degradation threshold, and roll back as soon as it is tripped.
Step 4, review routinely. Prices and architectures both change, so revisit the cost model monthly and sync the new price structure into scheduling and caching policies.
8. Closing
When cached input, uncached input, output, and time of day each carry an independent price, cost governance stops being a procurement problem and becomes an engineering problem. Reusable prefixes, lean context, restrained output, and off-peak scheduling: do these four things solidly and the drop in the bill is structural rather than one-off. In its own practice, Baidu AI Cloud also stresses keeping cost metrics and quality metrics on the same dashboard for continuous observation, which is what makes optimization hold steady over time.
