How to Recalculate Real LLM API Costs After a Price Change

    When an LLM API changes its pricing, focusing only on the per-token discount is misleading. Real costs depend on the mix of uncached input, cached input, and output tokens, peak/off-peak time distribution, retries, and output length. This article walks through how to turn a pricing table into a verifiable business cost model: building the right calculation formulas, understanding why total token counts cannot reproduce a bill, evaluating a price change by re-pricing historical requests, optimizing costs through peak/off-peak scheduling, cache hit rate, and output governance, and measuring success with cost per accepted task rather than price per million tokens.

    1. Evaluating a Price Change Is Not Just About “How Much It Dropped”

    When an LLM API adjusts its pricing, developers tend to focus on unit price changes: whether input got cheaper, whether output returned to earlier levels, and whether cache pricing dropped further. But the question a business actually needs to answer is different: at the same volume and quality requirements, how much does it cost to complete one task?

    These are two distinct questions. A pricing table describes resource unit prices; a business bill is determined by unit prices, request composition, execution time, and failed retries. Even if input pricing returns to an earlier level, the total cost will not necessarily recover if output remains more expensive, or if more of your actual traffic falls into higher-priced time windows.

    Therefore, evaluating a price change requires at least three baselines:

    • Versus the immediately preceding price period: does the change directly reduce recent spending?
    • Versus earlier historical pricing: has the cost genuinely returned to past levels?
    • Versus business output: has the cost of completing the same task at the same quality decreased?

    These baselines must not be conflated. For example, “cheaper than the last period” and “still more expensive than historical levels” can both be true at the same time — they are not contradictory.

    2. Turning Pricing Information into a Computable Model

    To avoid treating unverified pricing information as current rules, the numbers below are abstracted from reference material purely as a teaching example. They do not correspond to any specific service and do not represent actual current pricing.

    Assume the billing items for a model API during off-peak hours change as follows, all in CNY per million billable tokens:

    Billing item Before After Unit price change
    Uncached input 1.5 1.0 Down ~33.3%
    Output 4.5 4.0 Down ~11.1%
    Cached input 0.05 0.02 Down 60%

    One critical prerequisite: confirm whether “input” in the billing documentation refers specifically to uncached input. Some bills display both total input volume and cached input volume, where the latter may be a subset of the former. Adding the two fields directly would double-count the cached portion.

    Assuming cached and uncached input are mutually exclusive categories, the cost for a single billing window can be written as:

    Cost = (uncached input × uncached input price + cached input × cached input price + output × output price) ÷ 1,000,000

    If multiple billing windows (e.g., peak and off-peak) exist, calculate each window separately and sum them:

    Total cost = sum of costs across all billing windows

    A single peak/off-peak multiplier can only be applied to the overall cost if all billing items share the same multiplier. If different items have different multipliers, each item must be computed individually — a single coefficient cannot summarize the whole.

    In addition, tokens are not Chinese characters, nor are they equivalent to character counts. Different text content and tokenization rules affect token counts. Production budgets should rely on actual usage statistics from responses or billing data, not estimates based on article word counts.

    3. Why Total Token Volume Cannot Reconstruct a Real Bill

    If all you know is that a task consumed roughly 35 million tokens in total, you still cannot accurately compute the cost, because the total says nothing about resource composition.

    The same one million tokens might consist mainly of:

    • Public prompt content that hit the cache;
    • New input that missed the cache;
    • Long-form output generated by the model;
    • Repeated consumption from failed retries.

    Each of these has a completely different unit cost and optimization approach.

    Using the adjusted example prices above, two request sets with identical total volume of one million tokens might produce the following off-peak costs:

    Request structure Uncached input Cached input Output Cost
    Case A 100K 800K 100K 0.516 CNY
    Case B 100K 100K 800K 3.302 CNY

    Both sets have the same total volume, but Case B costs about 6.4 times as much as Case A. The reason is not a statistical error — it is the much higher share of output tokens.

    This means that when you see a statement like “this call would cost X under one price and Y under another,” you cannot validate it against total token volume alone. To verify whether the calculation is reliable, you need at minimum: uncached input volume, cached input volume, output volume, and the distribution across billing windows.

    Without these fields, any quoted amount is at best an estimate under specific conditions and cannot be generalized to other workloads.

    4. Assessing the Impact of “Input Recovered, Output Still Expensive”

    Assume that in an earlier historical period, the off-peak output price was 2 CNY per million tokens, while the adjusted price is 4 CNY per million tokens, with input and cache pricing fully restored to historical levels.

    Then, under identical request structure and billing window distribution, the difference between current and historical cost is:

    Cost increase = output volume ÷ 1,000,000 × (4 − 2)

    This relationship shows that if only output pricing has not recovered, whether the bill approaches historical levels depends on output volume — not on total token volume.

    For tasks that heavily reuse fixed materials and generate only short conclusions, the overall cost may be fairly close to historical levels. For output-intensive tasks such as long-form writing, section-by-section analysis, and detailed explanations, the gap can be much more pronounced.

    Therefore, “overall pricing restored” is a statement that should be used with caution. A more accurate phrasing is: some billing items have been restored, but the final business cost still depends on usage structure.

    5. Evaluate Price Changes by Replaying Historical Requests, Not by Guessing from Averages

    The most reliable way to assess the impact of a price change is to re-price the same batch of historical requests.

    First, select samples that represent real business traffic, covering high- and low-load periods, different text lengths, different task types, and failed retries. Choosing only a handful of successful requests tends to underestimate actual spending.

    Second, retain the following information for each request:

    Category Recommended fields
    Time Request start time, completion time, billing window
    Usage Total input, cached input, uncached input, output
    Execution Success status, retry count, total duration
    Business Task type, whether it passed quality acceptance
    Pricing Applicable price version, effective period

    Third, compute the cost of the same batch of requests under both the old and new prices. This fixes the request structure and isolates the effect of the price change alone.

    If pricing and the model version changed at the same time, run separate experiments. Otherwise, a cost decrease might come from shorter model outputs or from more failed tasks — not necessarily from the unit price adjustment.

    For services with peak/off-peak windows, also confirm the time zone, the effective boundaries, and the attribution rule for requests spanning windows. Whether a request is billed by start time or some other rule must be based on the actual documentation, not on assumptions.

    6. Peak/Off-Peak Scheduling: Moving Deferrable Tasks Away from Expensive Windows

    If a service explicitly defines peak/off-peak price differences, time-based scheduling becomes a cost optimization lever. But not every task is suited to waiting.

    Interactive Q&A, real-time assistance, and interactive generation are usually latency-sensitive and cannot queue indefinitely for cheaper windows. Offline summarization, batch classification, historical document processing, and periodic reporting typically have scheduling flexibility.

    In practice, tasks can be divided into three categories:

    1. Real-time tasks: prioritize response deadlines; cost optimization focuses on shortening context and controlling retries.
    2. Near-real-time tasks: allow bounded queuing; prefer low-cost windows within the deadline.
    3. Offline tasks: schedule centrally through a task queue, with failure compensation and progress checks.

    One important caveat: off-peak windows do not imply unlimited capacity. If a large number of tasks are submitted simultaneously at the start of a window, the result can be queuing, rate limiting, and retries that offset part of the savings.

    A more robust approach is to ramp up smoothly, set concurrency limits, and reserve buffer time before deadlines. Also note that concurrency is not the same as throughput: the longer the average request duration, the fewer requests the same concurrency level can complete.

    7. Cache Optimization Focuses on the Stability of Reusable Input

    A lower cache unit price only translates into savings when requests actually hit the cache. You cannot assume cache billing just because requests share the same topic.

    Cache rules may differ across services, including whether automatic reuse is supported, minimum cacheable length, time-to-live, and matching method. Verify the specific rules before implementation.

    For common prefix-reuse schemes, consider:

    • Placing stable task instructions and shared materials at the front;
    • Placing variable content such as user questions and dynamic timestamps at the end;
    • Reducing unnecessary formatting changes and random text;
    • Observing hit rates through actual usage fields rather than judging by request content alone.

    Cache optimization must also respect data isolation requirements. Do not mix sensitive information from different users into shared context just to raise hit rates, and do not treat inference caches as reliable long-term storage.

    At the same time, track both the “share of cached tokens” and the “actual amount saved.” When output costs dominate the bill, even a significant improvement in cache hit rate may have limited impact on total spend.

    8. Controlling Output Costs Without Sacrificing Task Completeness

    When output prices drop less than input prices, output governance becomes even more important. But simply telling the model to “write less” tends to cause missing key information and follow-up questions, which increases total consumption.

    More effective approaches define delivery requirements explicitly:

    • Classification tasks return only the category and necessary justification;
    • Extraction tasks restrict output to defined fields and avoid repeating the source text;
    • Report tasks fix the outline and length first, then expand;
    • Q&A tasks lead with the conclusion and add explanation on demand;
    • Long-form tasks set reasonable output limits and check for truncation.

    The goal is to eliminate worthless repetition, not to compress necessary reasoning. If an overly short answer forces the user to ask multiple follow-ups, the individual request is cheaper, but the complete conversation may cost more.

    Therefore, the unit of optimization should not be a single request — it should be a complete business task.

    9. Incorporating Retries and Quality into Cost Metrics

    Production bills often include more than successful requests. Timeouts, rate limiting, network errors, and unqualified results can all trigger repeated calls.

    Governance should distinguish failure causes: transient errors can be retried with bounded backoff; parameter errors should be fixed before resubmitting; unsatisfactory business results call for reviewing prompt design, input quality, or task decomposition — not unconditional repetition.

    For timed-out requests, also note that the client not receiving a result does not necessarily mean the server did not complete processing. Whether a charge applies should be determined by actual records.

    It is recommended to upgrade the core metric from “price per million tokens” to:

    Effective task cost = total cost of related calls in the period ÷ number of tasks passing quality acceptance

    Supporting metrics should include task pass rate, end-to-end latency, average retry count, output completeness rate, and manual rework rate. Cost reduction only has business value when quality and timeliness requirements are met.

    10. Building a Sustainable Cost Management Loop

    A price change should trigger more than a spreadsheet update — it should drive improvement of the metering system. An actionable process looks like this:

    First, verify the effective time of pricing, billing items, peak/off-peak boundaries, and cache counting rules. Avoid treating examples or historical information as current rules.

    Second, re-price the same batch of historical requests to separate the effect of price changes from volume changes.

    Third, analyze output-intensive, cache-intensive, and latency-sensitive tasks separately instead of applying a single optimization strategy.

    Fourth, validate scheduling, context, and output strategies on a small share of traffic while monitoring cost, quality, and latency together.

    Fifth, regularly reconcile predicted costs against actual bills, investigate discrepancies, and continuously refine the budget model.

    Evaluating an LLM API price change should not stop at “it went up” or “it went down.” A genuinely useful conclusion states: which tasks benefit, which tasks remain expensive, what factors cause the difference, and how to reduce waste without lowering delivery quality. Turning a pricing table into a verifiable business cost model is the durable capability developers and enterprises need to handle pricing volatility.