LLM API Pricing Guide: How to Choose Cost-Effective Models After Price Hikes

    This guide breaks down how large language model API pricing works across input, cached input, and output tokens, and why looking at input price alone leads to poor model choices. It introduces a reusable cost estimation script, four practical cost-reduction strategies, and a framework for evaluating price-to-performance so you can recalculate model selection whenever upstream pricing changes.

    1. Why Pricing Changes Reshape Model Selection

    For the past two years, developers choosing a large language model API often assumed that stronger capability always comes with a higher unit price, and they focused mainly on leaderboard scores. But once an upstream provider adjusts its billing strategy, the existing cost model can break instantly: with the same application code and the same daily call volume, the monthly bill may differ by several times. As a result, cost-effectiveness is no longer a static conclusion. It needs to be redefined as the token cost paid per unit of business value.

    Note that this article does not recommend any specific vendor or product. Instead, it abstracts a general analysis framework. Pricing details across cloud providers and model families can change at any time, so developers should rely on the official billing pages. What this article offers is a methodology and a reusable estimation tool.

    2. Three Token Billing Dimensions: Input, Cached Input, and Output

    Most mainstream LLM APIs split token consumption into three separately priced categories:

    • Regular input tokens: Context in the current request that is not reused, billed at full price.
    • Cached input tokens: The portion of context that hits a prefix cache, priced significantly lower than regular input, commonly around one-tenth of the full price.
    • Output tokens: Content generated by the model, usually priced at several times the regular input rate.

    Taking the public pricing pattern of a certain general-purpose model family as an example, a clear three-tier positioning often forms within the same family: a flagship tier for complex reasoning and specialized tasks, a mid-tier that balances capability and cost, and a lightweight tier for high-concurrency, cost-sensitive scenarios. Across the three tiers, output pricing generally maintains a ratio of “output is about six times regular input.” For instance, regular input ranges from a few tenths of a dollar to five dollars per million tokens, while the corresponding output ranges from just over a dollar to thirty dollars.

    This ratio leads to a key inference: the higher the output proportion of a workload, the more easily output unit price amplifies cost. Pure summarization, long-form generation, and code completion scenarios are especially affected.

    3. Why Looking at Input Price Alone Leads to the Wrong Model

    Many teams compare only input prices when selecting a model, which is the most common mistake. The real bill is determined by the following formula:

    1. Total cost = input tokens × input price
    2. + cached input tokens × cached price
    3. + output tokens × output price

    Suppose a workload averages 100,000 requests per day, each with 2,000 input tokens and 800 output tokens, giving an input-to-output ratio of 2.5:1. Comparing a flagship tier (input 5, output 30) with a lightweight tier (input 0.2, output 1.2), the difference in output alone can reach tens of times, and the input difference is further amplified by the output term. The conclusion is straightforward: in scenarios where output is not a small proportion, a mid- or low-tier model combined with good prompt engineering is often more cost-effective than a flagship model.

    4. A Reusable Cost Estimation Script

    It is a good idea to capture the estimation in a script, so any price change can produce a new conclusion within minutes:

    1. def estimate_cost(reqs, in_tok, cache_tok, out_tok,
    2. p_in, p_cache, p_out):
    3. total = 0.0
    4. for _ in range(reqs):
    5. total += (in_tok * p_in + cache_tok * p_cache
    6. + out_tok * p_out) / 1_000_000
    7. return total
    8. # Price per million tokens (illustrative values; replace with the latest official prices)
    9. scenarios = {
    10. "flagship": dict(p_in=5.0, p_cache=0.5, p_out=30.0),
    11. "balanced": dict(p_in=2.0, p_cache=0.2, p_out=12.0),
    12. "light": dict(p_in=0.2, p_cache=0.02, p_out=1.2),
    13. }
    14. for name, price in scenarios.items():
    15. cost = estimate_cost(100_000, 2000, 0, 800, **price)
    16. print(name, round(cost, 2))

    5. Four Cost-Reduction Paths

    1. Improve cache hit rate: Place system prompts, long documents, and fixed knowledge blocks at the very front of the context, and keep the prefix stable to maximize the proportion of cached input.
    2. Compress output length: Use structured output to constrain redundant phrasing, and set clear limits on word count and fields, since output tokens are often the most expensive part.
    3. Tiered routing: Send lightweight tasks such as intent recognition and format validation to the lightweight tier, and escalate complex reasoning to the flagship tier.
    4. Quotas and observability: Use logging services and monitoring alerts to aggregate token consumption by business dimension, and set budget threshold alerts to prevent abnormal calls from inflating the bill.

    6. Putting a Cost-Effective Strategy into Practice on Baidu AI Cloud

    If you use Baidu AI Cloud’s large model services, you can combine general cloud product capabilities to build a complete cost governance loop: use object storage to archive request and response samples, use a message queue to smooth out traffic peaks and control concurrency, use a container platform to host routing and caching services, and use logging services and monitoring alerts to achieve token-level attribution. For model selection, it is likewise recommended to rely on the official billing documentation, first run a small-traffic canary estimation, and then gradually ramp up.

    7. Conclusion

    Price adjustments are not frightening; what is frightening is sticking to the old evaluation approach. Break the cost into three segments—input, cached input, and output—quantify it with a script, and optimize it with architectural means, and cost-effectiveness turns from a subjective feeling into a recomputable engineering metric.