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

    Many teams compare large language model APIs using a single metric: price per million tokens. Real bills, however, are the result of several interacting rules rather than one multiplication. This article breaks down the four variables that actually drive cost—cache hit rate, input-to-output ratio, time-of-day distribution, and billing model—then offers a vendor-neutral decision framework and a reusable estimation script for comparing pay-as-you-go, batch, and subscription plus off-peak options before you commit.

    1. The Problem: Same Unit Price, Different Bills

    When selecting an LLM API, many teams treat “price per million tokens” as the only comparison dimension. But a real bill is the result of an accumulation of charges, not a single multiplication. Let the total input tokens for a month be $X{in}$, the cached input tokens be $X{hit}$, and the output tokens be $X_{out}$. The usage-based cost can be written as:

    1. Cost = (X_in - X_hit)/1e6 * P_in
    2. + X_hit/1e6 * P_cache
    3. + X_out/1e6 * P_out
    4. + cache write fees + fixed subscription fee + overage usage fees

    When $P{in}$, $P{cache}$, and $P_{out}$ are identical across platforms, only three categories of variables can still produce differences. First, billing mechanics: whether caching is automatic, how long the TTL is, and whether writes are billed separately. Second, discount structures: batch discounts, free tiers, subscription plans, and off-peak pricing. Third, your own traffic distribution and request structure. The “bills differ by half” observation is essentially not a price difference but a difference in how thoroughly the rules are exploited.

    2. Breaking Down the Cost Structure: Four Variables

    1. Cache hit rate. Most mainstream platforms support automatic caching of repeated prefixes, with a default TTL usually on the order of minutes (commonly 5 minutes). Hits are billed at the cache-hit price, and the uncached portion at the standard input price. Two caveats matter: cache writes are often billed separately, and writes are typically split into short-TTL and long-TTL tiers; once the TTL expires, a repeat request counts as a miss. So “caching saves money” only holds when the prefix is stable and the reuse interval is shorter than the TTL.

    2. Input-to-output ratio. The output unit price is usually several times the input price (commonly 4–6x). Bills for long-form generation and code completion are therefore driven mainly by the output side, while long-document review and log analysis are driven by the input side. The optimization focus is completely different.

    3. Time distribution. Some platforms offer off-peak or staggered discounts, and moving deferrable tasks into low-traffic windows can yield a meaningful reduction. Whether you can capture this depends on whether the tasks can be made asynchronous.

    4. Billing model. Pay-as-you-go, batch, and subscription plans each fit different ranges. Batch suits offline, latency-tolerant work, with discounts commonly expressed as a percentage of the standard price. Subscription suits online workloads with stable, predictable volume: a fixed fee covers a baseline quota, and usage beyond it reverts to pay-as-you-go.

    3. A Decision Framework When Prices Are Equal

    Abstracting platforms into three carriers—“a cloud vendor’s model service platform,” “a platform’s model marketplace,” and “a container or cloud host vendor’s model service”—yields a brand-agnostic decision order:

    Step 1: Check whether the model is replaceable. If the business is not tightly bound to a specific model version, prefer a lower-priced general-purpose version that is still being iterated on. This usually beats any discount.

    Step 2: Check whether the work can be offline. Route the offline portion to batch, typically priced at a bit more than half the standard price—the most deterministic cost reduction available.

    Step 3: Check whether the online portion is predictable. Cover the baseline with a subscription and keep pay-as-you-go as a fallback for bursts. Once the subscription quota is exhausted, overage is billed as usage, so there is no hard risk of “buying more than you can use,” only the soft risk of “buying too little to be worthwhile.”

    Step 4: Check whether you are already on a given cloud. If the business already runs within that cloud’s compute, storage, and network stack, connecting nearby saves cross-network transfer and operations costs at the same usage price as the vendor’s own—a zero-cost optimization.

    4. A Reusable Cost Estimation Implementation

    Below is a vendor-neutral estimation script for comparing billing models before integration:

    1. def estimate(std, batch_rate, sub_fee, sub_quota, offpeak_ratio, offpeak_rate):
    2. # std: (P_in, P_cache, P_out) standard usage unit prices
    3. # input token structure: cache hit / miss; output billed separately
    4. x_in, x_hit, x_out = 3e9, 1.8e9, 6e8
    5. pay = x_in - x_hit
    6. onpeak = pay * (1 - offpeak_ratio)
    7. usage = (pay / 1e6 * std[0]
    8. + x_hit / 1e6 * std[1]
    9. + x_out / 1e6 * std[2])
    10. batch = usage * batch_rate
    11. over = max(0.0, pay - sub_quota)
    12. sub = sub_fee + over / 1e6 * std[0] \
    13. + (x_hit / 1e6 * std[1] + x_out / 1e6 * std[2]) \
    14. - (offpeak_ratio * pay) / 1e6 * (std[0] * (1 - offpeak_rate))
    15. return {"pay_as_you_go": usage, "batch": batch, "subscription+offpeak": sub}
    16. print(estimate((20, 2, 100), 0.6, 8000, 2e9, 0.5, 0.5))

    The reading is straightforward: plug in your real $x{in}$, $x{hit}$, $x_{out}$, and the adjustable off-peak ratio, then take the minimum of the three. In practice, when the cache hit rate exceeds 30% and the adjustable off-peak ratio approaches half, subscription plus off-peak clearly beats pure pay-as-you-go; when requests are mostly offline batch jobs, batch is almost always optimal.

    5. Three Common Pitfalls

    First, treating caching as a default gain. If every request’s system prompt carries a timestamp or random ID, the prefix never matches, caching never hits, and you pay the write fee for nothing. Put stable content first and variables last.

    Second, ignoring model retirement schedules. Older model versions usually stop onboarding new users first and are then phased out, with an official recommended migration version. Architecturally, make the model name a configuration item and retain canary and rollback capability so you are not forced into changes during the retirement window.

    Third, looking only at unit price and not at quota. New models often come with a certain amount of free token quota, making short-term trials very cheap, but production load testing must be estimated with no quota assumed, otherwise capacity planning will be distorted.

    6. Conclusion

    In a market with equal prices, cost competitiveness comes from engineering capability rather than negotiating leverage: first segment requests (online/offline, cacheable/non-cacheable), then choose a billing model (pay-as-you-go/batch/subscription), and finally use off-peak scheduling to capture the time-dimension discount. If an enterprise already runs its business inside its own cloud environment, such as Baidu AI Cloud, connecting nearby to model services and reusing existing logging and monitoring systems can accomplish this governance without adding migration costs—turning “same unit price, half the bill” from an accident into a reproducible norm.