LLM Model Selection: Routing Based on Cost per Successful Task

    Public benchmark scores don't tell you which LLM configuration to use in production. This article explains why teams should evaluate models on their own tasks, break down token-based billing, and optimize for cost per successful task instead of cost per call. It covers reasoning effort tuning, context window management, building an internal evaluation set, and turning results into a practical routing strategy—complete with a checklist for implementation.

    1. Benchmark Scores Alone Don’t Decide Model Selection

    Pass rates from public benchmarks only reflect how a model performs on a specific dataset under specific settings. What teams actually care about is whether their own tasks get done reliably—and what each completion costs in money and time. There are three gaps between benchmarks and reality: different task distributions, different acceptance criteria, and different invocation parameters.

    So the right process is to define your task profile first, then compare candidate configurations. Benchmarks are useful for narrowing down candidates, but the final decision should come from your own data.

    2. Start by Breaking Down the Bill

    LLM costs are typically made up of the following components:

    • Input tokens: prompts, context documents, conversation history, and tool results.
    • Output tokens: the model’s generated answers and code.
    • Reasoning tokens: some models perform internal reasoning before answering. These tokens are usually billed at the output price, but may not appear in the final response.
    • Premium tiers: low-latency or priority processing channels are often offered at higher rates. Some providers also support prompt caching, which reduces input costs on cache hits. Availability and discount details depend on the provider’s official documentation.

    Listed prices are just unit rates. Real cost is the sum of each token type’s usage multiplied by its unit price. A task with very long inputs and short outputs has a completely different cost structure from one with very long outputs. Teams should first analyze their invocation logs to measure the ratio of the three token types, then decide where to optimize. If input tokens dominate, focus on trimming context; if reasoning tokens dominate, focus on tuning reasoning effort.

    3. Use Cost per Success Instead of Cost per Call

    A configuration with a low per-call price doesn’t necessarily mean low overall cost. If a configuration’s pass rate is only 50%, failed calls are still billed, and they add manual review and retry overhead. A more meaningful metric is cost per success:

    cost_per_success = total spend / number of tasks that pass acceptance

    To include manual rework in the cost, use:

    effective_cost = (total spend + rework hours × labor rate) / number of tasks that pass acceptance

    Example implementation (pseudocode):

    1. function cost_per_success(records, price_in, price_out):
    2. total = 0
    3. successes = 0
    4. for r in records:
    5. total += r.input_tokens * price_in + r.output_tokens * price_out
    6. if r.passed:
    7. successes += 1
    8. if successes == 0:
    9. return infinity
    10. return total / successes

    When calculating, output_tokens must include reasoning tokens—otherwise you’ll underestimate the true cost of high-reasoning-effort configurations.

    4. Measure Reasoning Effort—Don’t Trust Intuition

    Many services let you adjust reasoning effort. Higher reasoning effort usually means more reasoning tokens, higher latency, and higher cost, while quality gains tend to diminish. Using high effort on simple classification or extraction tasks wastes budget; using low effort on multi-step code changes can lead to repeated rework.

    The right approach is to measure pass rate, per-call cost, and latency for low, medium, and high effort settings on your own tasks, and look for the inflection point on the curve. Beyond the inflection point, additional budget yields little benefit. Use a table like this to record results:

    Reasoning Effort Pass Rate Avg Output Tokens Avg Latency Cost per Success
    Low TBD TBD TBD TBD
    Medium TBD TBD TBD TBD
    High TBD TBD TBD TBD

    5. Context Windows and Multimodal Inputs

    Long context makes sense when a task genuinely requires large amounts of source material, but indiscriminately filling the window drives up input costs and can dilute the model’s attention on key information. In practice:

    • Retrieve only the segments relevant to the question, and include only necessary content.
    • Structure prompts clearly, e.g., using headings to separate instructions, background, and input data.
    • Periodically trim conversation history, keeping key conclusions rather than full transcripts.

    The same applies to multimodal inputs. Only send images or document pages when text alone can’t carry the information. Cropping or compressing assets before sending them can significantly reduce input volume.

    6. Build Your Own Evaluation Set

    Set up an evaluation pipeline as follows:

    1. Collect 50 to 200 real tasks, covering both common and difficult cases, with proportions matching your production traffic.
    2. Write automatically checkable acceptance rules for each task—unit tests, structural validation, or key-field comparisons. For anything that can’t be automated, define consistent human scoring guidelines.
    3. Run each “model × reasoning effort” combination, repeating each task at least 3 times, since model outputs are stochastic.
    4. Record pass rate, token usage, latency, and failure types. Failure types guide later prompt or workflow improvements.
    5. Calculate cost per success, plot cost against pass rate, and pick configurations on the Pareto frontier.

    Here’s the skeleton of an evaluation program (call_model is a wrapper around the specific service):

    1. function evaluate(task, model, effort, runs = 3):
    2. results = []
    3. for i in 1..runs:
    4. output, usage = call_model(model, task.prompt, effort)
    5. results.append({
    6. passed: task.check(output),
    7. input_tokens: usage.input,
    8. output_tokens: usage.output,
    9. latency_s: usage.latency
    10. })
    11. return results

    Sample size matters too. If two configurations differ in pass rate by only a few percentage points, the gap may be random noise on a few dozen tasks. Before comparing, compute confidence intervals or use bootstrap resampling to check whether the difference is stable. When samples are insufficient, add more tasks rather than drawing conclusions from marginal differences.

    7. Turn Results into Routing Rules

    Evaluation results should ultimately feed into your routing rules:

    • Default to the lowest-cost configuration that meets your pass rate requirements.
    • Define failure signals—failed acceptance checks, malformed output, or low model self-assessed confidence—and escalate to a stronger configuration when they occur.
    • Tier by task type: classification, extraction, and format conversion typically run on low-effort configurations; multi-file refactoring and complex reasoning use high-effort ones.
    • Manage routing rules in configuration files under version control, so you can roll back quickly when problems arise.
    • Re-run the evaluation set whenever the provider changes pricing, ships a new model version, or your task distribution shifts.

    8. Implementation Checklist

    • Have you measured the distribution of input, output, and reasoning tokens?
    • Are you comparing configurations by cost per success rather than price per call?
    • Have you tested every reasoning effort tier?
    • Is your sample size large enough to distinguish between configurations?
    • Do you have failure escalation and rollback mechanisms in place?
    • Are prices and quotas confirmed against the provider’s official documentation, with the lookup date recorded?