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

    This article explains why monthly LLM API bills can vary by nearly 2x even when platforms publish identical per-token prices. It breaks the bill down into unit price, usage structure, and billing rules, then examines four cost drivers: batch discounts, prefix caching, subscription and off-peak scheduling, and region plus free-tier choices. A worked example and a practical checklist show how to cut costs through architecture and routing rather than vendor selection.

    1. The Problem: Same Unit Price, 2x Different Bill

    When evaluating LLM APIs, most teams start by opening each platform’s pricing page and copying the per-million-token rates for input, cache hits, and output into a spreadsheet for a side-by-side comparison. But as the market matures, mainstream platforms often publish identical list prices for the same model tier, which makes horizontal price comparison useless. Yet the real monthly bill can still differ by nearly 2x.

    The reason is not mysterious: the bill is not a linear function of unit price, but the product of three factors: unit price × usage structure × billing rules. Usage structure covers the input-to-output ratio, prefix repetition, latency sensitivity, and whether a task can run offline. Billing rules cover batch discounts, how caching is charged and when it expires, subscription packages and off-peak pricing, and how free credits are calculated. Once unit prices are leveled, the latter two become the only variables.

    This article does not focus on any specific product. Instead, it abstracts the phenomenon into a general engineering problem: across several access channels with identical pay-as-you-go rates, how do you use architecture and scheduling to minimize cost?

    2. Cost Model: Write the Bill as a Formula First

    Let a single call have Tin input tokens and Tout output tokens, with a cache-hit ratio of h on the input, and standard rates p_in, p_cache, and p_out. The cost of one call is:

    1. cost = Tin * (1 - h) * p_in + Tin * h * p_cache + Tout * p_out

    Extending this to a month:

    1. Month = Σ cost_i * d_i

    Here d_i is a discount factor: 1 for standard pay-as-you-go, commonly 0.5–0.6 for batch, 0 for the portion covered by a subscription (a fixed fee already paid), and possibly an even lower factor for off-peak scheduling.

    The formula reveals three actionable levers: raise h (prefix reuse), increase the batch share, and move deferrable requests into lower-discount windows. None of them changes the unit price, yet all of them can significantly change the total.

    3. Four Sources of Cost Differences

    3.1 Batch: The Half-Price Zone for Offline Work

    Batch APIs trade higher latency for lower prices, with discounts typically around half the standard rate and some platforms offering 60%. They fit log summarization, bulk translation, offline labeling, and evaluation runs. The key constraints are that results are not needed within seconds and that tasks can be replayed.

    3.2 Caching: Repeated Prefixes Are an Undervalued Saving

    Mainstream implementations automatically cache repeated prefixes with a short default lifetime (often on the order of minutes). The cached portion is billed at a rate significantly below the input price, and writing to the cache may be charged separately depending on the lifetime. The engineering implication is direct: put stable content such as system prompts, tool definitions, and long documents at the very front of the prompt, keep the prefix byte-for-byte identical, and avoid inserting volatile content such as timestamps or random IDs at the head. That can push h from near zero to very high.

    1. # Bad example: volatile content at the front breaks prefix caching permanently
    2. prompt_bad = f"Current time {now()}, request ID {uuid4()}\n" + SYSTEM + user_input
    3. # Good example: stable prefix first, volatile content last
    4. prompt_good = SYSTEM + TOOLS + user_input + f"\n[meta] {now()} {uuid4()}"

    3.3 Subscriptions and Off-Peak: Turning Real-Time Calls into a Schedulable Resource

    Some platforms offer token packages that cover specific models and come with cheaper off-peak rules, with usage beyond the package falling back to pay-as-you-go. This suits workloads with stable call volume and a certain share of latency-tolerant requests. The deciding criterion is not “the unit price is cheaper” but “how much your traffic curve overlaps with the off-peak window.”

    3.4 Region and Free Credits: Easily Overlooked Constants

    Prices can differ across regions on the same platform, and free credits that come with a newly launched model are meant for evaluation rather than production. When budgeting, treat region as an explicit variable instead of defaulting to the first available one.

    4. Worked Example: One Usage Profile, Four Strategies

    Assume monthly usage of 30 million input tokens and 6 million output tokens, high prefix repetition (h≈0.8), 40% of requests deferrable to offline processing, and 60% requiring real time with half of those deferrable to off-peak. Using standard rates of 20 / 2 / 100 (CNY per million tokens) for a given model tier:

    • Pure pay-as-you-go with no cache optimization: roughly 900 CNY;
    • Caching enabled plus 40% routed to batch: down to around 600 CNY;
    • Locking in a higher-priced model tier + a subscription covering the real-time portion + half scheduled off-peak: a further 12%–24% reduction;
    • All of the above combined: nearly half of the most naive approach.

    The conclusion matches the original point: the gap does not come from which vendor you pick, but from how you use it.

    5. Selection Checklist

    1. Do not lock in a specific model version: prefer the tier with better cost-performance; when four providers are at the same price, there is no need to compare.
    2. Offline tasks: use the batch channel and accept latency in exchange for the discount.
    3. Real-time and stable calls: evaluate a subscription package plus pay-as-you-go overage, and check the off-peak window.
    4. Already on a given cloud: connect to the LLM service on the same cloud nearby, avoiding cross-network latency and traffic costs, at the same price as a direct connection.
    5. Build a dashboard: monitor four dimensions—model, business line, cache hit rate, and batch share—so cost optimization has a basis.

    6. Common Pitfalls

    • Comparing only unit prices, not discount rules;
    • Enabling caching but keeping an unstable prefix, so the hit rate stays at 0;
    • Counting free credits into a steady-state budget;
    • Serving domestic traffic from an overseas region;
    • Buying a subscription package without traffic shaping, wasting the off-peak window.

    7. Implementation Steps

    First, instrument telemetry to capture input and output tokens and cache-hit status for every call. Second, recompute the bill with the formula above and locate the largest deviation. Third, start with the zero-risk change of stabilizing the cached prefix. Fourth, shift deferrable traffic to batch. Fifth, validate the subscription and scheduling strategy with one week of data, then bake it into gateway routing rules. If you use Baidu AI Cloud capabilities, you can combine its monitoring, alerting, and logging services to close this observability loop.