How to Evaluate Cost-Effectiveness and Choose an LLM API After Price Increases

    Several LLM API providers have recently raised prices, and some models once known for low costs now charge noticeably more per input and output token. This article explains how LLM API billing works, why a per-token price comparison is misleading, and how to measure effective cost on your own workload. It also covers four cost optimization strategies and a five-step framework for choosing a model.

    1. Background: Selection Pressure After Price Increases

    Over the past few months, several LLM providers have changed their API pricing. Some models that were previously seen as low-cost now have clearly higher input and output token prices. Developers and companies that build applications on LLMs now face a problem: choosing the cheapest model per token no longer works.

    The cost of an LLM API is not a single number. It depends on several factors, including model tier, input token price, cached input discount, output token price, and context length. To find the best value, you first need to understand how billing works, then estimate costs based on your workload. Comparing one price table is not enough.

    2. Understanding Token Billing: Three Key Components

    Under the pricing models common in the industry, the cost of one API call usually has three parts:

    1. Input token cost

    This is the cost of the prompt you send to the model. Input prices for flagship, balanced, and lightweight models often differ by several times, and sometimes by tens of times. In one common pricing structure, the input price of a leading provider’s flagship model is about 25 times that of its lightweight model. If you send all requests to the flagship model, costs can grow by orders of magnitude.

    2. Cached input cost

    When many requests share the same prefix, such as a fixed system prompt, knowledge base excerpts, or few-shot examples, the cached portion is usually billed at about one-tenth of the regular price. This dimension is often overlooked, but it offers large savings. If your application uses a long, fixed system prompt, your cache hit rate largely determines the size of your bill.

    3. Output token cost

    This is the most commonly underestimated cost. Across many providers, output prices are several times higher than input prices. In one typical pricing structure, the output price is about 6 times the input price. This means an application that generates thousands of words per response spends most of its budget on generation, not on input. For reasoning models, hidden reasoning tokens are also billed as output, so watch them closely.

    The cost of a single call can be summarized with this formula:

    1. Cost = regular input tokens × input price
    2. + cached input tokens × cached input price
    3. + output tokens × output price

    3. Cost-Effectiveness Is Not Just Unit Price: Measuring Effective Cost

    Looking only at a price table can be seriously misleading. A more accurate method is to calculate the actual cost of one completed business task, which is the effective cost:

    1. Effective cost = average cost per task ÷ task success rate

    Consider two typical scenarios:

    • Scenario A: Code generation. A cheap lightweight model costs little per call, but its correctness is only about 60%, so you may need repeated retries or manual fixes. A flagship model may cost 20 times as much per call, but pass on the first try 90% of the time. When you calculate the cost of producing one usable code snippet, the gap can shrink to a few times, or the flagship model may even come out cheaper.
    • Scenario B: Text classification or labeling. The task is simple and the format is fixed. A lightweight model achieves nearly the same success rate as a flagship model, so paying the flagship premium is wasteful.

    In short, cost-effectiveness = capability fit × stability ÷ total cost of ownership. Before choosing a model, run a small benchmark on your own real data instead of relying only on public leaderboards.

    4. Four Practical Cost Optimization Strategies

    Beyond choosing a model, engineering techniques can often reduce costs more than switching to a cheaper model.

    1. Model routing

    Build a tiered request system. First, use rules or a lightweight model to estimate task difficulty. Send simple requests to lower-cost tiers, and send only complex tasks to the flagship model. In practice, more than 70% of production requests are usually simple, so routing can substantially reduce costs. Example code:

    1. def route(query):
    2. tier = classify_difficulty(query) # Lightweight model or rule-based check
    3. if tier == "simple":
    4. return call_model("lite", query)
    5. elif tier == "medium":
    6. return call_model("balanced", query)
    7. return call_model("flagship", query)

    2. Maximize cache hit rate

    Place fixed content, such as the system prompt and business knowledge, at the beginning of the prompt, and keep that prefix unchanged so caching works as much as possible. Avoid putting content that changes on every request, such as timestamps or random IDs, at the start of the prompt. These values break the cached prefix, and the bill can rise by nearly 10 times.

    3. Control output length

    Since output tokens cost much more than input tokens, limit generation actively. Specify the response format and word limit in the prompt, use structured output instead of free-form text, and for long documents, generate an outline first and then write each section. For reasoning models, check whether deep thinking mode is really necessary, because thinking tokens are billed as output.

    4. Set up usage monitoring and budget alerts

    Use logging and monitoring tools to track token usage by business line and model tier. This helps you find abnormal calls, such as retry loops or prompt growth. Cost overruns are often caused by a lack of observability, not by pricing alone.

    5. A Five-Step Framework for Model Selection

    Based on the analysis above, follow these steps to choose an LLM:

    1. Profile your workload: Measure the average input and output tokens for typical tasks, the call frequency, and latency requirements.
    2. Build an evaluation set: Collect 100 to 500 real business samples and label the expected outputs.
    3. Benchmark multiple tiers: Test the flagship, balanced, and lightweight tiers on the same evaluation set and record success rates.
    4. Calculate effective cost: Combine the price table with your caching strategy to determine the actual cost of completing one unit of work on each tier.
    5. Design a hybrid architecture: Combine multiple tiers through model routing, and keep the ability to switch providers to avoid deep dependence on a single vendor.

    At the infrastructure level, you can also deploy model services on a cloud platform that offers elastic scaling, object storage, and message queues. For example, Baidu AI Cloud provides support from model calls to application deployment, which makes it easier to manage costs and resources in one place.

    6. Conclusion

    Price changes are a normal part of an industry that is maturing. Chasing the cheapest model is a short-term strategy. A sustainable approach is to understand the billing structure, measure effective cost with real data, and use engineering practices to get the most value from every token. The answer to cost-effectiveness is not in the price table. It depends on your workload and architecture. When prices change again, a sound evaluation framework is worth more than any option that is cheapest today.