Why LLM API Bills Differ by 2x: A Deep Dive into Token Billing Rules

    Comparing per-token list prices across LLM API providers is not enough to predict what your monthly invoice will look like. This article breaks down what actually drives the bill: the three-part token structure (input, output, cache hits), the three main billing modes (pay-as-you-go, batch, and subscription), prefix caching and its hit-rate and TTL trade-offs, regional pricing differences, and model lifecycle changes. It closes with a practical decision framework for routing each type of workload to the billing channel that suits it best.

    1. The Starting Point: Identical Price Lists, Radically Different Bills

    When estimating the cost of running LLM inference, a common mistake is to assume that comparing per-token prices across platforms is enough to determine “who is cheaper.” Real engineering experience says the opposite: when several cloud platforms quote exactly the same unit price, the monthly invoices that finally land in your account can still differ by close to 2x.

    The reason is simple. The per-token unit price is only one coefficient in the billing formula. What actually determines the bill is which billing mode you choose, how your workload is distributed over time, whether your caches hit, and which region and model version you call. Once you layer those variables together, “the same on-demand unit price” and “the same total spend” have no necessary connection to each other.

    Understanding this is the first step toward disciplined LLM cost management. The sections below walk through each stage where cost is formed.

    2. The Three-Part Structure of Token Billing

    Billing for mainstream LLM inference services is essentially built on tokens, and is usually split into three parts:

    • Input tokens: prompts, context, system instructions, and everything else sent to the model.
    • Output tokens: the text the model generates.
    • Cache hit tokens: when a repeated shared prefix has been cached, subsequent requests for it are billed at a lower unit price.

    The three prices typically form a clear staircase. As an illustrative order of magnitude (not representative of any specific product): input runs in the low tens per million tokens, cache hits can drop to roughly one-tenth of the input price, and output is usually several times the input price. The reason is that output is generated autoregressively token by token, with far higher computational complexity than the single forward pass over the input, which makes it more expensive per token.

    This structure has direct implications for optimization. Output tokens are the most expensive part, so any technique that shortens generations, enforces structured output, or avoids verbose answers gets its savings amplified by the output unit price. On the input side, the main lever is prefix reuse (see section 4).

    3. Three Billing Modes: On-Demand, Batch, and Subscription

    On top of the same token unit prices, most platforms offer several billing modes — and this is the main reason bills diverge.

    3.1 Pay-as-you-go

    You are billed for the tokens you actually consume, with results returned in real time. It is flexible with no upfront commitment, which makes it a fit for interactive, latency-sensitive online workloads such as chat, code completion, and real-time Q&A. The downside is that for large-scale, latency-tolerant work it tends to be expensive.

    3.2 Batch

    Requests are packaged into asynchronous jobs and submitted together; the platform processes them during off-peak windows, typically at a significant discount (commonly 50–60% of the standard price). The trade-off is that results are not returned immediately — latency ranges from minutes to hours.

    Batch processing suits offline, latency-tolerant tasks: log classification at scale, historical document extraction, offline data labeling, batch summarization, regression evaluation, and similar work. A pragmatic rule: any task where no user is waiting on a screen should be evaluated for the batch lane first.

    3.3 Subscription / Token plans

    You prepay for a token quota or a time-based package. The unit price may be lower than on-demand, but the plan usually comes with constraints, for example:

    • A limited set of models covered (not necessarily including the newest or most capable ones);
    • Peak/off-peak rules, where discounted pricing applies only in certain windows (for instance, late night into the early morning);
    • Overage automatically falling back to on-demand rates.

    Subscriptions make the most sense for workloads with stable and predictable usage. For workloads with large swings or spiky traffic, a prepaid quota can sit idle, making on-demand the better option.

    To summarize the selection logic in one line: real-time online traffic goes on-demand, offline jobs go batch, and stable, predictable high-frequency calls go subscription with on-demand overage as a fallback.

    4. Caching: The Underestimated Cost Lever

    Prefix caching has become one of the most important cost-reduction mechanisms in recent years. The idea: when multiple requests share the same prefix (a fixed system prompt, long background material, few-shot examples), the platform caches the computation for that prefix, and later requests that hit the cache are billed at the cache price.

    A few engineering details matter:

    • Automatic billing and TTL: caching is usually enabled automatically and carries a time-to-live (commonly a few minutes to an hour). If the TTL expires without a hit, the cache is invalidated and must be written again.
    • Writes and hits are billed separately: writing to the cache is often charged separately at the standard input rate or even higher, and only hits get the discounted rate. Caching therefore saves money only when the same prefix is reused frequently and the reuse interval is shorter than the TTL.
    • Sensitivity to hit rate: if each request has a different context and reuse is sparse, write costs can cancel out or even exceed the savings from hits, pushing the bill up instead of down.

    So caching is not “turn it on and save.” You need to estimate the hit rate against how your prompts are actually structured. A rough model:

    1. def estimate_cached_cost(n_requests, prefix_tokens, output_tokens,
    2. input_price, cache_hit_price, cache_write_price,
    3. hit_ratio, ttl_ok=True):
    4. """
    5. Rough estimate of cost after enabling prefix caching.
    6. - prefix_tokens: shared prefix tokens per request
    7. - hit_ratio: share of requests that hit the cache (0-1)
    8. - ttl_ok: whether request intervals are generally shorter than the cache TTL
    9. """
    10. if not ttl_ok:
    11. # Cache expires constantly; degrade to writing on nearly every request
    12. hit_ratio = 0.0
    13. # Input-side cost: first write plus subsequent hits
    14. write_cost = prefix_tokens * cache_write_price
    15. hit_cost = prefix_tokens * cache_hit_price * hit_ratio * (n_requests - 1)
    16. input_cost = write_cost + max(hit_cost, 0)
    17. # The output side is unaffected by caching
    18. output_cost = output_tokens * input_price # placeholder here; use the output unit price in practice
    19. return input_cost, output_cost

    The point of this sketch is that cache savings depend heavily on two variables, hit_ratio and ttl_ok. When evaluating a cost reduction, measure the hit rate first rather than enabling caching by default.

    5. Regional Pricing and Model Lifecycle

    Two factors that are easy to overlook, yet affect the bill in very real terms.

    Regional price differences. The same model can be priced differently across regions, and regions farther from major infrastructure hubs are often more expensive. For workloads where data-compliance rules allow it, picking the right region can directly reduce cost and cut network latency. Cross-region calls may also introduce additional data transfer charges, which should be factored into the same calculation.

    Model lifecycle. LLMs iterate quickly, and vendors retire older models while migrating users to newer ones. An old model may stop being available to new customers at a certain point and be fully retired within months. This has two consequences. The first is cost: a new model may be more or less expensive, so the bill needs to be recalculated around the migration. The second is stability: continuing to depend on a model that is about to be retired exposes you to service disruption. The mature approach is to make the model version a configuration item with room for a gradual migration, rather than hard-coding it into business logic.

    1. # Abstract model versions into configuration to enable cost comparison and gradual migration
    2. MODEL_CONFIG = {
    3. "primary": {"id": "chat-model-pro", "tier": "pro"}, # quality first
    4. "fallback": {"id": "chat-model-lite", "tier": "lite"}, # cost first / degraded mode
    5. "batch": {"id": "chat-model-lite", "tier": "lite"}, # offline batches on the lighter model
    6. }
    7. def route(task):
    8. if task.offline and task.latency_sensitive is False:
    9. return MODEL_CONFIG["batch"] # offline work: light model + batch
    10. if task.online and task.quality == "high":
    11. return MODEL_CONFIG["primary"] # high-quality real-time: main model
    12. return MODEL_CONFIG["fallback"] # everything else: cost first

    6. A Cost Optimization Decision Framework

    The dimensions above can be collapsed into an actionable sequence of checks:

    1. Look at the task’s nature before the unit price. Real-time online, offline batch, and stable high-frequency workloads map to three different billing modes, and this step usually yields the largest savings.
    2. Default real-time calls to on-demand; evaluate subscriptions for stable high-frequency traffic. Always validate the usage forecast before subscribing so the prepaid quota does not sit idle, and include overage fallback rules in the calculation.
    3. Route offline work to batch wherever possible. Trading a 40–50% discount for minutes-to-hours of latency is almost always worthwhile in scenarios users never see.
    4. Estimate the cache hit rate before deciding whether to enable caching. Long system prompts, fixed few-shot examples, and repeated background material are ideal cases; highly fragmented contexts call for caution.
    5. Work backwards from output cost when designing generation behavior. Output has the highest unit price, so structured, concise output with a capped maximum generation length often saves more than optimizing the input.
    6. Choose regions deliberately and leave room for model migration. Configuration plus gradual rollout turns “a model is being retired” into routine operations rather than an incident.

    7. Summary

    The root cause behind “same on-demand unit price, half the bill” is that many teams compare only the unit-price coefficient in the billing formula, while ignoring the real multipliers: mode selection, workload scheduling, cache hit rate, and region/model choice. The core of LLM cost management is not hunting for the lowest unit price at any single platform, but routing each category of call to the billing channel that fits its workload: real-time to on-demand, offline to batch, stable high-frequency to subscription, and reusable prefixes to caching. Get those four decisions right, and even against an identical price list, your bill will stay reliably in a reasonable range.