Why LLM API Bills Can Differ by 2x at the Same Token Price

    Identical per-million-token prices across major cloud platforms do not guarantee identical bills. This article explains why LLM API spending can vary by nearly double, breaks billing down into four token types (regular input, cache hits, cache writes, and output), and shows how billing dimensions and rules—rather than unit price—drive cost. It covers async batch channels, prepaid resource packages with off-peak rules, and cache lifecycle management, plus practical guidance on regional premiums, free quotas, model deprecation, and long-context costs. Readers will find formulas, sample code, and a selection checklist for building predictable, attributable token-level cost control.

    1. The Phenomenon: Same Unit Price, Very Different Bills

    When teams evaluate LLM inference costs, they often run into a counterintuitive result. Put the pricing pages of several major cloud platforms side by side, and for the same model tier and specification, the per-million-token price is often identical down to the last digit. Yet at the end of the month, the bills can differ by nearly 2x.

    The reason is not mysterious. The pay-as-you-go unit price is only one factor in a bill. What really determines spending is the combination of billing dimensions and billing rules. Once unit prices are leveled, the difference can only come from three places:

    • Which types of tokens you actually consume: regular input, cache hits, cache writes, and output.
    • Whether the workload can be scheduled into discounted time windows or async channels.
    • Whether you use prepaid resource packages, and how overages are settled.

    So the right order for cost optimization is not to compare prices first. It is to describe your usage structure clearly first, then look at the rules.

    2. Break the Bill Down into Four Token Types

    The billing models of mainstream LLM APIs have largely converged on four categories. Understanding them is the prerequisite for all optimization:

    • Regular input tokens: the prompt portion that is not a cache hit, and the highest-priced tier of input cost.
    • Cache-hit tokens: the prefix portion that repeats from recent requests, usually priced at only about one-tenth of regular input.
    • Cache-write tokens: the extra cost incurred when writing a prefix into the cache, tiered by time-to-live (TTL), commonly a few-minutes tier and a one-hour tier.
    • Output tokens: the portion generated by the model, priced significantly higher than input, usually several times the input price.

    Writing the monthly bill as a formula makes it more intuitive:

    1. monthly cost = input tokens × P_in
    2. + hit tokens × P_hit
    3. + write tokens × P_write(ttl)
    4. + output tokens × P_out
    5. - free quota - discounts

    An illustrative estimation function:

    1. def monthly_cost(in_tok, hit_tok, write_tok, out_tok,
    2. p_in=20.0, p_hit=2.0, p_out=100.0,
    3. p_write_5m=20.0, p_write_1h=40.0):
    4. # Unit: CNY per million tokens
    5. return (in_tok * p_in + hit_tok * p_hit + out_tok * p_out
    6. + write_tok * p_write_5m) / 1e6

    Key takeaway: for output-heavy workloads (code generation, long-form writing), the bill is almost entirely dominated by the output price, so switching platforms yields little benefit. For input-heavy workloads with highly repetitive prefixes (customer-service Q&A, fixed system prompts, batch extraction), the cache hit rate is the real battleground.

    3. Three Types of Rules That Open Up the Gap

    3.1 Async Batch Channels

    Most platforms offer an async batch interface. After you submit non-real-time tasks, the platform schedules them on spare capacity. A 40% discount off the standard price is a common industry level. It fits scenarios such as log extraction, offline labeling, batch summarization, and nightly regression testing, at the cost of return latency ranging from minutes to hours. In engineering terms, you only need to wrap synchronous calls into a three-step “submit-poll-fetch” flow:

    1. job = submit_batch(payload) # Submit and get a job ID
    2. while not done(job): # Poll with exponential backoff
    3. sleep(backoff())
    4. result = fetch(job) # Fetch results and write to object storage

    3.2 Subscription Packages and Off-Peak Rules

    Prepaid packages lock in part of your usage at a fixed monthly fee, with a unit price lower than pay-as-you-go, while overages revert to pay-as-you-go settlement. Whether it pays off depends on whether a “stable baseline usage” can consume the package quota. The more stable the baseline, the more obvious the amortization; the more volatile it is, the more likely you end up in a lose-lose situation where the package is not fully used and the overage is billed at pay-as-you-go rates. Some packages also come with off-peak rules that lower the price for calls from evening to late night, so scheduling deferrable tasks into that window can further reduce unit cost.

    The break-even calculation is simple:

    1. subscription is better ⟺ monthly fee < baseline usage × (pay-as-you-go price - package price)

    3.3 Cache Lifecycle and Free Quotas

    Caches are enabled by default with a short TTL, which means the prefix must be “high-frequency and concentrated” to hit. If the request prefix changes every time, you not only fail to save money but also pay extra write fees. The engineering recommendation is to fix the system prompt, tool definitions, few-shot examples, and long documents as a stable prefix placed at the very front, with variables at the tail. Free quotas during a new model’s launch period apply only to new accounts or new models, so when running load tests you should exclude this portion from your steady-state cost.

    4. Four Details That Are Easy to Miss

    • Regional premium for overseas regions: the same model commonly carries a 5% to 10% premium in non-primary regions, so confirm the region before making cross-border calls.
    • Unpriced caching: some platforms do not list the cache-hit price on the page, so budget conservatively assuming “no cache discount.”
    • Old-version retirement: the previous-generation model usually first stops opening to new users, then is retired entirely. Schedule the migration window in advance; the official guidance is generally to migrate to the new-generation general-purpose model.
    • Output limits and context length: long context raises input cost at the same time, and retrieval augmentation is often cheaper than “stuffing everything in.”

    5. Selection Decision Checklist

    1. Not bound to a specific version, using pay-as-you-go on a general-tier model: with four providers at the same price, just pick the one closest to your existing cloud account, network, and audit system to reduce data-egress and compliance costs.
    2. Offline tasks: prioritize the async batch channel and save 40% directly.
    3. Real-time and version-locked: use a subscription package to cover the baseline, send overages to pay-as-you-go, and schedule deferrable calls into off-peak windows.
    4. Business already running on a particular cloud: connect to the LLM service on the same cloud nearby, with a unit price identical to the original vendor, saving link and operations costs.
    5. Must-do before launch: instrument and track the share of the four token types, the cache hit rate, and the peak/off-peak distribution, then run the numbers back through the formula above before deciding on the commercial model.

    6. Conclusion

    Converging unit prices are a sign of a maturing industry, and cost competitiveness now shifts to “usage engineering”: reshaping prompt structure into a cacheable form, splitting tasks by real-time requirements across different channels, and handing a stable baseline to prepaid packages. If an enterprise already runs workloads on Baidu AI Cloud, it can directly reuse its general batch, caching, and resource-package capabilities, and combine them with logging and monitoring/alerting services to build a token-level cost dashboard, making every inference expense attributable, predictable, and optimizable.