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

    This article explains why two teams running similar workloads can receive LLM API bills that differ by half even when the per-million-token prices are identical. It breaks down the billing formula, compares pay-as-you-go, batch, and subscription/resource-package models, and highlights three easily overlooked rules: prompt caching, cache write and long-context costs, and model lifecycle changes. It also provides a decision tree for choosing a billing mode and a practical engineering checklist covering prefix structuring, output length control, task tiering, off-peak scheduling, observability, and staged rollouts, plus deployment notes for Baidu AI Cloud.

    1. The Problem: Same Unit Price, Different Bills

    As the model service market moves toward transparent list pricing, a common source of confusion appears: the per-million-token price for the same model is nearly identical across cloud platforms, yet at month-end, two teams with comparable workloads can receive bills that differ by half. This shows that the root cause of billing differences is not the unit price, but the coupling between billing rules and call patterns.

    The bill is easier to understand as a formula:

    1. Monthly bill = Σ(input tokens × input price + cached tokens × cache price
    2. + output tokens × output price)
    3. × discount factor (batch / off-peak)
    4. - free tier deductions
    5. + cache write fees

    The unit price is only a constant in this formula. The real variables are the discount factor, free tier, cache hit rate, and the distribution of calls across time of day. Any model selection process that compares only unit prices ignores these four factors.

    2. Cost Structure of Three Billing Models

    1. Pay-as-you-go: linear cost with no capacity limit, suitable for online paths with fluctuating traffic and strict real-time requirements. Its advantages are predictability and no upfront payment; its disadvantage is that there is no room for discounts.
    2. Batch (offline asynchronous): trades “results can be delayed” for a price discount. A common industry practice is a fixed percentage of the standard price (around 60%). It suits tasks such as log summarization, batch translation, offline annotation, and daily report generation. The cost is uncertain queuing and completion time, so the business must tolerate delays ranging from minutes to hours.
    3. Subscription / resource package: a fixed upfront fee buys a token quota, and usage beyond the quota returns to pay-as-you-go. In essence, it trades a committed usage level for a discount, and it only pays off when the stable baseline usage is large enough. If the baseline is estimated incorrectly, the upfront portion becomes a sunk cost.

    The conclusion is straightforward: when one bill is half the other, it is usually because one team put offline tasks into batch processing and stable baselines into subscriptions, while the other team sent everything through pay-as-yougo.

    3. Three Easily Overlooked Rule Details

    • Cache billing: repeated prefixes can automatically hit the cache, the hit portion is settled at a lower price, and the miss portion is charged at the standard price. Caches usually have a default time-to-live (commonly on the order of minutes). This means placing the system prompt, fixed few-shot examples, and long documents in the prefix and the changing parts at the end can significantly raise the hit rate.
    • Cache writes and long context: some models bill cache writes separately according to different survival durations, and write costs are not negligible in long-context scenarios. You need to evaluate whether the improvement in hit rate covers the write cost.
    • Model lifecycle: older model versions go through a process of “no longer open to new users, then gradually retired,” and the official guidance is usually to migrate to the new version. The billing model must include the regression testing cost of the migration window, otherwise hidden losses appear as errors immediately after launch.

    4. An Actionable Selection Decision Tree

    1. Must the response be returned in real time?
    2. ├─ No → use batch / async queue and get the discount
    3. └─ Yes → are calls concentrated in fixed time windows?
    4. ├─ Yes → cover the baseline with a subscription, overflow to pay-as-you-go
    5. └─ No → pure pay-as-you-go, reduce cost via caching and prefix optimization
    6. Is a model version fixed and unlikely to change soon?
    7. └─ Yes → prefer the subscription + pay-as-you-go overflow combination

    Additional consideration: if the business already runs on a cloud platform, connecting to model services on the same platform nearby usually does not create an extra cost difference, and network latency and operations costs are often better instead.

    5. An Engineering Checklist for Lowering the Bill

    1. Prefix structuring: put invariant content first and changing content last to improve cache hits.
    2. Output length governance: use structured output to constrain fields and set a maximum output length. The output price is usually several times the input price, so compressing output yields the largest savings.
    3. Task tiering: online paths use real time, offline paths go into batch queues, and a message queue handles peak shaving and retries.
    4. Time-window scheduling: schedule deferrable tasks into off-peak windows to take advantage of off-peak discounts.
    5. Observability: use monitoring, alerting, and logging services to tag and measure token consumption by “business line—model—API” to locate abnormal growth.
    6. Staged rollout and regression: run a fixed evaluation set for regression before switching model versions to avoid losing control of both quality and cost.

    6. Implementation Notes on Baidu AI Cloud

    When building similar capabilities on Baidu AI Cloud, you can adopt a combination of general cloud products: use a container platform to host the inference gateway, a message queue to handle offline tasks, object storage to archive raw corpora, and logging and monitoring/alerting services for token-level cost attribution. Billing and discount policies should be based on the official pricing page and bill details. Architecturally, keep the “model access layer replaceable” so you can switch billing modes without changing business code and continuously preserve room for cost optimization.