LLM API Cost Accounting and Plan Selection: A Practical Guide

    This guide explains how to evaluate large language model (LLM) usage costs and choose between pay-as-you-go billing and prepaid credit packages. It shows how to build a verifiable per-unit cost baseline, convert credit packages into unit costs, and account for utilization, reliability, and retries. The key takeaway: judge cost by actual delivered results and full-cycle data, not by headline price.

    1. The Core of Cost Comparison: Align the Basis First, Then Discuss Price

    In high-frequency LLM usage, developers typically face two payment models: paying by actual usage, and buying a fixed credit package upfront. With the first, spending grows with call volume; with the second, you pay a fixed fee and then consume the credits within a validity period.

    Both models can seemingly be converted into “price per million units,” but the results are not necessarily directly comparable. A usage-based bill reflects spending that has already occurred, while the amortized cost of a package usually assumes that all credits will be fully consumed. If you ignore this difference, you may mistake a theoretical low unit price for actual savings.

    So evaluating LLM usage cost means answering three questions in order:

    1. Do the billed amount and the usage cover the same statistical period?
    2. Is the counted usage based on the same definition?
    3. How many effective business results did this spending ultimately produce?

    Price accounting answers the first two questions; a real selection decision must also include the third.

    2. Building a Verifiable Pay-as-You-Go Cost Baseline

    Take a set of historical usage records as an example: within a given period, spending was 31.53 yuan and the total recorded usage was 296 million tokens. A token is the unit a model uses to process text; it should not be treated as equivalent to a character count, a Chinese-character count, or a word count.

    Normalize the usage to “per million tokens”:

    296 million tokens = 296 million-token units

    The observed average cost is then:

    31.53 ÷ 296 ≈ 0.1065 yuan / million tokens

    This result can serve as the cost baseline for that period, but it should not be treated as a universally applicable quote. It is simply a blended average of the bill amount divided by the actual recorded usage, and it may be affected by the input/output ratio, different billing categories, discounts or credits, and the statistical basis.

    For example, if the usage record includes all input tokens while the bill applies different pricing rules to part of them, the computed average reflects the usage structure at that time and does not mean every call was charged at the same unit price.

    Before doing the actual accounting, check the following:

    • Whether spending is net of refunds, and whether it includes gifted credits or other deductions;
    • Whether usage includes both input and output;
    • Whether other capability tiers or task types are mixed in;
    • Whether there are billing delays, cross-period charges, or missing records;
    • Whether failed, canceled, and retried requests are counted in usage.

    For mixed-usage scenarios, do not judge the cost of one call type from the total bill alone. A more reliable approach is to break usage down by task type, capability tier, and billing category, then roll it up to the overall bill.

    3. Converting Credit Packages into Unit Costs

    Another set of historical records used a credit package: the purchase amount was 118 yuan, and within a short observation window, 964 credits were consumed, producing 24.26 million tokens of usage.

    The original record also stated a “10,000 credits per week” allowance and used 40,000 credits as the amortization base in the calculation. Note carefully: 40,000 credits corresponds to estimating across four allowance periods combined, but this does not automatically prove the package has a freely usable pool of 40,000 credits.

    Whether this calculation is valid depends on the actual rules, such as:

    • How many allowance periods the purchase amount actually covers;
    • Whether the weekly allowance refreshes independently;
    • Whether unused credits roll over;
    • Whether there are additional short-cycle usage limits;
    • Which requests consume credits, and whether the consumption ratio is the same.

    Only after these conditions are confirmed does the amortization result carry real meaning.

    Under the assumption that “the usable allowance for 118 yuan is counted as 40,000 credits,” the cost amortized to this observation window is:

    118 × 964 ÷ 40,000 = 2.8438 yuan

    Dividing again by this window’s token usage:

    2.8438 ÷ 24.26 ≈ 0.1172 yuan / million tokens

    What you get here is a cost amortized by the ratio of total allowance, not the newly paid amount within the observation window, nor a confirmed actual cost for the whole period.

    If the entire package produced only these 24.26 million tokens at expiry, with no other usage to amortize against, the actual unit cost would be:

    118 ÷ 24.26 ≈ 4.8640 yuan / million tokens

    This shows that the same package can have a very different “theoretical amortized unit price” and “final actual unit price.” The gap comes mainly from whether the allowance is fully used, not from the formula itself.

    4. Short-Term Samples Cannot Represent Long-Term Cost

    By the calculations above, the two observed values are about 0.1065 and 0.1172 yuan / million tokens. The latter is roughly 10% higher under this calculation basis.

    But this gap is only an accounting example and cannot be used to conclude that one payment model is more expensive in all scenarios. The two sets of records may come from different statistical periods, task distributions, and request structures.

    In particular, the ratio of credits to tokens is not necessarily fixed over the long term. If credit consumption is also affected by output length, task category, or other billing factors, then a conversion relationship observed within one hour cannot be directly extrapolated to a whole month.

    A more reliable comparison method is:

    1. Select a representative set of tasks;
    2. Fix the input material, output requirements, and acceptance criteria;
    3. Record the actual billed usage for each task type;
    4. Repeat observations across multiple dates and different load conditions;
    5. Aggregate the mean, the variation range, and the causes of anomalies.

    Only when task structures are sufficiently similar does the unit cost carry strong reference value.

    5. Package Utilization Determines Actual Cost

    For a fixed-price package, allowance utilization is one of the most important cost variables.

    Let the package fee be P, the total available allowance be Q, and the actually consumed allowance be q. The utilization rate is:

    utilization u = q ÷ Q

    If the credit-to-token conversion is approximately stable within the observed range and unused credits expire, then:

    actual unit cost ≈ full-usage unit cost ÷ utilization

    For example, with an estimated full-usage cost of 0.1172 yuan / million tokens:

    • At 100% utilization, actual cost is about 0.1172 yuan;
    • At 80% utilization, actual cost is about 0.1465 yuan;
    • At 50% utilization, actual cost is about 0.2344 yuan.

    These numbers are conditional estimates, not newly measured results. They reveal the basic rule of fixed packages: the more idle allowance, the higher the actual unit cost.

    If the allowance refreshes weekly and cannot roll over, you should forecast week by week rather than looking only at total demand across the whole period. A week with too few tasks and a week with concentrated tasks do not necessarily cancel out waste through averaging.

    So before buying a larger package, check both whether the per-unit allowance price drops and whether the added allowance can actually be used. A bigger package does not inherently mean better value.

    6. Factor Stability into Effective Task Cost

    Low call cost does not necessarily mean low business cost. Timeouts, failures, retries, and unqualified results all increase the resources needed to complete a task.

    But limited usage experience is not enough to prove a service is unstable over the long term. A more robust approach is to define unified metrics and observe them continuously:

    • Request success rate: whether requests complete normally;
    • Effective result rate: whether outputs meet business acceptance requirements;
    • Average attempts: how many requests it takes to complete one task;
    • Response time distribution: focus on typical latency and the latency of slower requests;
    • Manual revision time: whether outputs require substantial rework.

    You can then evaluate economics with the following metric:

    cost per effective task = total related spending in the period ÷ number of tasks completed effectively

    For businesses involving manual review, also track review and rework effort separately, so that labor cost is not hidden behind “cheap model calls.”

    Retry cost also needs careful handling: under different billing rules, failed requests may or may not be charged. Do not simply assume every failure incurs a full charge, and do not count only the bills of successful requests while omitting the actual charges of failed attempts.

    7. Building an Actionable Cost Monitoring Process

    Cost optimization should not rely on occasionally checking a balance once; it should form a traceable, verifiable recording system.

    1. Record the Minimum Necessary Fields

    For each call, retain at least the task category, request time, input/output usage, actual charge or credit consumption, completion status, retry count, and acceptance result.

    Actual charges should be reconciled against the official bill where possible; credit consumption and monetary spending should be stored separately and not merged into a single metric at the collection stage.

    Logs should also follow a minimization principle. Usually only statistical information and a task identifier are needed; there is no need to store full sensitive inputs or business outputs.

    2. Look at Cash Spending and Cost Amortization Separately

    Buying a package creates a cash outflow; using the allowance gradually allows internal cost amortization. These two tables serve different purposes:

    • The cash spending table is for budgeting and payment management;
    • The cost amortization table is for analyzing the resource usage of different tasks;
    • The actual cost table after the package ends is for validating the original forecast.

    Mixing the three leads to misjudgments like “no payment this week, so this week’s calls are free.”

    3. Alert on Budget and Allowance Separately

    For usage-based billing, watch the growth rate of spending; for packages, watch both too-fast and too-slow consumption.

    Consuming too fast may exhaust the allowance early and affect later tasks. Consuming too slowly may mean over-purchasing and eventual idle loss. Specific alert thresholds should be set from the business plan and historical data, not from a uniform number.

    8. Start Optimization by Reducing Wasteful Usage

    The most reliable path to lower cost is usually not to switch payment models immediately, but to first cut consumption that has no business value.

    You can prioritize these measures:

    • Clean up redundant context to avoid carrying unnecessary history in every request;
    • Specify output length and format to reduce lengthy but unusable results;
    • Use a capability tier that meets quality requirements for simple tasks;
    • Retry only on retryable errors, with a cap on the number of attempts;
    • Reuse existing results for repeated tasks under the same input and business conditions;
    • Schedule non-urgent tasks within available allowance periods while respecting actual usage limits.

    When reusing results, check data freshness, permissions, and task conditions; when shortening context, do not remove key facts that affect correctness. Any optimization must be premised on no degradation in result quality.

    9. Conclusion: Measure Cost by Actual Delivery, Not by Listed Price

    LLM cost evaluation should distinguish three levels: actual spending on the bill, unit usage cost under a unified basis, and the combined cost of completing effective tasks.

    Historical records can be used to build a calculation baseline, but short-term samples, the four-week allowance assumption, and full-usage conditions all need to be clearly labeled. Pay-as-you-go makes actual consumption easier to observe, while packages rely more on demand forecasting and utilization management; neither is absolutely better or worse apart from business conditions.

    For developers and enterprises, the truly reliable decision process is: first unify the statistical basis, then validate with representative tasks, then assess allowance utilization, result quality, and retry cost, and finally adjust budget and payment model based on full-cycle data. Only then can price comparison turn from a simple numbers exercise into sustainable cost governance.