Why LLM Inference Costs Keep Falling

    This article explains why the cost of large language model (LLM) inference has dropped so sharply, using the analogy of installing an electricity meter on intelligence. It breaks down the token-based billing model, the three engineering drivers behind falling prices (model and inference efficiency, prefix caching, and time-of-use pricing), and four practical strategies for controlling costs: task tiering and model routing, cache-friendly context engineering, asynchronous batching to avoid peak hours, and observability with cost guardrails. It also highlights common mistakes to avoid. Readers will learn how to make every token run on the right model, at the right time, and in the right context.

    1. From Expensive Intelligence to Metered Intelligence

    Over the past two years, the most significant shift in the LLM industry has not been a jump in any single benchmark, but a change in the shape of the cost curve. Early on, high R&D investment, scarce compute, and steep API prices formed a barrier to entry. Since then, model architecture improvements, more efficient inference engineering, and more aggressive pricing have sharply reduced the cost of accessing high-level intelligence.

    Public reports from research organizations show that, taking a model that reaches a certain capability level on general knowledge benchmarks as a reference, its price per million tokens fell by more than two orders of magnitude in two to three years, from around twenty dollars to less than ten cents. The real meaning of this data is not that intelligence simply “got cheaper,” but that intelligence is starting to be metered, time-shared, and scheduled like electricity.

    This article draws an analogy of “installing an electricity meter on intelligence” and explores the trend across four layers: billing models, cost structure, scheduling strategies, and engineering practices.

    2. Understanding the Meter: The Nature of Token-Based Billing

    A token is the smallest billable unit a model uses to process text. Billing typically consists of three parts:

    • Input (prompt) tokens: context, system prompts, conversation history, and retrieved snippets all count toward this.
    • Output (completion) tokens: generated content, usually priced higher than input.
    • Cache hits and misses: repeated prefixes that hit the cache are priced significantly lower than misses.

    The billing logic can be illustrated as:

    1. def estimate_cost(in_tokens, out_tokens,
    2. price_in_miss, price_in_hit, price_out,
    3. cached_ratio=0.0):
    4. hit = in_tokens * cached_ratio
    5. miss = in_tokens - hit
    6. return (hit * price_in_hit
    7. + miss * price_in_miss
    8. + out_tokens * price_out) / 1_000_000

    This code reveals a fact that is often overlooked: the bill is not determined only by “how much you asked,” but jointly by “how much was repeated, how much was generated, and when it happened.”

    3. Three Engineering Sources of Cost Reduction

    3.1 Model and Inference Efficiency Optimization

    Mixture-of-experts architectures activate only part of the parameters on each forward pass, and sparsification reduces the compute consumed per token. Low-precision computation, operator fusion, continuous batching, and paged memory management push hardware utilization to higher levels. Every gain in utilization on the engineering side ultimately shows up in the unit price.

    3.2 Prefix Caching Turns Repeated Context into a Discount

    System prompts, tool definitions, long documents, and few-shot examples are highly repetitive across multi-turn requests. If this content can be cached reliably, billing for the repeated portion can drop by an order of magnitude. So “putting stable content first and volatile content last” is not just a prompt trick, but a direct financial optimization.

    1. [System Prompt + tool definitions + domain knowledge] ← stable prefix, aim for a cache hit
    2. [conversation history summary] ← semi-stable
    3. [current user input] ← volatile, placed at the end

    3.3 Time-of-Use Pricing Makes “Time” a Tunable Parameter

    Dividing the day into peak and off-peak periods, with off-peak prices at roughly half of peak, and treating weekday daytime as peak and nights, weekends, and holidays as off-peak, essentially brings the peak-valley electricity pricing of the power grid to inference services. For businesses, this means batch jobs have a clear window to “time” their execution.

    4. Wiring the Meter into Your System: Four Practical Approaches

    Practice 1: Task Tiering and Model Routing

    Layer requests by value: high-value interactions go to more capable models, while massive low-value tasks go to lightweight models. The rules are configurable and can be rolled out gradually.

    1. def route(task):
    2. if task["need_reasoning"]:
    3. return "model_pro"
    4. if task["max_latency_ms"] < 800:
    5. return "model_flash"
    6. return "model_flash"

    Practice 2: Cache-Friendly Context Engineering

    Control prefix drift, and avoid inserting timestamps or random IDs into the stable segment. Structure and chunk long documents while reusing fixed templates. Apply rolling summaries to multi-turn conversations to suppress linear context growth.

    Practice 3: Asynchrony and Batching to Avoid Peak Hours

    Offline summarization, batch labeling, log aggregation, and evaluation regressions are naturally latency-insensitive and should be placed in queues and consumed during off-peak periods.

    1. # Pseudocode: schedule offline inference by peak-valley windows
    2. def schedule(job, now):
    3. if is_peak(now) and job["tolerant_to_delay"]:
    4. return delay_to_next_off_peak(job)
    5. return submit(job)

    Practice 4: Observability and Cost Guardrails

    Cost must be monitored like latency and error rates. Recommended instrumentation dimensions include request volume, input/output token distribution, cache hit rate, cost per request, and time-of-day distribution, along with budget thresholds and circuit breakers.

    1. budget:
    2. daily_limit: 200000000 # daily token budget
    3. alert_ratio: 0.8
    4. actions: [downgrade to lightweight model, queue until off-peak, reject non-core traffic]

    5. Common Mistakes

    • Looking only at unit price and not structure: raising the cache hit rate from thirty to seventy percent often saves more than switching models.
    • Treating long context as free: input tokens accumulate across turns, and long conversations are a major source of the bill.
    • Ignoring output cost: output is usually priced higher, so limiting redundant explanations and repeated generation pays off.
    • Making everything synchronous: running deferrable tasks during peak hours is equivalent to giving up the discount.

    6. Conclusion

    When intelligence is metered like electricity, engineering capability becomes a matter of “power efficiency.” In cloud service scenarios such as Baidu AI Cloud, model services are typically combined with general capabilities like object storage, message queues, container platforms, log services, and monitoring and alerting to form a closed loop of “routing, caching, scheduling, and observability.” Truly mature cost governance is not about pushing unit prices down at all costs, but about making every token happen on the right model, at the right time, and in the right context.