LLM API Cost Estimation: Pay-as-You-Go vs. Subscription Pricing

    Compare large language model API plans by the cost of producing results that meet your quality and latency requirements, not just by the price per million tokens. Using five hypothetical workloads, this guide shows how to account for cached input, billed output, and retries; calculate subscription break-even points; and verify projected savings against actual bills.

    1. Calculate the Cost per Accepted Result Before Comparing Token Prices

    The price per million tokens is not the cost of getting a task done. Two plans with identical input rates can cost different amounts to process the same workload if they differ in billed output volume, cache usage, or the number of retries. A more useful metric is cost per accepted result: divide total charges for a given period by the number of results that pass quality checks in that period. For customer support, count successfully handled conversations. For offline extraction, count documents whose extracted data passes validation.

    Use the same test samples, quality thresholds, and latency requirements for every option. A plan that misses those requirements is not a better choice just because its projected bill is lower.

    All prices below are hypothetical and do not represent provider quotes. The examples include only the charges specified; omitted charges are not necessarily free in practice.

    2. Break Usage Costs Into Billable Components

    If a provider bills uncached input and cache-hit input as mutually exclusive categories, calculate the base usage charge as follows:

    Usage charge = uncached input × standard input rate + cache-hit input × cache read rate + billed output × output rate

    When rates are quoted in CNY per million tokens, express each usage quantity in millions of tokens. If cache reads are billed as a surcharge rather than as a substitute for standard input charges, use the billing provider’s actual breakdown instead of applying this formula directly. Add any applicable charges for cache writes, cache storage, file preprocessing, or workflow orchestration separately.

    Pay particular attention to three billing details:

    • Input includes more than the user’s message. System instructions, conversation history, retrieved passages, and parsed file content may be sent repeatedly. For multimodal requests, check whether images, audio, video, and files are converted to tokens or billed in other units. File size in bytes is not a substitute for metered usage.
    • Visible output may differ from billed output. If a provider counts reasoning tokens as output, even a short final answer can incur substantial output charges. Collect usage statistics from API responses and reconcile them with the bill. Rather than applying a fixed multiplier, use representative samples to estimate average monthly usage and samples with long outputs to assess peak costs.
    • Account for retries using actual billing records. A client timeout does not necessarily stop server-side generation. Link retry and billing records using an application-level request ID so you can identify duplicate submissions, reruns after format validation failures, and extra charges from rerunning an entire batch.

    3. Compare Pricing Across Five Workloads

    Assume standard rates of CNY 1 for uncached input, CNY 0.25 for cache-hit input, and CNY 4 for billed output, all per million tokens. Now assume two separate discounts: real-time pay-as-you-go usage is discounted by 50% across all three categories, while eligible offline batch jobs receive 50% off standard input and output rates. The discounts do not stack.

    Monthly workload Usage or assumptions Estimated cost
    Infrequent real-time requests 20 million uncached input tokens and 5 million billed output tokens CNY 40 at standard rates or CNY 20 with the real-time discount
    Long contexts with heavy reuse 200 million input tokens, including 150 million cache-hit tokens, plus 20 million billed output tokens CNY 167.50 with caching or CNY 280 without it at standard rates, a difference of CNY 112.50
    Offline jobs with flexible deadlines 500 million uncached input tokens and 50 million billed output tokens CNY 700 at standard rates or CNY 350 with batch pricing, excluding orchestration and reruns
    Steady, high-volume usage A CNY 600 subscription covers usage worth CNY 1,200 at standard rates. Actual monthly usage is worth CNY 1,100 at those rates. The subscription costs CNY 600 versus CNY 550 with the real-time discount. If pay-as-you-go pricing returns to standard rates, the subscription is cheaper.
    Variable usage that can shift off-peak Under the same subscription, usage worth CNY 600 at standard rates runs during regular hours, and another CNY 1,000 worth can run off-peak. Eligible off-peak usage consumes half the usual allowance. The workload consumes CNY 1,100 worth of allowance, so there are no overage charges. The CNY 600 subscription costs less than the CNY 800 payable at half the standard rates.

    Each workload points to a different decision. For infrequent requests, check whether the plan carries a fixed cost. For long contexts, verify that repeated prefixes actually generate cache hits. For offline jobs, make sure the delivery window can accommodate queueing and retries. Even steady, high-volume usage does not automatically justify a subscription: unused allowance can erase the advertised discount. Off-peak savings depend on how much usage actually qualifies for reduced allowance deductions, not how many jobs are marked as deferrable.

    The fourth example also gives a subscription break-even point. Assume unused allowance does not roll over and usage stays within the plan limit. Let (U) be the cost of that usage at standard rates and (d) be the fraction of the standard rate charged under real-time pay-as-you-go pricing. The subscription is cheaper when (600 < d \times U).

    At (d = 0.5), the break-even point is CNY 1,200 worth of standard-rate usage, exactly the included allowance. Below that level, the subscription costs more; at full utilization, the two options cost the same. At (d = 1), the break-even point falls to CNY 600. If you expect to exceed the allowance, include the overage rate. If off-peak usage draws down the allowance at a reduced rate, calculate consumption for each billing window before determining whether overages apply.

    4. Verify the Conditions Behind Each Discount

    Caching: Measure Bill Savings, Not Just Request Hits

    If caching depends on a stable request prefix, place fixed instructions and shared reference material first and variable content, such as order IDs or user questions, later, provided the change does not alter the task. Test cold requests, consecutive requests that reuse the prefix, and requests spaced apart. Record the number of tokens served from cache, not just the percentage of requests with a cache hit. A request can hit the cache for only a short prefix and save very little.

    To estimate net savings, multiply cache-hit volume by the difference between the standard input and cache read rates, then subtract any extra write and storage charges. If content is rarely reused or changes frequently, a low cache read rate may not justify restructuring requests.

    Batch and Off-Peak Processing: Protect Delivery Deadlines

    Batch processing works for jobs such as tagging, extracting data from historical documents, and generating recurring reports when delivery can wait. Before rollout, set the latest acceptable submission and completion times, leaving room for queueing, validation, and retries. Give each record a stable ID and track its status separately so you can rerun failed records without reprocessing the entire batch.

    For off-peak scheduling, check whether eligibility is determined by submission time, execution start time, or the time usage is billed. A job submitted during a discount window may sit in a queue and run after the window closes. Budget for jobs that cannot wait at the non-discounted rate rather than assuming ideal off-peak savings.

    Subscriptions and Promotions: Model Low, Typical, and High Usage

    At low usage, measure how much of the included allowance goes unused. At high usage, check overage rates and concurrency limits. For typical usage, use historical volumes to estimate how much of the workload the subscription would cover.

    If a promotion has no clear end date, keep two budget estimates: one at the discounted rate and one at standard rates. Use the first for the current decision and the second to assess whether to switch billing models or reschedule workloads when the promotion ends.

    5. Make the Final Decision Using Actual Bills

    Start with a small, representative pilot that includes short requests, long contexts, multimodal inputs, and failures that trigger retries. Reconcile the recorded usage with the bill. For each task type, track input volume, cache-hit volume, billed output, retry count, accepted results, and completion time. Then use historical task volumes to project monthly costs.

    After rollout, review the share of input tokens served from cache, output volume per task, the rate at which subscription allowance is consumed, and rerun costs each week. These measures help distinguish higher costs driven by business growth from increases caused by changes in request structure or discount rules.

    Rule out plans that fail your quality or delivery requirements first. Then compare cost per accepted result and check the budget impact if a promotion ends, usage falls, or work backs up. Savings you can sustain matter more than the deepest discount on a single quote.