Comparing LLM API Costs: Why Bills Differ by Half at the Same List Price

    When integrating LLM APIs, teams often assume that identical list prices guarantee identical costs. However, actual monthly bills frequently reveal significant discrepancies. This article explores the underlying billing mechanisms that drive these cost differences, breaks down the core billing units (input, cache hits, and output tokens), and highlights four key rules that impact final costs, such as batch processing discounts and regional pricing variations. Additionally, it provides a practical, step-by-step method for calculating and optimizing API expenditures, helping engineering teams reduce their bills through better architectural practices.

    1. Background: Identical Unit Prices, Different Bills

    Many teams integrating LLM APIs share an intuitive assumption: as long as the list price per million tokens is identical, costs should be consistent regardless of the channel used. While true in most basic scenarios, this assumption is often broken during actual monthly bill reconciliation. The reason is that pay-as-you-go unit pricing (input price, cache hit price, output price per million tokens) is only the surface layer of the billing system. The real cost differences come from the rules layer beyond the list price—batch processing discounts, subscription plans, off-peak pricing, free quotas, regional price differences, and cache TTL billing methods.

    In other words, the unit price determines the cost floor, while the rules determine the actual landing point. Even if two teams have the exact same API call volume, their final bills can differ by 30% or even nearly 50% simply due to variations in details like “which requests went through batch processing,” “which calls were scheduled during off-peak hours,” and “which prefixes hit the cache.”

    This article does not target any specific vendor. Instead, it abstracts these rules into a universal framework to explain three things: how billing units are structured, which rules widen the price gap, and how to use engineering practices to compress costs.

    2. Understand the Billing Units of an API Bill

    Mainstream LLM API pay-as-you-go billing is typically divided into three units. Understanding their composition is a prerequisite for cost accounting:

    1. Input Token Billing
    The input portion is billed based on the total number of tokens in the prompt. Note that input costs can rapidly inflate in multi-turn conversations and long-context scenarios: in multi-turn dialogs, historical messages are repeatedly counted as input context; in RAG (Retrieval-Augmented Generation) scenarios, retrieved document fragments are also counted as input. Therefore, although the input unit price is the cheapest among the three, it often accounts for a significant share of the total cost due to the large base volume.

    2. Cache Hit Billing
    To reduce the cost of repeated prefixes, mainstream APIs commonly offer a context caching mechanism: when a request’s prefix matches a recent one (e.g., a fixed System Prompt or repeatedly cited long documents), the hit portion is charged at a price far lower than standard input. However, several easily overlooked details exist:

    • Caching is usually automatically enabled, meaning repeated prefixes might trigger cache writes even without active configuration, and the write itself might incur a separate charge.
    • Caches have a TTL (Time to Live), commonly ranging from a few minutes to an hour; longer TTLs usually mean higher write prices.
    • Billing at the hit price only applies upon a hit; the missed portions are still calculated at the standard input price.

    Engineering implication: Placing long, stable content (system instructions, knowledge base fragments) at the beginning of the prompt and variable content at the end will significantly improve cache hit rates. Conversely, inserting variable content in the middle of the prefix will “punch through” all subsequent stable content, rendering the cache virtually useless.

    3. Output Token Billing
    The output unit price is typically several times that of input (often 3 to 5 times or more), and output length is difficult to predict accurately. Methods to control output costs include constraining response length and format in the prompt, setting a reasonable maximum output token limit, and using more compact schema designs for structured output (JSON).

    3. Four Rule Categories That Drive Price Differences

    Assuming identical list prices, the following four rule categories are the primary sources of billing differences. When accounting for costs, check item by item to see if you can leverage them.

    1. Batch Processing Discounts
    Many APIs offer asynchronous batch processing interfaces: allowing non-real-time tasks (data labeling, bulk summarization, offline evaluation, log analysis) to be submitted and returned after a delay of several hours to a day. In exchange, the price usually drops to 50% to 70% of the standard rate. If a significant portion of your business calls do not require second-level responses, routing that traffic to the batch processing channel is the most cost-effective optimization. A rough estimate: if 30% of calls can be executed offline with a 40% discount, the overall bill can drop directly by about 12%.

    2. Subscriptions/Plans and Off-Peak Pricing
    Some channels offer monthly token packages where the unit price within the package is lower than the pay-as-you-go price, and excess usage falls back to the standard rate. Some also stack off-peak discounts, reducing the price for calls made during night hours. These rules suit teams with stable usage volumes that can schedule non-urgent tasks to off-peak periods. Be wary of the cost of package “model/channel locking”: once locked, flexibility to switch models or channels decreases. Evaluate this comprehensively in conjunction with model iteration pacing.

    3. Free Quotas and First-Purchase Promotions
    New model releases are often accompanied by free token quotas. For small-scale validation during usage estimation phases, such quotas can cover a considerable portion of testing costs, but they should not be used as a basis for long-term cost models.

    4. Regional and Endpoint Price Differences
    Pricing for the same model might differ across regional endpoints, with some regions costing a few percentage points more than others. When making selections, confirm the pricing page for the endpoint you intend to use to avoid defaulting to the most expensive region.

    4. An Actionable Bill Accounting Method

    It is recommended to use the following process to turn “feeling expensive” into “clearly calculated”:

    Step 1: Categorize your traffic. Tag your requests along three dimensions—whether they are real-time (can they use batch processing), whether the prefix is stable (estimate cache hit rate), and the output length distribution. You can simply record this with an enum field in the logs.

    Step 2: Price separately. For each traffic category, accumulate costs item by item using “input × input price + cache hit × hit price + cache write × write price + output × output price”. Example pseudo-code:

    1. cost = (input_tokens - cached_tokens) * price_in \
    2. + cached_tokens * price_cache_hit \
    3. + cache_write_tokens * price_cache_write \
    4. + output_tokens * price_out
    5. if batch_eligible:
    6. cost *= batch_discount # e.g., 0.6
    7. elif off_peak:
    8. cost *= off_peak_discount

    Step 3: Calculate three baselines. Calculate the monthly bill under three strategies: “all pay-as-you-go,” “optimal batch processing allocation,” and “subscription + excess.” Choose the optimal solution. Empirically, relying solely on “routing offline-capable traffic to batch processing + improving cache hit rates” allows most teams to reduce costs by 15% to 30%; if off-peak discounts are available and scheduling is well-managed, the reduction can be even greater.

    Step 4: Monitor continuously. Record the token consumption and the hit billing rules for each request at the gateway layer, aggregating by day to promptly detect cache hit rate drops or output length inflation caused by prompt modifications.

    5. General Recommendations

    • Don’t make selections based solely on list prices; incorporate all four rule categories (batch processing, caching, subscriptions, regions) into your accounting model.
    • Prioritize optimizing cache structure: stable prefixes first, variable content last. This is an optimization with zero migration cost.
    • If it can be offline, don’t make it real-time: reserve a batch processing channel for asynchronous tasks.
    • Consider subscriptions only when usage is stable: run pay-as-you-go bills for one to two months first, and evaluate packages only after confirming the usage curve is stable.
    • Regularly review pricing pages: model deprecations, new model launches, and regional pricing adjustments will all change the optimal solution. It is recommended to recalculate baselines quarterly.

    The secret behind a bill differing by half never lies in the unit price table, but in your depth of understanding of billing rules and scheduling capabilities. Treating cost as an engineering problem yields far more certain returns than repeatedly comparing prices.