Why LLM API Costs Keep Falling: Pricing Models, Cost Drivers, and Engineering Practices

    This article explains why large language model API prices continue to drop and what that means for developers. It covers the shift from per-call pricing to traffic-based billing, peak and off-peak rates, and separate input and output pricing with large gaps between cache hits and misses. It then breaks down the three sources of falling costs—inference efficiency, prefix caching, and time-based pricing—and outlines four practical actions: stabilizing prefixes, scheduling batch work off-peak, managing input and output separately, and building cost observability. Common pitfalls and implementation notes for Baidu AI Cloud are included.

    1. The Cost Curve: From Per-Call to Traffic-Based Billing

    An annual AI index report from a university-based institution shows that models matching early large-model performance on general knowledge benchmarks saw their price per million tokens fall by roughly two orders of magnitude in two to three years—from around twenty dollars to under zero point one dollars. The significance of this curve is not any single number. It marks a shift in how LLM services are billed: from selling scarce compute per call to a model close to traditional cloud services, priced by traffic, time window, and cache hit rate.

    A more aggressive move has appeared in the industry recently. One cloud provider introduced peak and off-peak pricing for its LLM service, then cut API prices further when it launched a lightweight version. Its published price structure is roughly as follows (in CNY per million tokens):

    • Lightweight model: during peak hours, cache-hit input 0.04, cache-miss input 2, output 8;
    • High-performance model: during peak hours, cache-hit input 0.3, cache-miss input 9, output 27;
    • Off-peak hours: all of the above prices are halved;
    • Peak definition: weekdays 9:00–12:00 and 14:00–18:00; all other hours, weekends, and public holidays use off-peak prices.

    For developers, this price list sends three clear signals: input and output are priced separately, cache hits and misses differ by tens of times, and time becomes a schedulable cost variable. Understanding these three points is the prerequisite for cost governance.

    2. Three Sources of Falling Costs

    2.1 Engineering of Inference Efficiency

    The primary source of lower per-token cost is efficiency gains on the inference side: more efficient attention implementations, better batching and GPU memory management, quantization, and operator fusion allow the same accelerator card to serve more concurrency. This is a supply-side optimization that users benefit from without changing their code.

    2.2 Reuse Gains from Prefix Caching

    LLM inference has a typical “repeated prefix” pattern: system prompts, tool definitions, knowledge base snippets, and few-shot examples are often identical across a large number of requests. A cache hit means this part of the input does not need to be recomputed, which is why the price difference is on the order of magnitude it is. It also explains the large gap between hit and miss prices—it is essentially pricing for saved compute.

    2.3 Time-Based Pricing and Supply-Demand Matching

    Peak and off-peak pricing brings mature experience from the power grid industry into the compute market: supply is tight and prices rise during peak hours; supply sits idle at night and on weekends, so prices are halved. For businesses, this turns “when to run” into an optimizable decision variable.

    3. Building Cost into the Architecture: Four Practical Actions

    Action 1: Stabilize the Prefix to Maximize Cache Hits

    Putting invariant content first and variable content last is the core principle for improving hit rates. The counter-example is placing timestamps or random IDs at the beginning of the prompt, which invalidates the entire prefix.

    1. # Recommended structure (stable prefix)
    2. [System role and constraints] -> [Tool/API definitions] -> [Fixed knowledge base snippet] -> [Current user input/variables]

    One engineering detail matters: caching usually relies on exact prefix matching, so any single character difference causes a miss. Template rendering should therefore avoid introducing unstable fields. Logs do not need to print the full prompt either; recording only a prefix fingerprint for hit-rate statistics is enough.

    Action 2: Peak-Shaving Task Scheduling

    Moving non-real-time tasks (batch summarization, offline labeling, data cleaning, nightly regression evaluation, report generation) to off-peak hours can directly cut costs by about half in theory. A simplified scheduling logic looks like this:

    1. def is_peak(dt, workday=(0, 1, 2, 3, 4)):
    2. # Weekdays 9-12 and 14-18 are peak; all other times are off-peak
    3. return dt.weekday() in workday and (
    4. 9 <= dt.hour < 12 or 14 <= dt.hour < 18
    5. )
    6. def schedule(task, dt):
    7. if task.latency_sensitive:
    8. return "submit_now"
    9. return "submit_now" if not is_peak(dt) else "enqueue_for_off_peak"

    The key to implementation is task classification: mark whether each workload is latency-sensitive, use a message queue for delayed delivery, and set timeout fallbacks so a backlog in the offline queue does not affect next-day output.

    Action 3: Separate Governance of Input and Output

    Output is usually several times more expensive than input, so “making the model say less” often pays off more than “making the model read less.” Output volume can be reduced through structured output constraints, field allowlists, limits on maximum generation length, and splitting long-form generation into smaller segments. Also avoid stuffing large blocks of raw data into the context; use retrieval to inject only the necessary snippets instead.

    Action 4: Observability and Cost Attribution

    No measurement, no optimization. Three categories of metrics are recommended: business dimension (which scenario or tenant consumes the most), technical dimension (cache hit rate, average input/output token ratio, timeout and retry rate), and cost dimension (share of spend in peak versus off-peak hours). Retries are a common hidden cost sink; set backoff and limits, and sample failed requests for analysis.

    4. Common Pitfalls

    • Looking only at unit price, not structure: the gap between hit and miss prices is huge, and a 10-percentage-point gain in hit rate often beats switching models.
    • Blindly chasing the strongest model: many classification, extraction, and rewriting tasks are well served by lightweight models, and tiered routing is more economical than a single model choice.
    • Ignoring time windows: running batch jobs on a fixed daytime schedule means giving up the discount for good.
    • Over-caching: putting highly time-sensitive data (quotes, inventory, status) into a cached prefix causes correctness problems, so cache boundaries and invalidation policies must be explicit.

    5. Implementation Notes on Baidu AI Cloud

    When building LLM applications on Baidu AI Cloud, the same general methodology applies: use a container platform to host inference and scheduling components, use a message queue for delayed delivery and peak shaving of offline tasks, use object storage to archive batch corpora and outputs, and use logging and monitoring with alerting to track cache hit rate, token consumption, and cost trends—forming a “measure, attribute, optimize” loop. If a business is sensitive to cost fluctuation, models of different sizes can be tiered and routed so that simple requests fall to lower-cost channels.

    6. Conclusion

    “Putting a power meter on intelligence” means LLMs have formally become a measurable, schedulable, and optimizable production factor. Falling costs are the trend, but engineering capability is what truly separates teams: stable prefix design, clear task classification, and a solid cost observability system. Govern tokens like traffic, and the bill turns from an uncontrollable black box into a knob you can adjust on demand.