LLM API Pricing Increases: Cost Logic and Model Selection Practices

    This article breaks down the cost structure behind large language model inference and explains why per-token prices alone are a poor basis for comparison. It covers the three-part pricing model of input, output, and cache-hit tokens, the first principles that make model size and price non-linear, and a practical function for converting API rates into per-task cost. It also shows how to evaluate subscription quotas, optimize context and caching, and build a selection checklist for predictable spending.

    In recent years, frequent price adjustments to LLM services have sparked ongoing discussion: newer generations of models increase output prices several times over as parameter counts grow, while cache-hit prices drop significantly. For developers, fixating on unit price has limited value. What actually determines cost is the pricing structure, how context is managed, and how much of a subscription quota is genuinely usable. This article takes a neutral view of the components of LLM inference cost and offers a practical method for evaluating and optimizing it.

    1. Deconstructing the Phenomenon: A Price Increase Is Not a Single Number

    The pricing structure in the original discussion can be abstracted into three parts: input unit price, output unit price, and cache-hit unit price. These three often differ by an order of magnitude. The cache-hit price is the lowest, which shows that reusing already-computed intermediate state on the server side can significantly save compute. The output price is the highest, because token-by-token autoregressive generation cannot be parallelized and occupies compute for the longest time.

    So when you see “the price went up several times,” ask three things first: does the unit price apply to input or output; is cache hit distinguished; and is the billing unit per million tokens or per thousand tokens. The same statement of “a fivefold increase” can have very different effects on a bill depending on the pricing basis.

    Inference cost is mainly made up of three parts: memory bandwidth pressure from loading weights, the floating-point operations required to generate each token, and the quadratic growth of attention computation under long context. Larger parameter counts usually mean higher memory usage and lower batch concurrency, so the fixed cost amortized per token rises.

    But unit price is not determined by size alone. Quantization schemes, sparse structures, cache reuse, and batch scheduling all push unit price back down. This explains a common phenomenon: a larger model can have a lower unit price, while another generation raises its price after increasing in size. When judging cost-effectiveness, focus on “the total cost of completing a unit of work” rather than the price sheet.

    3. Converting API Unit Price into Task Cost

    Assume a certain class of task consumes on average: 200,000 input tokens, 20,000 output tokens, and a 60% cache hit ratio. The billable token amount is then:

    1. def task_cost(input_tok, output_tok, cache_hit_ratio,
    2. p_in, p_out, p_cache):
    3. cached = input_tok * cache_hit_ratio
    4. fresh = input_tok - cached
    5. return (fresh * p_in + cached * p_cache + output_tok * p_out) / 1_000_000

    This function shows a key conclusion: the cache hit ratio and input size are the dominant variables of cost, while the impact of output length is often underestimated. For long-text understanding and whole-codebase analysis tasks, input is far larger than output, and the benefit of a caching strategy is amplified.

    4. Subscription Quotas: A Metric More Worth Comparing Than Unit Price

    For the vast majority of individuals and small teams, the pay-as-you-go price sheet is only a reference baseline; actual spending depends on the quota design of the subscription plan. When evaluating, convert the plan into three comparable quantities: the usable quota per unit of time, the quota reset cycle, and how fast the quota decays on long-context tasks.

    A practical conversion is to use the percentage of the plan’s total available quota consumed by one typical task to work backward to “how many rounds per day.” If one round of a medium-scale front-end interface optimization task consumes sixty percent of a single session window and more than ten percent of the weekly quota, then the plan’s actual positioning is “one round per day,” and it is not suited to high-frequency continuous refactoring.

    5. Engineering Optimization of Context and Caching

    The core of cost optimization is not compressing output but increasing the input reuse rate:

    • Stable prefix: put the system prompt, project conventions, and directory description at the very front of the context, avoiding frequent changes that invalidate the cache.
    • Segmented feeding: split files by module and load only the relevant fragment at a time, avoiding stuffing the whole codebase in.
    • Structured summary: first have the model produce module-level summaries, then carry only the summary and diff fragments in later rounds.
    • Incremental modification: define the boundary of “refine rather than refactor” to reduce output bloat from large-scale rewrites.
    1. [Fixed prefix: conventions and directory] -> [Module summary] -> [Current diff fragment] -> [Task instruction]

    6. Selection Decision Checklist

    1. Clarify the task type: long-text understanding, code refinement, and data analysis differ in sensitivity to caching and long context.
    2. Run small-scale benchmarks with real tasks, recording input and output tokens and elapsed time.
    3. Compare the actual usable quota of subscription plans rather than the price sheet.
    4. Build a usage dashboard with monitoring and alerts for input tokens, cache hit ratio, and per-task cost.
    5. Keep multi-model routing: send simple tasks to a low-cost option and call a higher-capability model only for difficult tasks.

    7. Conclusion

    Price fluctuations are the norm; engineering capability is the controllable variable. Shifting focus from “how much the unit price rose” to “per-task cost, cache hit ratio, and quota utilization” is what keeps costs predictable in an environment of accelerating model iteration. If you need unified usage collection and visualization, you can build a general dashboard on the log service and monitoring and alerting capabilities of Baidu AI Cloud, attributing cost to specific tasks and modules.