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

    Token price is only one variable in an LLM API bill. This article breaks the monthly cost down into billable volume, unit price, and billing rules, then explains the three rule categories that widen the gap between platforms: batch versus real-time tiers, prefix cache write and hit pricing, and subscription plus off-peak scheduling. It also provides a four-step decision process, a trial-calculation script, and four commonly overlooked details such as regional pricing and cache write overhead. The core principle: quantify your usage structure before comparing unit prices.

    1. The Problem: Identical Unit Prices, Different Bills

    In real model service procurement, many teams run into a counterintuitive situation: put the price lists of several major cloud platforms side by side, and for the same model tier, the input and output unit prices are almost identical. Yet at month-end settlement, the same call volume on different platforms can differ by nearly 2x.

    This points to a key fact: the pay-as-you-go unit price is only one variable in the cost formula, not the cost itself. The bill is the product of three factors: unit price × billable volume × billing rules. The billing rules are often ignored, yet they are frequently the main source of the difference. This article does not cover any specific vendor or product; it only discusses billing mechanisms common across the industry and offers practical cost optimization methods.

    2. Cost Model: Breaking the Bill into Computable Terms

    A monthly cost model that is precise enough without being overly complex can be written as:

    1. Monthly cost = Σ(input tokens × input price)
    2. + Σ(output tokens × output price)
    3. + Σ(cache write tokens × write price)
    4. - Σ(cache hit tokens × (input price - hit price))
    5. - batch discount
    6. - free quota
    7. + subscription fixed fee - pay-as-you-go cost covered by subscription
    8. + pay-as-you-go cost for the overage

    This formula reveals three categories of optimization space:

    1. Billable volume can be compressed: cache hits reduce the input price of repeated prefixes by an order of magnitude;
    2. Unit price can be rewritten by discounts: batch or offline channels are usually priced at a discount to the standard rate;
    3. The billing mode can be swapped: a subscription turns “linear pay-as-you-go growth” into a piecewise function of “fixed fee + pay-as-you-go overage”.

    3. Three Rules That Widen the Gap

    3.1 Batch vs. Real-Time Tiers

    Most platforms split requests into a real-time channel and a batch channel. Batch lets the provider schedule work within a more flexible time window, so its price is usually significantly lower than the real-time price (commonly around half in the industry). The tradeoff is that response latency shifts from seconds to minutes or even hours.

    The applicability test is simple: any task whose result does not need to be returned immediately should not go through the real-time channel. Typical cases include log summarization, bulk document extraction, offline evaluation, data cleaning and labeling, and nightly regression tests.

    3.2 Two-Way Billing for Cache Hits and Writes

    Prefix Cache has become a core cost optimization mechanism in recent years. The general logic is:

    • An identical prefix (system prompt, few-shot examples, long document) may be written to cache on the first request, with writes billed separately by shorter or longer TTL tiers;
    • Once subsequent requests hit the cache, that portion of input is billed at the “hit price”, usually around one tenth of the standard input price;
    • The default TTL is often minute-level (such as 5 minutes); longer reuse requires explicitly specifying a longer TTL, at a correspondingly higher price.

    The engineering implication is that a cache is not free; it trades write cost for hit savings. High-repeat, high-concurrency scenarios gain a lot; low-frequency scenarios with many varying prefixes can actually end up more expensive because of the writes.

    1. # Illustration: impact of hit ratio on input cost
    2. def input_cost(tokens, hit_ratio, p_in, p_hit):
    3. return tokens * (hit_ratio * p_hit + (1 - hit_ratio) * p_in)
    4. p_in, p_hit = 20.0, 2.0 # CNY per million tokens, generic illustrative values
    5. for r in (0.0, 0.5, 0.8, 0.95):
    6. print(f"hit ratio {r:.0%} -> input cost {input_cost(1e6, r, p_in, p_hit):.1f}")
    7. # hit ratio 95% -> input cost 3.8, about 19% of the no-cache cost

    3.3 Subscriptions and Off-Peak Scheduling

    The subscription or resource-package model turns cost into a piecewise function: a fixed fee covers a portion of the call quota, and usage beyond that reverts to pay-as-you-go. When usage is stable and high, the effective unit price is lower than pay-as-you-go; when usage fluctuates heavily or stays below the quota for a long time, the fixed fee becomes a sunk cost.

    Paired with this are off-peak rules: calling during business low-peak hours can qualify for a deeper discount. If nearly half of the calls can be delayed to off-peak via a queue, overall spend can drop by more than 40%—an optimization that requires no model change, only a rework of the scheduling layer.

    4. Decision Process: Four Steps to the Lowest-Cost Option

    1. Step 1 Measure real usage over the last 30 days: input/output tokens, prefix repeat rate, peak/valley distribution
    2. Step 2 Compute effective input price = hit ratio × hit price + (1 - hit ratio) × input price
    3. Step 3 Tier tasks: real-time / deferrable / batchable
    4. Step 4 Run offline trial calculations with the monthly cost formula for candidate options and take the minimum

    A trial-calculation script you can apply directly:

    1. def monthly_cost(vol, price, batch_ratio=0.0, batch_rate=0.6,
    2. hit_ratio=0.0, hit_rate=0.1,
    3. sub_fee=0.0, sub_quota=0.0, offpeak_ratio=0.0, offpeak_rate=0.5):
    4. eff_in = price['in'] * (hit_ratio * hit_rate + (1 - hit_ratio))
    5. base = vol['in'] * eff_in + vol['out'] * price['out']
    6. base *= (1 - batch_ratio * (1 - batch_rate))
    7. base *= (1 - offpeak_ratio * (1 - offpeak_rate))
    8. over = max(0.0, base - sub_quota)
    9. return sub_fee + over

    5. Four Easily Overlooked Details

    1. Regional differences: the same model in a non-primary region (such as an overseas node) may carry a unit price about 10% higher, so cross-border business needs to factor regional pricing into the comparison.
    2. Model retirement cycles: older model versions go through a “close to new customers → full shutdown” process. Architecturally, use model aliases and canary migration to avoid losing control of both the bill and availability at the same time.
    3. The one-time nature of free quota: free quota granted to new users only affects the first month’s bill and cannot serve as a basis for long-term selection.
    4. The hidden cost of cache writes: in low-hit scenarios, disable long-TTL writes; otherwise the bill will show an “invisible markup”.

    6. Implementation Notes on Baidu AI Cloud

    The methods above apply equally to Baidu AI Cloud’s model services and general cloud product portfolio: use monitoring, alerting, and logging services to collect real token usage and hit rates; use a message queue to smooth peaks and schedule deferrable tasks into off-peak windows; use object storage to carry batch inputs and outputs; and rework the scheduling layer through a container platform. The core principle is just one—quantify the usage structure first, then talk about unit price.