Cutting LLM API Costs After Price Increases: Tiered Model Selection and Migration Practices

    When LLM API prices rise, unit price alone is a poor guide to actual spending. This article breaks down how API billing really works—input tokens, cache-hit pricing, output tokens, and time-based rates—then shows how to turn "cheaper alternatives" into a measurable metric, tier tasks by difficulty, latency, and risk, and prioritize scheduling optimizations over risky model swaps.

    1. Background: After a Price Increase, Unit Price Is No Longer the Only Metric

    When a provider adjusts prices, the most immediate team reaction is to compare unit prices. But the actual bill depends on multiple factors: model tier, token type, billing time window, and the input and output lengths of each task. A single price change can make some use cases more expensive while making others cheaper. So the first step in responding to a price increase is to break the billing structure apart and calculate line by line, rather than estimating total spend with a uniform multiplier.

    “Cheaper alternatives” also need to be redefined. Here, an alternative means the calling option with the lowest cost per task, provided quality meets a defined standard. The alternative model is not necessarily the cheapest model, and it does not mean replacing all calls immediately. A low-cost model that fails the quality bar simply shifts costs into rework, manual review, and production incidents.

    2. Breaking Down the Billing Structure

    Most LLM API billing can be summarized in four dimensions:

    1. Input tokens: the length of user prompts and context.
    2. Cache-hit input: input billed when the context prefix is reused from server-side caching, usually far cheaper than a cache miss.
    3. Output tokens: the length of generated content, typically the highest unit price.
    4. Time-based rates: some providers price by time window—peak hours cost more, off-peak hours get discounts.

    The table below uses illustrative values to explain the billing structure; these are not the actual prices of any provider. Unit: CNY per million tokens.

    Tier Time window Cache-hit input Cache-miss input Output
    Standard Off-peak 0.01 0.20 0.60
    Standard Peak 0.02 0.40 1.20
    Advanced Off-peak 0.03 0.60 1.80
    Advanced Peak 0.06 1.20 3.60

    The gap between cache-hit and cache-miss pricing can reach tens of times, and output unit prices are roughly three times cache-miss input. This means prompt structure and output length often affect cost more than the model name itself.

    The following function estimates the cost of a single call across these four dimensions:

    1. def estimate_cost(input_tokens, output_tokens, cached_tokens, price):
    2. """
    3. price is a dict of unit prices per million tokens.
    4. cached_tokens is the number of input tokens served from cache;
    5. it must not exceed input_tokens.
    6. """
    7. uncached_tokens = input_tokens - cached_tokens
    8. cost = (
    9. cached_tokens * price["cache_hit_input"]
    10. + uncached_tokens * price["input"]
    11. + output_tokens * price["output"]
    12. )
    13. return cost / 1_000_000

    Take a task with an average input of 6,000 tokens—4,000 of which hit the cache—and 800 output tokens:

    • Standard tier, peak: 4000×0.02 + 2000×0.40 + 800×1.20 = 1840, i.e., about 0.00184 CNY.
    • Standard tier, off-peak: 4000×0.01 + 2000×0.20 + 800×0.60 = 920, i.e., about 0.00092 CNY.

    The same task costs twice as much purely because of when it runs. Scheduling optimization is often the fastest cost-saving win available.

    3. Making “Cheaper Alternatives” a Quantifiable Metric

    Cost per task should include three components:

    Cost per task = cost per call × average number of calls (including retries) + rework cost of failed tasks + necessary manual review cost

    Looking only at per-call cost underestimates the overhead of retries and rework. For example, a model with a unit price 40% lower but a high format-error rate that averages two retries can end up more expensive overall.

    Quality also needs to be quantified. Common metrics include:

    • Task pass rate: the proportion passing automated validation.
    • Key-field accuracy: the proportion of correctly extracted key information in extraction or classification tasks.
    • Format compliance rate: whether output matches the agreed structure, e.g., whether JSON fields are complete.
    • Human acceptance rate: the proportion of results adopted by business users without modification.

    Define quality thresholds before selecting models, using a baseline model’s performance as the reference. Once thresholds are set, only compare costs among options above them.

    4. Task Tiering: By Difficulty, Latency, and Risk

    Tiering is the core technique for controlling migration risk. The criteria for the three dimensions are:

    • Difficulty: does the task require multi-step reasoning, long-context understanding, or complex code generation?
    • Latency: is the user waiting in real time, or can minute- or hour-level delays be tolerated?
    • Risk: would incorrect output cause financial loss, compliance issues, or security incidents?

    This yields four tiers:

    Tier Typical tasks Recommended strategy
    L1 Simple Format conversion, text classification, keyword extraction, short summaries Low-cost model; can run in offline batch processing
    L2 Medium Standard Q&A, copy rewriting, structured extraction Standard tier, combined with time-window scheduling
    L3 Complex Multi-step planning, code generation, complex analysis Advanced tier, keep a stable channel
    L4 High-risk Content involving money, compliance, or medical judgment Advanced tier plus manual review; never downgrade

    Tier assignments should live in configuration, not in developers’ ad hoc judgment. Revisit tier assignments periodically, since business changes can alter a task’s difficulty and risk.

    5. Schedule First, Swap Models Later

    Scheduling optimizations carry less risk than switching models and should be implemented first. Concrete measures include:

    • Offline batch processing: nightly reports, bulk tagging, and similar jobs can be moved to off-peak windows to take advantage of discounted rates.
    • Prompt caching: structuring prompts so that stable prefixes hit the server-side cache significantly reduces input costs.
    • Output length control: constraining output length addresses the most expensive billing dimension directly.

    Only after scheduling gains are exhausted should teams consider model replacement—and even then, start with L1 and L2 tasks, validate against quality thresholds, and expand gradually.