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

    Many teams compare LLM API unit prices when choosing a platform, only to find the final bill far from expectations. This article explains why the billing structure matters more than the headline rate: the bill is determined by call patterns multiplied by billing rules, including four token tiers (uncached input, cache hits, cache writes, output), batch discounts, and subscription or off-peak pricing. It also provides a four-step estimation method to forecast costs before launch, along with practical notes on cache lifetime, model retirement, regional pricing, and free quotas.

    1. The Problem Is the Billing Structure, Not the Unit Price

    Many teams focus on the unit price table during platform selection, then discover after launch that the bill is far from what they expected. The real reason is that the pay-as-you-go unit price is only a coefficient in the billing formula. The final amount is determined jointly by “call structure × billing rules.” When the pay-as-you-go unit prices across multiple platforms are identical, only two variables remain: asynchronous batch discounts and subscription/off-peak rules. These two rule types can map the same call volume to completely different bills.

    The bill becomes clearer when expressed as a formula:

    1. Monthly bill = Σ(token type × unit price × discount factor) - free quota + subscription fee
    2. Token types: uncached input, cache-hit input, cache write, output
    3. Discount factor is determined by call mode (real-time/batch), time window (peak/off-peak), and billing mode (pay-as-you-go/subscription)

    As long as the discount factor is not 1, identical unit prices do not mean identical costs.

    2. Four Token Tiers: Break Down Tokens Before Calculating

    The industry commonly splits the consumption of a request into four parts instead of the simple “input + output”:

    • Uncached input: context newly read for this request; highest unit price.
    • Cache-hit input: prefixes repeated from recent requests; unit price is usually about one-tenth of uncached input.
    • Cache write: additional overhead for writing a prefix into the cache, tiered by write duration.
    • Output: generated content; unit price is usually several times that of input.

    Illustrative price structure (CNY per million tokens, only to show the order of magnitude):

    Tier High-price model Mid-price model Low-price model
    Uncached input 20 13 6.5
    Cache hit 2 1.3 1.3
    Output 100 68 27

    Three practical conclusions follow. First, output is the main cost driver. Compressing output length (structured fields, limited enum ranges, avoiding context repetition) is more effective than switching models. Second, the roughly tenfold gap between cache-hit and uncached prices means stable prefixes such as long system prompts, fixed tool descriptions, and few-shot examples must be reused. Third, cache writes are billed by duration tier. Short-duration tiers suit burst traffic; long-duration tiers suit stable periodic tasks. Choosing the wrong tier can let write fees eat up the savings from cache hits.

    3. Two Rules That Can Widen the Bill Gap

    3.1 Batch Processing: Trade Latency for a Discount

    Asynchronous batch processing is a common industry capability: submit requests as offline jobs, let the platform schedule them during off-peak hours, and accept results with latency shifting from seconds to minutes or even hours. Pricing is usually a percentage of the standard price (commonly around 60%). It suits scenarios that do not need immediate responses, such as log summarization, batch labeling, offline evaluation, data cleaning, and report generation. On the engineering side, you only need to add a queue layer on the calling side and split the real-time path from the offline path:

    1. def route(task):
    2. if task.deadline_hours > 1: # tolerate hour-level latency
    3. return submit_batch(task) # discounted channel
    4. return call_realtime(task) # real-time channel

    Note three points: batch jobs have a result retention period, so retrieve and persist results promptly; failed retries count as new token consumption; place input and output files in object storage in the same region to avoid cross-region traffic charges.

    3.2 Subscription and Off-Peak: Move Shiftable Loads Away

    The logic of subscription plans (resource packs/token packages) is to trade a fixed monthly fee for a lower unit price, often combined with off-peak rules: normal billing during peak hours, deeper discounts or no quota consumption during off-peak hours. This works only when the load is predictable and the total volume is stable. If monthly call volume fluctuates by several times, the fixed subscription fee dilutes the benefit. If the load can be shifted, scheduling batch offline jobs to nighttime off-peak hours will reduce the bill more significantly than simply switching models.

    A rough decision rule:

    1. Subscription is better ⇔ stable monthly volume AND high peak share AND (pay-as-you-go total - shiftable off-peak portion) > subscription fee
    2. Pay-as-you-go is better ⇔ large volume fluctuation, trial phase, or batch discount already enabled

    4. Four-Step Estimation: Calculate the Bill Before Launch

    1. Sample: extract one week of requests from real traffic and measure three distributions: input, output, and repeated prefix length.
    2. Calculate the hit rate: repeated prefix length ÷ input length gives the cache hit rate, which determines the weight of the hit tier and write tier.
    3. Split by time window: count call volume by hour and mark the proportion that can be shifted to off-peak.
    4. Plug into the formula: calculate the amounts for three scenarios: pure pay-as-you-go, pay-as-you-go + batch, and subscription + overage pay-as-you-go; take the minimum.
    1. Example: monthly input 30 million, output 6 million, hit rate 60%, shiftable 40%
    2. Pure pay-as-you-go ≈ 30M×0.4×20 + 30M×0.6×2 + 6M×100 = CNY 87,600
    3. Batch replacing the offline portion ≈ a further 40%×(1-0.6)×20×30M ≈ CNY 9,600 reduction
    4. Shift to off-peak + subscription ≈ depends on discount and fixed fee; usually the largest reduction

    5. Four Easily Overlooked Details

    • Caches have a default time-to-live (commonly minutes); calls spaced beyond the window degrade to uncached, so scheduled jobs should aggregate triggers rather than fire scattered ones.
    • Older model versions enter a retirement process: first closed to new users, then fully withdrawn. Architecturally, make the model identifier a configuration item and keep a one-click switch capability.
    • Overseas region unit prices are usually higher than the main region, plus cross-border traffic costs; evaluate data compliance and cost together.
    • Free quotas apply only to new models and new accounts; do not treat them as a long-term offset when budgeting.

    6. Conclusion and Implementation Advice

    Unit price convergence is the industry norm; cost differences come from rules, not quotes. Recommendations: do not lock to a specific model version; default to the mid-price tier with pay-as-you-go billing, ensuring four providers at the same price and migration at any time; route all offline jobs through batch processing; schedule shiftable parts of the real-time path to off-peak hours where possible; for workloads already running on a cloud, connect to model services in the same region to reduce cross-region traffic; review the bill monthly with the same estimation script, and make the model identifier, cache TTL, and batch threshold all configurable. If you use model services from Baidu AI Cloud, the same advice applies: calculate based on the “common billing structure + your own traffic profile” rather than comparing unit price numbers alone.