Why LLM API Bills Can Differ by 2x: It's the Pricing Structure, Not the Unit Price

    Many teams compare per-token prices across cloud platforms, see identical rates, and assume the choice doesn't matter—only to find a 2x gap in the monthly bill. This article breaks down the real billing formula and the four variables that drive cost: batch versus real-time dispatch, cache hit rate engineering, subscription plans with off-peak scheduling, and free tiers, regions, and model lifecycle. It also provides a reusable estimation method and a selection and migration checklist so you can quantify usage first and decide with data.

    1. The problem isn’t the unit price—it’s the pricing structure

    When the same model is offered on different cloud platforms, the pay-as-you-go unit prices are often aligned: the input price, cache hit price, and output price per million tokens are identical across the board. Many teams therefore conclude that “the platform doesn’t matter,” only to discover at month-end reconciliation that the bills can differ by 2x.

    The reason isn’t mysterious. The unit price is just a set of coefficients in the billing formula. What actually determines the amount are three classes of variables: call patterns, time distribution, and billing rules.

    Writing the bill as a formula makes this clearer:

    1. Monthly bill = Σ(input tokens × input price)
    2. + Σ(output tokens × output price)
    3. + Σ(cached tokens × cache price)
    4. + Σ(cache write tokens × write price)
    5. - free tier credits
    6. - batch discounts
    7. - subscription plan credits

    When unit prices are the same, only the last four terms on the right can change the result. The battleground for cost optimization is therefore not “price comparison” but “reshaping call patterns.”

    2. Four variables: where the bill gap really comes from

    2.1 Mixing batch and real-time calls

    Offline tasks—log summarization, bulk labeling, offline evaluation, data cleaning—are latency-insensitive, yet they are often written as real-time synchronous calls and billed in full at standard rates. The industry commonly offers batch channels that trade longer completion times for lower prices. Moving latency-tolerant tasks into the batch queue delivers the single largest improvement.

    Illustrative task dispatch logic:

    1. def dispatch(task):
    2. if task.latency_slo is None or task.latency_slo > 60:
    3. return batch_submit(task) # offline channel, discounted
    4. return realtime_call(task) # real-time channel, standard price

    2.2 Cache hit rate is an engineering capability

    Automatic prefix caching is typically billed with a short time-to-live. On a hit, only the hit price is charged; misses and writes are billed separately. Caching is not “enable it and save money”—it’s an engineering problem: is the system prompt stable, are variable fields moved out of the prefix, do multi-turn conversations keep a consistent prefix, do concurrent requests share the same prefix. Moving volatile fields such as timestamps, random IDs, and user nicknames from the head of the prompt to the tail often raises the hit rate from single digits to over 70%.

    1. # Bad example: the prefix changes every hour, so caching almost never hits
    2. System time: 2026-11-17 09:12:33
    3. You are a support assistant, user nickname = Zhang San ...
    4. # Good example: stable prefix first, volatile content last
    5. You are a support assistant and must follow these rules ...(long stable content)
    6. --- Variables for this request below ---
    7. Time: ...; nickname: ...

    2.3 Subscription plans and off-peak scheduling

    Some platforms offer token plans paid on a fixed cycle that cover specified models, with off-peak rules: calls during business troughs consume fewer credits or don’t count as overage. If your call volume is stable and predictable, a plan plus pay-as-you-go overage usually beats pure pay-as-you-go; if you can schedule some batch and warm-up tasks into trough hours, the savings grow further. Conversely, for spiky, highly uneven workloads, a subscription creates idle waste.

    2.4 Free tiers, regions, and lifecycle

    New model launches often come with a one-time free tier, suitable for load testing and migration validation, but it shouldn’t be counted in a long-term cost model. Region choice also affects price: cross-region deployment carries a small premium on some platforms and adds network latency. Also watch the model lifecycle—when an older model version stops opening to new users and is planned for retirement, migration costs should be budgeted in advance.

    3. A reusable cost estimation method

    Build a usage profile first, then do selection—the order can’t be reversed:

    1. Sample one week of real calls, recording the input/output token distribution, cache hit rate, peak/trough curve, and the share of latency-tolerant calls.
    2. Estimate the monthly baseline with: monthly cost ≈ input volume × input price + output volume × output price. Output usually accounts for the largest share, so compressing output length pays off significantly.
    3. Layer on rule adjustments: batch discounts, cache hits and writes, free tiers, subscription credits.
    4. Run a sensitivity analysis: what’s the bill range when the hit rate varies by ±20% and the batch share by ±30%?
    1. def estimate(tokens_in, tokens_out, hit_ratio,
    2. p_in=20, p_hit=2, p_out=100, batch_ratio=0.0, batch_discount=0.6):
    3. hit = tokens_in * hit_ratio
    4. miss = tokens_in - hit
    5. realtime = miss * p_in + hit * p_hit + tokens_out * p_out
    6. batchable = realtime * batch_ratio
    7. return (realtime - batchable + batchable * batch_discount) / 1_000_000

    4. Selection and migration checklist

    • Don’t bind to a specific model version: make the model name a configuration item and keep the ability to switch, avoiding lock-in to a single version.
    • For workloads already running on a cloud, connect to that cloud’s model service locally to save cross-network traffic and governance costs; when the unit price matches the original vendor’s, there’s no need to migrate.
    • Use a unified gateway layer for routing, rate limiting, retries, and fallback, pushing batch/real-time dispatch and caching strategy down into platform capabilities rather than scattering them across business code.
    • Build cost observability: tag by business line and set monitoring alerts with thresholds on daily cost and token consumption.
    • Review pricing and rules quarterly—pricing pages update frequently, and rule changes often affect the bill more than unit price adjustments.

    5. Conclusion

    Converging unit prices are the norm; cost differences come from engineering implementation. Suggested priority: first do task dispatch and cache improvements (no vendor change needed), then evaluate subscriptions and off-peak scheduling (requires predictable usage), and only then consider cross-platform migration. Baidu AI Cloud follows the same general pricing approach for its model services, combining pay-as-you-go, caching, and batch processing. Teams can apply the estimation model above directly to their own usage—quantify first, then decide, instead of choosing a platform by feel.