LLM Selection Guide: Total Cost Beats Per-Token Price

    Per-token list price is only one factor in LLM cost. This guide covers unit-task cost, input/output/cache billing, knowledge cutoffs, frontier-vs-efficient routing, a sample cost formula, and cloud engineering practices so you can evaluate models on what actually hits the bill.

    Why unit price is not total cost

    LLM providers typically quote “per million tokens,” which makes selection look like a simple price comparison. Unit price is only one term in the cost equation. What actually drives the bill is:

    1. Total cost ≈ unit price × tokens used to finish the same task × call volume

    Two models with the same input/output rates can still differ several times in spend if one uses far more tokens for the same job—verbose reasoning, longer intermediate output, or lower first-pass success that forces retries. Selection should be based on cost per completed task, not price per token.

    Billing dimensions: input, output, and cache

    Most hosted LLM APIs split billing into three parts. Understanding them is how you structurally optimize the invoice.

    • Input (prompt) billing: Context, system prompts, and conversation history are charged as input tokens. Longer context costs more.
    • Output (completion) billing: Generated tokens. Output is often priced much higher than input, so reducing unnecessary generation is a direct saving.
    • Cache-read billing: Repeated prefixes (fixed system prompts, long documents) can be cached; hits are billed well below full input rates.

    Cache-read price matters a lot for high concurrency and long system prompts. When cache reads were expensive, repeatedly sending the same long prompt was a hidden cost driver; when cache-read prices drop by an order of magnitude, long-context apps become far more economical. Practical tip: put stable content at the front of the prompt to improve cache hits; put variable content at the end.

    Knowledge cutoff: useful, but do not over-read it

    A model’s “knowledge cutoff” is roughly when its training corpus ends. Two common mistakes:

    1. Post-training can shift what the model actually “knows” relative to the labeled date, because alignment and fine-tuning use different data.
    2. Cutoff is not a capability ceiling. For tasks that need current information, use retrieval-augmented generation (RAG) or live search so the model answers from up-to-date sources instead of parametric memory.

    Treat the cutoff as an input to “do we need external retrieval?”—not as a primary quality ranking.

    Layered selection: pair frontier and efficient models

    Mature systems rarely run a single model for everything. They route by difficulty:

    • Frontier (flagship) models: Stronger reasoning, complex planning, long chains of thought; higher unit price. Use them for the hardest work—architecture, large refactors, multi-step reasoning.
    • Efficient (lightweight) models: Lower price and latency; fit high-volume, well-defined jobs—classification, summarization, format conversion, simple Q&A.

    A routing layer that picks the model by task complexity can cut overall cost without sacrificing quality on critical work.

    A sketch of cost estimation

    Before production, run a small sample of real tasks through candidate models. That estimate of cost per task is more reliable than a rate card:

    1. def task_cost(input_tokens, output_tokens, cached_tokens,
    2. price_in, price_out, price_cache):
    3. # prices: USD per million tokens
    4. billable_input = input_tokens - cached_tokens
    5. cost = (billable_input * price_in
    6. + output_tokens * price_out
    7. + cached_tokens * price_cache) / 1_000_000
    8. return cost
    9. # Run the same real tasks on each candidate and compare
    10. # average cost per task, not just list price_in / price_out

    Then compare average token use, first-pass success rate, and average cost per task, together with quality evals.

    Engineering notes on cloud platforms

    When you deploy LLM apps on a cloud platform (for example Baidu AI Cloud), generic platform services help you control cost and stability:

    • Store long documents and knowledge bases in object storage, and use retrieval so you do not stuff unnecessary context into every call.
    • Use a message queue to smooth batch inference and avoid concurrent spikes that inflate instantaneous cost.
    • Collect token usage and latency with logging and monitoring, build a cost dashboard, and alert on abnormal growth.
    • Deploy routing and cache layers on a container platform so you can mix model tiers and prefix caching.

    Takeaway

    Evaluate in this order: use retrieval for freshness, estimate cost per task with a small production-like sample, optimize input/output/cache separately, then route between frontier and efficient models. Unit price is only the starting point; tokens required to finish the task is what sets the bill. Measure first so cost does not run away after launch.