LLM Cost-Effectiveness Evaluation: Token Cost Analysis and a Practical Model Selection Guide

    This article explains why a low published price per million tokens does not always translate into lower spending, and how to evaluate LLM cost-effectiveness in real deployments. It breaks down the three hidden cost drivers—effective token consumption, cached-input discounts, and failed-retry overhead—and introduces a reusable model based on effective cost per successful task. You will find a three-layer evaluation framework covering cost, capability, and engineering fit, a step-by-step one-week A/B testing process with your own traffic, and additional validation points for front-end and UI generation tasks. The guide closes with general selection recommendations for teams choosing models on real business workloads.

    1. The Starting Point: Why a Lower Unit Price Does Not Mean Lower Cost

    In model integration and selection work, one mistake keeps recurring: treating the published price per million tokens as the final cost basis. Real bills often deviate noticeably from expectations, for three main reasons.

    The first is differences in effective token consumption. For the same task, different models may need a different number of inference rounds and different context lengths before they converge on a usable result. Some models tend to answer in a single pass; others improve accuracy through multiple attempts and self-checking. The latter may be more consistent in accuracy, but token consumption can multiply.

    The second is the structural discount from cache hits. Some inference services offer time-based billing and context caching. When prefix content such as system prompts, knowledge snippets, and tool definitions is reused across requests, the cached portion is billed well below the standard input rate. As a result, two models with the same nominal unit price can differ severalfold in actual spending under a workload shaped by “long system prompt + high call frequency.”

    The third is the hidden cost of failed retries. An output that fails validation usually means regeneration, another review, or even human intervention. This cost never appears in a price table, yet it consumes real engineering budget.

    So the right way to assess cost-effectiveness is not to compare prices, but to build a reusable measurement model:

    1. Cost per task attempt = (input tokens × input price + output tokens × output price) × average attempts
    2. Effective cost = cost per task attempt / task success rate

    “Task success rate” should be defined strictly—for example, “the proportion of outputs that pass automated validation without manual edits.” Only when this denominator is included do different models become comparable.

    2. A Reusable Evaluation Framework: Three Layers of Metrics

    2.1 Cost Layer: Focus on Effective Cost, Not the Sticker Price

    Break cost into three observable items: average input tokens, average output tokens, and average call rounds. All three can be collected through instrumentation in your own logging service, with no need to rely on vendor disclosures. Combine this with a time-based strategy—schedule recurring jobs in low-load windows—and the cost curve flattens noticeably.

    2.2 Capability Layer: Measure by Dimension, Not by a Single Composite Score

    A composite intelligence score is only good for initial screening. What really drives selection is per-dimension performance, usually grouped into four areas:

    • Coding: single-file completion, cross-file refactoring, test generation, error localization;
    • Agentic ability: multi-step tool calls, long-horizon task planning, self-correction after failures;
    • Visual understanding: UI screenshot comprehension, chart reading, layout reconstruction;
    • Automation and domain tasks: structured output reliability, long-document extraction, rule-intensive workflows.

    The point of per-dimension evaluation is that a business usually relies on only one or two of them. A model that leads on vision but merely matches others on coding has almost no premium value for a pure backend scenario.

    2.3 Engineering Layer: Stability and Ecosystem Fit

    This includes structured output (such as JSON) compliance rate, information retention under long context, behavior under concurrency and rate limits, cold-start latency, and how easily the model plugs into existing monitoring, alerting, and logging systems. Weaknesses in the engineering layer often surface earlier than capability gaps.

    3. Real Business Testing: How to Run a One-Week A/B Test Properly

    Paper data can only narrow the candidate list; the final decision must be validated with your own traffic. The recommended process is as follows.

    Step 1: Fix the evaluation set. Sample from historical real requests, covering both high-frequency and long-tail cases, and annotate expected outputs or validation rules. A few hundred entries are enough, so that one full round finishes within an hour.

    Step 2: Run two channels in parallel. Send the same prompts and the same tool definitions to two candidate models, keeping parameters such as temperature identical to avoid contaminating variables.

    Step 3: Instrument and collect. For each request, record input and output tokens, rounds, latency, and validation result, then store the records and aggregate them daily.

    Step 4: Compute effective cost before judging quality. For example, suppose Option A has a lower sticker price but needs 1.6 rounds on average with an 88% success rate, while Option B costs a tier more but averages 1.1 rounds with a 96% success rate. Plug these into the formula above and the effective cost gap will be far smaller than the sticker gap—and may even reverse.

    Step 5: Set exit conditions. Agree in advance on “lower effective cost for seven consecutive days with a success rate no lower than the baseline” as the switching criterion, so subjective preference does not interfere.

    The collection logic can be as simple as this:

    1. record = {
    2. "model": model_name,
    3. "input_tokens": usage.prompt_tokens,
    4. "output_tokens": usage.completion_tokens,
    5. "rounds": attempt,
    6. "latency_ms": elapsed,
    7. "passed": check(result),
    8. }
    9. log_client.push(record) # write to the logging service and aggregate daily

    4. Additional Validation Points for Front-End and UI Generation

    UI generation tasks have improved markedly in recent years. From static pages to lightweight 3D interactions and even simple video editing workflows, models can now produce a runnable first version. In engineering practice, however, four things deserve extra attention: first, the runnability of the generated code—whether it starts without errors on the first try; second, design fidelity—whether spacing, hierarchy, and responsive breakpoints are reasonable; third, maintainability—whether components are split sensibly and styles are readable; fourth, iteration cost—whether an added change request can be applied locally instead of triggering a full rewrite.

    A practical technique is the “three-version comparison”: have each candidate model produce a home page from the same requirements description, then let the team score them on runnability, fidelity, and maintainability. This is far more reliable than watching demo videos.

    5. Common Takeaways and Selection Recommendations

    Overall, a few general lessons can be distilled:

    1. Screen with a composite score first, then use per-dimension results to shortlist candidates, so a single leaderboard does not drive the decision;
    2. Fold caching and time-based strategies into the cost model; the payoff is largest with long system prompts;
    3. Schedule batch jobs in low-load windows and set budget alerts;
    4. When capabilities are close, prefer the option with better engineering fit; structured output compliance and observability affect long-term cost more;
    5. Build an internal evaluation set and keep running regressions; models iterate frequently, and a one-off conclusion expires quickly.

    For scenarios that need elastic compute and supporting capabilities, you can rely on general offerings from Baidu AI Cloud—such as container platforms, object storage, logging services, and monitoring and alerting—to solidify the evaluation pipeline, sample management, and cost dashboards, turning selection from a one-time judgment into a sustainable engineering mechanism.