Why LLM Token Costs Keep Rising—and How to Cut Them
As AI hardware becomes affordable but inference bills keep climbing, this article explains why frontier model output prices have stayed near $60 per million tokens over two years, breaks monthly costs into optimizable components, and presents seven practical levers: prefix and semantic caching, model tiering with routing, context compression, batch processing, output length control, retry and idempotency handling, and observability. It also outlines a reference architecture, a four-step rollout plan, common pitfalls, and acceptance metrics for running cost-efficient agents in production.
1. The Problem: Hardware Is Affordable, Tokens Are Not
The clearest shift in the industry over the past two years is that teams can afford the hardware but not the inference. Buying a batch of accelerators is a one-time capital expense; calling frontier models is metered operating expense that keeps flowing out. The former depreciates on a fixed schedule; the latter grows linearly—or worse—with usage. One comparison from the original observation stands out: when frontier models first appeared, output-side pricing was about $60 per million tokens. Two years later, the new flagship tier still sits at the same order of magnitude. Capability keeps rising, but unit price has barely fallen.
This is not because vendors are unwilling to cut prices. It is the inevitable result of cost structure and pricing logic:
- The marginal cost of frontier models is dominated by inference. Output tokens are generated autoregressively, one by one, consuming far more compute and memory bandwidth than input.
- What users actually buy is “the best brain available right now.” High-quality tiers hold pricing power, and prices are anchored to willingness to pay rather than hardware cost.
- Demand has made a structural jump. Agents turn “a single question” into “multi-step loops,” and token consumption has grown by three orders of magnitude in two years.
- Supply is tightening at the same time. High-bandwidth memory prices are rising: one category of server memory rose more than 50% quarter over quarter in Q1 2026, and flash-based media saw increases of nearly 150% at the high end. Long-term procurement agreements from leading vendors are already locked in for five years out.
The conclusion is clear: do not expect lower unit prices to rescue your bill. Cost reduction must come from engineering improvements in effective output per unit.
2. Cost Model: Break the Bill into Optimizable Parts
A practical approximation model looks like this. It splits “expensive” into four variables you can act on:
Monthly cost ≈ Σ(requests × avg input tokens × input price)+ Σ(requests × avg output tokens × output price)+ retry and failure amplification factor+ overhead for caching/retrieval/logging, etc.
Prioritize optimization by “benefit / rework cost”: start with the amplification factor and repeated input (cheapest to change), then model tiering (requires a quality baseline), and finally context compression and inference parameter tuning (requires an evaluation set).
3. Seven Cost-Reduction Levers
1. Prefix Caching and Semantic Caching
Keep stable prefixes—system prompts, tool definitions, long documents—at the very front so they can be reused instead of being billed every turn. For frequent, similar questions, add a semantic cache that returns on a hit. Version your caches so that any prompt or knowledge change invalidates them wholesale, preventing “dirty data” from cost-cutting.
2. Model Tiering and Smart Routing
Use lightweight models for classification, extraction, formatting, and rewriting; escalate to the flagship tier only for multi-step reasoning, code generation, and complex attribution. Routing criteria can include task type, input length, confidence, and historical failure rate.
def route(task):if task.kind in {"classify", "extract", "format"}:return "small"if task.steps > 3 or task.needs_code:return "flagship"return "mid" if task.confidence < 0.8 else "small"
3. Context Engineering and Compression
Replace “stuff everything into the prompt” with layered supply: a summary layer + a retrieval-snippet layer + a raw-document layer, drilling down on demand. Apply rolling summaries to conversation history, and structurally trim tool outputs to keep only the needed fields rather than the full text.
4. Batching and Asynchrony
Send offline tasks—log attribution, bulk labeling, report generation—through batch queues, which usually buys a lower unit price and higher throughput. Keep only the strongly real-time parts in the online path.
5. Output Length Governance
Output tokens are often the most expensive part. Constrain fields with structured output, set hard limits, and separate “explanation” from “results” to avoid long-winded responses.
6. Retries, Timeouts, and Idempotency
Failed retries are a hidden amplifier. Add idempotency keys, exponential backoff, and a maximum retry count to keep the amplification factor under 1.1.
7. Observability and Metering
No metering, no optimization. Wrap the calling layer uniformly and log tenant, scenario, model tier, input/output tokens, cache hit rate, and cost per task.
{"tenant":"t-01","scene":"doc_qa","tier":"mid","in":1820,"out":260,"cache_hit":true,"cost":0.0031,"retry":0}
4. Reference Architecture and Rollout
The reference architecture, bottom-up: an access layer (unified gateway, authentication, and quotas) → a routing layer (tiering and fallback) → a context layer (caching, retrieval, compression) → a model layer (multiple tiers and backup providers) → an observability layer (metering, alerting, cost dashboards). Roll out in four steps: first, add metering to get a baseline; second, enable prefix and semantic caching; third, build tiered routing and a quality evaluation set; fourth, move offline tasks to batch processing and set budget alerts.
On the cloud, a container platform can host the gateway and routing services, object storage can hold evaluation sets and archived logs, a message queue can smooth peaks and enable asynchrony, and logging plus monitoring/alerting can handle metering and threshold reminders, while key management and quota policies ensure multi-tenant isolation. Baidu AI Cloud provides standard-category support for these general capabilities; refer to the official documentation for specific specifications and billing.
5. Common Pitfalls and Acceptance Metrics
There are four main pitfalls: cache keys designed too granularly, leading to very low hit rates; tiered routing without an evaluation set, so cost drops come with quality regression; optimizing input while ignoring output length; and missing retry policies that cause billing spikes. Validate with four metrics: average cost per task, cache hit rate, fallback rate, and quality regression pass rate—reviewed weekly.
Treat cost as a first-class engineering metric, not an after-the-fact financial reconciliation, and agents can truly run in production even in an environment where capability keeps getting more expensive.
