LLM Inference Cost Tiers and Model Selection: A Practical Guide

    This guide explains how to control large language model inference costs by matching model tiers to task complexity, choosing the right billing model, improving prompt cache hit rates, and adding routing, fallback, and budget observability. It covers subscription versus pay-per-token pricing, a simplified cost model, task-to-tier mapping, and common cost optimization mistakes.

    1. Why “Affordable” and “Effective” Are Starting to Conflict

    Over the past two years, LLM capabilities have improved rapidly. However, developers and enterprise users quickly ran into a practical problem: the more capable a single call is, the higher the unit cost tends to be. If a team routes every request to the most capable model, the bill can spiral out of control within weeks. Conversely, if the team uses only lightweight models to save money, success rates on complex tasks drop noticeably.

    As a result, model selection is no longer just a question of “which model is stronger.” It is a combinatorial optimization problem: which task, which tier, and which billing method. This article abstracts away specific vendors and model names, keeping only the transferable pricing structures and engineering methods.

    2. Two Billing Paradigms and Their Core Differences

    2.1 Subscriptions: Hidden Quotas Expressed as Request Ranges

    Subscription plans usually express quotas as a range of available requests per five-hour window. Under the same subscription, different model tiers may allow anywhere from a few requests to several thousand—a difference of tens of times. Three points deserve attention:

    • The range is not a guaranteed value. It fluctuates based on task complexity, context length, and the number of tool-calling rounds.
    • Higher-tier models consume more per call, so their request ranges are narrower.
    • Some plans remove short-window limits but introduce longer weekly quotas.

    Engineering implication: under a subscription, the real constraint is weighted consumption per unit of time, not the raw number of requests.

    2.2 Pay-Per-Token: Three Token Types Determine the Real Bill

    Pay-per-token billing is typically split into three unit prices: input, cached input, and output. These can differ by an order of magnitude, with cached input the cheapest and output the most expensive. A 4x price gap between adjacent tiers is common.

    A simplified cost model:

    1. cost per call = input tokens × P_in
    2. + uncached input tokens × P_in
    3. + cached input tokens × P_cache
    4. + output tokens × P_out

    Because output has the highest unit price and generation length is usually determined by business needs, output tokens are typically the first priority for cost optimization.

    3. The Underrated Variable: Cache Hit Rate

    Cached input is far cheaper than regular input, making it the most easily overlooked cost-reduction lever. The key to improving the hit rate is separating the “stable prefix” from the “changing suffix”:

    1. # Bad example: putting the timestamp first changes the prefix every time and invalidates the cache
    2. prompt = f"Current time {now()}, here are the project specs..."
    3. # Good example: stable content first, dynamic content last
    4. prompt = SYSTEM_SPEC + "\n\n" + f"Current time {now()}, user question: {query}"

    Supporting practices include: keeping the order of system prompts and tool descriptions fixed, placing retrieval results at the end, and avoiding random IDs inside long prefixes.

    4. Mapping Capability Tiers to Task Layers

    Based on common patterns in public evaluations, adjacent tiers may differ by only a fraction of a point on some coding benchmarks while costing several times more. This shows that the “highest tier” is not necessary for every task. A practical tiering recommendation:

    Task Type Recommended Tier Reason
    Code completion, formatting, document summarization Lightweight High fault tolerance, short context
    Routine debugging, unit test generation, standard data analysis Mid-tier workhorse Balances quality and cost
    Large-scale refactoring, cross-module design, research-grade reasoning High tier Clear gains from long-chain reasoning

    5. Routing and Fallback: Put the Policy in Code

    Tiering cannot rely on manual conventions alone; it should be decided centrally by a gateway:

    1. def select_tier(req):
    2. if req.context_tokens > 60000 or req.tool_calls > 5:
    3. return "high"
    4. if req.task_type in {"refactor", "math_proof"}:
    5. return "high"
    6. if req.task_type in {"chat", "summary", "lint_fix"}:
    7. return "light"
    8. return "mid"
    9. def invoke(req):
    10. tier = select_tier(req)
    11. try:
    12. return call_model(tier, req)
    13. except RateLimitError:
    14. return call_model("light", req) # fall back when quota is limited

    The key points: routing rules should be configurable and support gradual rollout, and fallback events should be instrumented to avoid quality issues caused by “silent degradation.”

    6. Observability and Budget Governance

    Cost governance starts with visibility. At minimum, collect these dimensions: task type, tier, input/output tokens, cache hit ratio, time to first token, and failure and fallback counts. Based on these metrics, you can set up:

    • Budget thresholds and alerts by project and environment;
    • A per-request output length cap to prevent abnormal long generations;
    • Automatic fallback to mid- or low-tier models during peak hours;
    • Weekly quota consumption curves to spot abnormal calls early.

    7. Common Mistakes

    1. Looking only at unit price and ignoring output length: in scenarios with a high output share, price gaps are amplified.
    2. Ignoring cache structure: an unstable prefix makes the cheapest input tier effectively useless.
    3. Converting subscription request counts directly into capacity: the range is affected by task complexity and must be measured in practice.
    4. Switching to a new tier all at once: start with a small traffic comparison of quality and cost, then ramp up gradually.

    8. Conclusion

    The core of LLM cost optimization is not finding “the cheapest model,” but building a closed loop of “task tiering + cache-friendly prompts + routing and fallback + observable budgets.” In general engineering practice on platforms such as Baidu AI Cloud, this framework applies as well: first run small-scale load tests to obtain the real token distribution, then determine the traffic share for each tier accordingly, and finally use monitoring and budget alerts to continuously calibrate. Only then can you achieve a stable balance among quality, latency, and cost.