LLM API Cost Analysis: Why the Same Unit Price Can Still Produce a Bill That Is Half as Large

    This article explains why comparing LLM API costs by headline unit price alone is misleading. It presents a cost model that separates cached and uncached input, incorporates non-call fees, and evaluates caching, asynchronous batch processing, subscriptions, off-peak entitlements, and operational cost drivers. A reproducible hypothetical example shows how usage structure and settlement rules—not a change in the base unit price—can bring a bill close to half, and the article closes with a practical cost governance process.

    LLM API Cost Analysis: Why the Same Unit Price Can Still Produce a Bill That Is Half as Large

    1. Why Unit Price Alone Is Not Enough When Comparing API Costs

    When purchasing LLM API capacity, the easiest figures to compare are the input price and output price per million tokens. However, the amount an enterprise ultimately pays is not determined by these two figures alone.

    The same business request may produce different input lengths depending on how historical messages are assembled. The same prompt may be billed under different rules depending on whether cache hits occur. Tasks of the same scale may also produce completely different settlement results depending on whether they run in real time, through asynchronous batch processing, or against subscription quota credits.

    Therefore, “the unit price is the same, but the bill differs by half” is not mathematically contradictory. It does, however, have clear preconditions: there must be sufficiently large differences in effective billable usage, or discount mechanisms capable of covering a sufficiently large share of spending. A savings ratio observed under one specific workload cannot be treated as a benefit that every business will obtain.

    A more reasonable comparison target is:

    How much total cost is required to complete the same business tasks while meeting the same quality, latency, and stability requirements?

    This definition shifts the comparison from the price list to business outcomes. It also avoids mistaking low-quality output, failed retries, and unusable subscription quota for “cheap” service.

    2. Standardize Definitions Before Building a Cost Model

    2.1 Split Input into Cache Hits and Cache Misses

    For a given billing period, define:

    • U: the number of uncached input tokens;
    • H: the number of cached input tokens;
    • O: the number of output tokens;
    • Pu: the price per million uncached input tokens;
    • Ph: the price per million cached input tokens;
    • Po: the price per million output tokens.

    Ignoring other fees, the base call cost is:

    C_base = (U × Pu + H × Ph + O × Po) ÷ 1,000,000

    The most important point here is to avoid double counting. If a platform’s reported total input already includes cached tokens, split the total first and then apply the corresponding prices. Do not charge the standard rate for all input and then add cache-hit fees on top.

    For cache writes, some billing schemes charge separately, while others use a different basis. Calculations must follow the actual billing definition; do not assume that every service charges only for cache-hit reads.

    2.2 Include Items Beyond Call Fees in the Total Bill

    A complete monthly cost can be written as:

    C_total = C_usage + C_batch + C_cache_add + C_subscription + C_overage + C_supporting − C_discount

    Where:

    • Usage fees correspond to real-time calls not covered by other settlement methods;
    • Batch fees correspond to workloads that meet asynchronous task rules;
    • Cache add-on fees include cache writes or storage fees under applicable rules;
    • Subscription fees are fixed or recurring expenses;
    • Overage fees correspond to calls beyond subscription coverage;
    • Supporting fees include necessary storage, network, logging, and task scheduling expenses;
    • Discounts count only when they are actually available and eligible.

    These costs should be calculated over mutually exclusive call sets. For example, if a call has already been counted against subscription quota, it cannot also be fully counted as ordinary usage fees.

    2.3 Standardize the Comparison Boundary

    Cross-service comparisons should standardize at least the following conditions:

    • Model capabilities and version scope;
    • Input samples, prompts, and context length;
    • Output length and quality acceptance criteria;
    • The ratio of real-time calls to offline tasks;
    • Cache statistics and billing definitions;
    • Region, currency, taxes, and billing period;
    • Handling of timeouts, failures, and retries.

    Even when processing the same text, different tokenization methods may produce different token counts. Therefore, price per million tokens is suitable for initial screening, while “total cost per thousand qualified tasks” is better suited to business decisions.

    3. Caching Reduces the Cost of Repeated Input

    3.1 Cache Benefits Depend on Reusable Prefixes

    LLM requests often contain stable system instructions, business rules, examples, and knowledge materials. If the service supports prefix caching and the request meets the hit conditions, this repeated content may be billed at a lower rate.

    However, “similar content” does not mean “cache hit.” Prefix content, ordering, request intervals, and implementation-specific conditions may all affect the result.

    From an engineering perspective, stable content should generally be placed first, while user questions and other dynamic content should be placed later. Avoid inserting constantly changing timestamps, random identifiers, or irrelevant fields into stable prefixes. Any adjustment must still preserve semantic correctness; prompt structure should not be broken merely to improve caching.

    3.2 Use Net Benefit to Decide Whether Caching Is Worthwhile

    The net benefit of caching can be approximated as:

    Cache net benefit = H × (Pu − Ph) ÷ 1,000,000 − cache add-on fees

    If a very long context is used only once, even a low cache-hit price may not cover the additional fees. By contrast, a stable long prefix used at high frequency is more likely to produce meaningful savings.

    It is also important to distinguish “request hit rate” from “token hit rate.” Nine hits out of ten requests does not mean that 90% of input receives the discounted rate; the length of the matched prefix may differ from request to request. For cost analysis, the token basis is usually more direct.

    4. Asynchronous Batch Processing Trades Delivery Time for Cost Headroom

    4.1 Not Every Request Is Suitable for Batch Processing

    Offline document summarization, historical data classification, periodic report generation, and non-urgent content moderation usually have more scheduling flexibility. User-facing real-time Q&A, live assistance, and transaction paths often cannot tolerate long waits.

    The first step, therefore, is not to look for a discount but to label tasks by timeliness requirements:

    • Must return immediately;
    • Can be delayed by a few minutes;
    • Can be completed within hours;
    • Can be delivered the next day.

    Only the latter categories are candidates for asynchronous batch processing.

    4.2 Discounts Apply Only to Eligible Portions

    Assume a business has a baseline call cost of CNY 10,000, and 60% of that cost can be moved to asynchronous tasks. Assume the applicable batch-processing fee is 60% of ordinary usage. These figures are hypothetical and are used only to illustrate the calculation method; they do not represent current pricing for any service.

    The optimized cost is:

    10,000 × 40% + 10,000 × 60% × 60% = CNY 7,600

    The overall saving is 24%, not 40%.

    More generally, if the share of original cost that can be migrated is q and the post-discount payment ratio is d, the total cost saving ratio is:

    q × (1 − d)

    Here, q should be a cost share, not an arbitrary replacement with request-count share, because different requests may differ greatly in input and output length.

    4.3 Include Scheduling and Retry Costs

    A batch pipeline must track task status, store results, and handle partial failures. If a failure causes an entire batch to rerun, duplicate fees may erode the discount.

    A safer approach is to shard by task, store per-item completion status, retry retryable errors with a limit, and avoid resubmitting completed tasks. For deadline-sensitive tasks, reserve budget for falling back to real-time calls.

    5. Subscriptions and Off-Peak Entitlements: Effective Utilization Is Key

    5.1 Large Quotas Do Not Necessarily Mean Real Savings

    Subscriptions usually exchange a fixed fee for some kind of call entitlement, but the entitlement may be limited by model scope, time window, request rate, validity period, and overage rules.

    To judge whether a subscription is worthwhile, first calculate:

    Effective entitlement value = the cost of calls actually covered by the subscription, calculated at ordinary usage rates

    Only when the effective entitlement value exceeds the subscription fee and related add-on costs does the subscription provide a direct financial benefit.

    Unused quota should not be treated as savings at face value, and future uncertain traffic should not be counted as realized entitlement.

    5.2 Break-Even Point Matters More Than Nominal Discount

    Assume a subscription costs CNY 600 per month and can cover up to CNY 1,000 of call usage at ordinary prices.

    If only CNY 400 worth of calls is actually used, the subscription is more expensive than direct usage. If it truly covers CNY 1,000 of calls, that portion of spending is reduced by CNY 400. Whether it is worthwhile depends on actual usage, not the maximum quota.

    If overage pricing differs, or some requests fall outside subscription coverage, calculate those separately. Do not simply divide the subscription fee by the advertised quota and treat the result as the unit price for all requests.

    5.3 Off-Peak Rules Require Scheduling Capability

    Off-peak entitlements translate into savings only when tasks can be moved into designated windows, throughput within the window is sufficient, and business deadlines are not affected.

    “Move half the requests to off-peak hours” does not necessarily mean the bill is cut in half. The actual effect also depends on the cost share of those requests, the entitlement conversion method, quota limits, and overage prices.

    6. How a Same-Price Bill Can Approach Half: A Recalculable Example

    The following is a hypothetical example only and does not correspond to any actual service.

    A business has the following monthly usage:

    • 100 million uncached input tokens;
    • 20 million output tokens;
    • Input price of CNY 20 per million tokens;
    • Output price of CNY 100 per million tokens.

    Before optimization:

    Input cost = 100 × 20 = CNY 2,000

    Output cost = 20 × 100 = CNY 2,000

    Total cost = CNY 4,000

    Assume that by organizing requests appropriately, 50% of the original input becomes cache hits, and the hit price is CNY 2 per million tokens. For this example, ignore cache add-on fees:

    Cost after cache optimization = 50 × 20 + 50 × 2 + 20 × 100 = CNY 3,100

    Further assume that 80% of the optimized cost qualifies for batch processing, and the relevant input, cached input, and output costs are settled at 60%. Assume the two mechanisms can be combined:

    Final cost = 3,100 × 20% + 3,100 × 80% × 60% = CNY 2,108

    Compared with the original CNY 4,000, this is a reduction of about 47.3%.

    This result shows that a bill close to half comes from changes in usage structure and settlement methods together, not from a change in the base unit price. It also depends on conditions such as a high cache reuse ratio, a high share of offline tasks, and combinable discounts. If any condition does not hold, the calculation should be redone.

    7. Cost Variables More Easily Missed Than Procurement Discounts

    7.1 Output Length

    When the output price is higher, overly long answers can become a major cost source. Define the necessary output fields, length range, and acceptance criteria for each task rather than always requesting detailed answers. Compressing output must not harm task completion quality.

    7.2 Historical Context

    Sending all historical messages with every turn causes input to keep expanding. Rolling summaries, structured state, and on-demand retrieval can reduce irrelevant content, but you must verify that summaries do not omit constraints and that retrieval recalls key evidence.

    7.3 Retries and Failures

    Resubmitting immediately after a timeout may lead to duplicate charges. Clients should set retry limits, distinguish retryable errors from parameter errors, and identify completed tasks where possible. Cost analysis should also record “how many calls occur on average per successful task.”

    7.4 Regions and Supporting Resources

    Different regions may have differences in pricing, network latency, and availability. Do not change deployment location solely for a lower call price; also assess data compliance, network transfer, failure rates, and business continuity.

    8. Build a Sustainable Cost Governance Process

    First, collect data from at least one representative business cycle. Record task types, input and output tokens, cached tokens, failed retries, latency, and cost. Avoid estimating only from ideal samples.

    Second, divide tasks into real-time and offline, stable-prefix and dynamic-input, and fixed-traffic and burst-traffic categories. Identify which parts each optimization mechanism can actually cover.

    Third, establish three budget scenarios: baseline, conservative optimization, and full optimization. For cache hit rates, subscription utilization, and migration ratios that have not yet been validated, keep sensitivity analysis rather than directly adopting best-case values.

    Fourth, run a small-traffic pilot and observe quality, latency, error rate, and cost together. A recommended metric is:

    Cost per effective task = total relevant cost in the period ÷ number of tasks that pass acceptance

    Fifth, reconcile the bill item by item, checking billing definitions, discount realization, quota consumption, and budget variance. Re-evaluate after model versions, billing rules, or business structure change.

    Conclusion

    The core of LLM cost optimization is not finding the smallest number on a price list. It is matching task characteristics accurately to billing mechanisms.

    Caching addresses repeated input. Asynchronous batch processing uses delivery-time flexibility. Subscriptions suit predictable workloads that can be fully utilized. Output and context governance reduce unnecessary computation. Only by putting these measures into the same recalculable, verifiable cost model can you determine whether a so-called “half-price bill” is an achievable engineering benefit or an idealized estimate that ignores its conditions.