How to Choose a Large Language Model: Specs, Cost, and Agent Benchmarks

    Picking a large language model by list price alone usually leads to the wrong decision once an agent has to run end to end. This article explains how to read the specs that actually matter (input modalities, context window accounting, output budgets, and API identifiers), how to model the cost of a single agent task, and how to compare models on cost per successful task rather than price per token. It covers context accumulation across tool-call turns, the four scenario profiles and which specs are decisive for each, how to build a fixed task set and measurement protocol for reproducible baselines, a worked hypothetical showing why a cheaper model can end up more expensive once retries and human intervention are included, failure attribution, and the routing, prefix-caching, fallback, and monitoring practices that carry a baseline into production. All specs should be confirmed against official documentation, and all quality claims should come from your own re-testing on your own workload.

    1. Why Unit Price Isn’t the Whole Story

    For the same kind of agent task — read files, write code, call tools — one model may cost a fraction of a cent per turn while another costs a few dollars. Any “cheap” or “expensive” verdict based on unit price alone tends to collapse once you actually run the business flow end to end. There are three main reasons:

    1. Agent cost accumulates per turn. On every turn the agent sends the system prompt, the tool definitions, and all prior messages. A turn with a 10,000-token context, repeated for 15 consecutive turns, is already close to 150,000 input tokens.
    2. An expensive model isn’t necessarily expensive to generate with. If it delivers a correct result on the first attempt, downstream validation, rework, and human intervention all disappear. A model with a higher unit price but a high first-pass rate can have a lower total cost.
    3. Specs are not capability. Context length, output ceiling, and the casing or suffix in a model name none of them directly prove an agent success rate.

    A better first question is: which option has the lowest cost per successful task? This article proceeds in the order of reading specs → breaking down cost → building a baseline → re-testing and settling on a configuration. The whole piece rests on one principle: specs come from official documentation, and results come from re-testing on your own workload.

    2. Read the Specs First: Four Dimensions That Get Misread

    As of November 2026, flagship models from major vendors generally offer contexts on the order of a million tokens, and products supporting visual understanding, tool calling, and reasoning modes are increasingly common. Vendors word their documentation differently, and a few dimensions are especially easy to misread. The sections below don’t quote specific vendor parameters — always go with the latest wording in the official documentation.

    2.1 Input modalities: supported does not mean optimal

    • Check modality support item by item. “Supports image and text understanding” and “supports direct video understanding” are two different capabilities, and vendors word them differently too. Whether a model natively accepts video determines whether you can submit the video file directly or must decode and extract frames yourself first.
    • Document handling has its own traps. Whether very long PDFs, scans, and tables are parsed natively, and how that parsing is metered, all need to be confirmed one by one. In practice, estimating the input size with a parsing tool before you submit is more useful than reading the bill afterwards.
    • Costs can differ by tens of times. A few minutes of video, after video encoding, often produces tens of times the input volume of the equivalent amount of text; the same content with subtitles available may convert to less than one percent of that once turned into text. So “can it understand video directly” is not the first filter for selection — verify the value of the task with text and image representations first, then decide whether native video input is worth it. That order is usually more economical.

    2.2 Context window: input and output share the same capacity

    The context window describes the total number of tokens a model can hold in a single inference call, but vendors don’t count it the same way:

    • Some list “max context + max input,” and the two are not equal;
    • Some combine input and output into a single total window;
    • Some impose separate limits on a single message or a single file attachment.

    Common misreading: treating a million-token context as “I can stuff a million input tokens and then generate another million.” On models where input and output share one window, the generation budget eats into the input space. An agent’s context also grows with every turn, so once the input approaches the ceiling you need history compression, summarization, or retrieval in place of injecting everything.

    2.3 Output budget: answer length ≠ output tokens

    • Reasoning is billed as output too. With reasoning (thinking) mode on, the model’s internal reasoning normally consumes output tokens as well and shares the generation budget with the final answer. “Max output N tokens” does not mean the final answer can use all N tokens.
    • The knock-on risk of a shared budget. A JSON payload that needs to be complete and strictly structured will break the entire downstream chain of parsing and tool calls if it gets truncated, and often the only option is a full retry.
    • Leave headroom for high-stakes fields. Tasks like code generation and structured extraction should leave generous headroom. For scenarios involving key fields such as enums, numbers, and monetary amounts, you can cap field lengths in the prompt to lower the probability of truncation.
    • Turn reasoning on only when needed. Reasoning mode buys stronger reasoning by consuming more tokens. Simple classification and format conversion can turn it off or turn it down; complex planning tasks can turn it up — this avoids paying for depth you don’t need.

    2.4 Interfaces and identifiers: a name is not a capability tier

    • Judge capability by evaluation, not by suffix. Names like “Max,” “Pro,” “Flash,” and “Lite” in a product line reflect the vendor’s positioning, and have no necessary connection to actual performance on your specific task.
    • Go by the official API identifier. Separators, casing, and version notation in model names are not consistent, and the informal way people say a name often differs from the official identifier. When integrating, use the official API identifier and manage models centrally in a config or routing table rather than hardcoding them in scattered places:
    1. # Model registry example: identifiers per the official docs of the platform you use,
    2. # so nothing gets hardcoded all over the codebase
    3. MODEL_REGISTRY = {
    4. "chat_default": {"api_model": "<platform A official chat model ID>", "thinking": "off"},
    5. "chat_strong": {"api_model": "<platform A official strong-reasoning model ID>", "thinking": "high"},
    6. "vision_fallback": {"api_model": "<platform B official vision model ID>", "thinking": "off"},
    7. }
    • Keep templates traceable. Request examples in the official documentation are useful for validating your integration. Templates your team accumulates internally should note the source, the date they were compiled, and the scenarios they apply to, so they can be re-checked when a model is upgraded or the docs change.

    3. Break Down the Cost: Per Task, Per Run, and Cost per Success

    3.1 A per-task cost model

    The cost of one agent task depends on four parameters:

    • input and output token unit prices;
    • context size per turn;
    • average number of turns;
    • failure and retry rate.

    It can be approximated as:

    1. task cost = (input price × avg input tokens + output price × avg output tokens) × avg turns / first-pass rate

    On top of that, define cost per successful task:

    1. cost per success = task cost / number of successful tasks

    Average turns here already accounts for retries after failures. This metric puts capability and price into the same unit and is the core basis for comparing models against each other.

    3.2 The context accumulation effect

    Every additional tool-call turn means the next request carries all the history before it, so input tokens grow quickly with the number of turns. Let the fixed prefix be F (system prompt, tool definitions, task description, and so on) and the per-turn addition be Δ. Over n turns, the cumulative input tokens are:

    1. T_in(n) = n × F + Δ × n × (n + 1) / 2

    Example: F = 5,000 and Δ = 1,000. At 10 turns, cumulative input is about 105,000 tokens, and the context of the final turn alone is already around 14,000. The fixed prefix contributes 50,000 of that — close to half the total.

    Two takeaways follow:

    • Reuse the prefix. Compressing the system prompt and tool definitions pays off more reliably than compressing conversation history;
    • Turns are the sensitive variable. With a typical mix where output tokens account for 15% of total cost (output priced at 4× input), doubling the number of turns roughly doubles the output-side cost as well and raises total cost by about 1.15×.

    From this, three actionable principles:

    1. When input dominates, negotiate input price first. In long-document analysis and codebase Q&A, input tokens usually dominate absolutely, and no matter how low the output price is, it won’t turn the situation around.
    2. When output dominates, cut output volume first. Tasks like code completion and report generation should control redundant reasoning or switch off unnecessary reasoning modes.
    3. When turns are high, raise the pass rate first. In complex agents chaining multiple tools, saving one round of rework is often worth more than a small difference in unit price.

    3.3 Measure against your actual billing terms

    The estimates above are only good for comparing options side by side. A formal calculation should use the actual billing items on the bill from the platform you use, with particular attention to four things:

    • Whether reasoning tokens count as output. If they do, the bill for long-reasoning tasks can come in well above your estimate.
    • How context caching is billed. Stable system prompts, tool definitions, and long-document prefixes may be billed at a lower rate on platforms that support prefix caching. The precondition is putting the unchanging content at the front of the request and keeping the prefix byte-for-byte identical.
    • How tool calls are metered. Tool execution is carried by your own services, but that is often where most of the agent’s end-to-end latency comes from. If a tool takes several seconds and the model generates in a few hundred milliseconds, the optimization focus should shift to concurrency and parallel calls.
    • Whether failed requests are billed. How over-length inputs that get rejected, or requests that fail mid-flight, are billed directly affects the cost-effectiveness of your retry strategy.

    4. Scenario by Scenario: Input Shape and Spec Sensitivity

    Selection starts with a clear picture of the input shape and the acceptance criteria. Different scenarios make different specs decisive:

    Typical scenario Input characteristics Key specs Cost sensitivity
    High-frequency short tasks (classification, extraction, rewriting) Short text, structured fields Structured-output stability, throughput and rate limits Very high: unit-price differences scale directly into bill differences
    Long-document understanding and Q&A Long text, PDFs, tables Context capacity and long-context comprehension, document parsing Input-heavy: focus on input price and cache reuse
    Code and report generation Codebase context, requirement docs Output budget, reasoning mode, code correctness Output-heavy: truncation means rework
    Tool-intensive agents Multi-turn tool results, web/file content Tool-call reliability, context management Turn count is the main cost driver
    Video content analysis Long video, audio tracks, subtitles Native video input or a frame-extraction pipeline, input cost Encoded video input is enormous: prefer text representations

    The sections below suggest a trial order for these scenarios.

    5. Build a Baseline: Same Tasks, Comparable Numbers

    Suggested trial order:

    • High-frequency image/text and structured tasks: establish a cost baseline with a general-purpose model that offers good price-performance, then compare against a model with stronger vision capability;
    • Budget-sensitive tasks that need a larger generation budget: include models with a high output ceiling in the candidate set;
    • Tasks involving video understanding: test models that natively accept video input first.

    Note that this order only reflects verification priority and is not a recommendation of any model. The final selection has to come back to comparing on one identical task set.

    5.1 Build the task set

    Pull typical requests out of real business traffic into a small task set:

    • Size: 20–50 items per task category, covering common cases, edge cases, and historical failures;
    • Fixed versions: pin the prompt template, tool definitions, temperature and other parameters, and the system prompt version;
    • Two-track acceptance: objective items (are all fields present, does the JSON parse, do the unit tests pass) are judged automatically by script; subjective items are double-blind scored by people who know the business, against a shared rubric;
    • Sample size: when the pass-rate gap between two models is within 10 percentage points, a few dozen samples can’t tell them apart. Expand the sample size for close contenders and report confidence intervals.

    5.2 Fix the measurement protocol

    1. # Offline evaluation harness sketch: same task set, same acceptance criteria,
    2. # only the model under test changes
    3. from statistics import mean
    4. def evaluate(candidates, tasks, unit_cost_fn, max_attempts=3):
    5. report = []
    6. for cand in candidates:
    7. records = [run_task(cand, task, max_attempts) for task in tasks]
    8. n = len(records)
    9. passed = sum(r["passed"] for r in records)
    10. cost = sum(unit_cost_fn(r) for r in records)
    11. report.append({
    12. "model": cand.name,
    13. "pass_rate": passed / n, # first-pass and final pass rate
    14. "first_pass_rate": sum(r["attempts"] == 1 for r in records) / n,
    15. "avg_attempts": mean(r["attempts"] for r in records),
    16. "avg_input_tokens": mean(r["input_tokens"] for r in records),
    17. "avg_output_tokens": mean(r["output_tokens"] for r in records),
    18. "avg_reasoning_tokens": mean(r.get("reasoning_tokens", 0) for r in records),
    19. "total_cost": cost,
    20. "cost_per_success": cost / passed if passed else float("inf"), # cost per successful task
    21. "p95_latency": percentile([r["latency_ms"] for r in records], 0.95),
    22. "failure_reasons": classify_failures(records),
    23. })
    24. return sorted(report, key=lambda x: x["cost_per_success"])

    When running this, keep in mind:

    • Identical request bodies. Apart from the model parameters, keep the rest of the request body the same;
    • Comparable output limits. Set the same output ceiling for every model, or leave generous headroom everywhere, to avoid bias where “one got truncated and the other didn’t”;
    • Fixed tool behavior. Tool calls run in a sandbox and return reproducible results;
    • Uniform retry logic. Use one backoff-and-retry policy for infrastructure errors such as timeouts and rate limits, and track those separately from failures caused by model output quality.

    5.3 Let the data speak: counterintuitive results

    The following is a hypothetical example. The numbers illustrate the reasoning method only and do not represent any real product:

    • Model A: task cost $0.10, first-pass rate 70%;
    • Model B: task cost $0.20, first-pass rate 95%.
    Metric Model A Model B
    Task cost $0.10 $0.20
    First-pass rate 70% 95%
    Average attempts per task 1.43 1.05
    Cost per success ~$0.143 ~$0.210

    If a meaningful share of the failed tasks need human handling, estimated at $2 per intervention, the conclusion flips:

    Metric Model A Model B
    Cost of failed tasks 0.30 × 2 = $0.60 0.05 × 2 = $0.10
    End-to-end cost per task 0.10 + 0.60 = $0.70 0.20 + 0.10 = $0.30

    A model that costs twice as much per call ends up with less than half the end-to-end cost. So you can’t simply say “the cheap model is the better deal” or “the expensive model is more reliable” — the key is to fold rework, human effort, and failure risk into the number.

    5.4 Failure attribution

    Attribute each failure sample individually; it determines where you optimize:

    • Output truncated: raise the output ceiling or split the task;
    • Structured output non-compliant: enable structured-output constraints, add field-level validation and auto-repair;
    • Wrong tool-call arguments: improve tool descriptions, add parameter validation and error feedback;
    • Key information lost in long context: trim the context, introduce retrieval, or summarize and compress history;
    • Model “doesn’t know how” to use a new tool: the problem is usually in the prompt and the tool description, not the model. Switching to a stronger model typically yields limited gains.

    6. From Baseline to Production: Routing, Caching, and Fallbacks

    6.1 Multi-model routing

    No single model is optimal on both cost and quality across every scenario. You can assign models by task type:

    1. # Routing sketch: rules first, with a lightweight classifier if needed to label task type
    2. def route(task):
    3. # Video/image-heavy, low fault tolerance: prefer a model with strong vision and verifiable output
    4. if task.modality == "video" or task.risk_level == "high":
    5. return "vision_strong"
    6. # Long-output tasks: prefer a model with a generous output budget
    7. if task.estimated_output_tokens > 8000:
    8. return "long_output"
    9. # Large batches of simple tasks: use the cost-baseline model
    10. if task.batch_size > 1000 and task.risk_level == "low":
    11. return "cost_baseline"
    12. # Default to the model with stable overall performance
    13. return "chat_default"

    6.2 Prefix caching and history compression

    • Put stable content first. System prompt, tool definitions, and long documents go at the front in a fixed order. This raises the prefix-cache hit rate and also makes it easy to update only the relevant block when a document changes.
    • Compress long history. In long-running tasks, summarize and archive early tool results, keeping only the information relevant to the current decision.
    • Slim down tool results. Tools like search and databases should return only the necessary fields, so large blocks of raw content don’t flood the context.

    6.3 Fallback and retry

    • Auto-repair the first failure. When structured-output parsing fails, send the error message back along with the raw output so the model can fix it on the next turn;
    • Chained fallback. When the primary model fails or times out repeatedly, switch to a backup model, resume from the checkpoint, and continue;
    • Exponential backoff. Retry rate-limit and timeout errors with exponential backoff, cap the number of attempts, and raise monitoring alerts so a retry storm doesn’t inflate the bill.

    6.4 Ongoing calibration after launch

    • Monitor on one consistent metric set. In production, track pass rate, token consumption, cost per successful task, and P95 latency using the same definitions as the offline evaluation.
    • Canary releases. When a model version changes or a prompt is adjusted, roll out to a small traffic slice first, compare the key metrics, then go to full traffic.
    • Close the loop. Results that the business confirms or rejects, along with human edits, should flow back in as new evaluation samples, so the task set evolves with the business.

    7. Common Pitfalls Checklist

    • Treating context length as capability. A million-token window solves “it fits,” not “it works well.” Information recall within a very long context must be validated with your own business samples.
    • Treating max output as answer length. Reasoning consumes the output budget — watch this especially on long-reasoning tasks.
    • Treating a suffix as a capability tier. Product naming reflects positioning, not performance on your task.
    • Substituting chat experience for agent evaluation. Smooth single-turn Q&A doesn’t mean stable multi-turn tool calling. Evaluation must cover the full tool chain.
    • Choosing by per-turn price. The more turns, the more pronounced the input accumulation; total cost is not simply proportional to per-turn price.
    • Hardcoding model names in scattered places. Version iterations and migrations become expensive to change, and it’s easy to wire up the wrong model. Manage them in one central config.
    • Ignoring the cost of failed tasks. Cost per successful task is the real basis for the decision; the human effort and rework that failures create have to be folded in.

    8. Conclusion

    Back to the original question: “can the cheap one pass on the first try, and can the expensive one need less rework?” — there’s no universal answer, but it is measurable.

    1. Read the specs: separate context-window conventions, output budgets, and input modalities, and figure out which metrics actually affect your task;
    2. Model the cost: build a task cost model from input, output, turns, and pass rate, and compare options on cost per success;
    3. Build a baseline: re-test with a real business task set under one consistent protocol, instead of comparing spec sheet against spec sheet;
    4. Set up routing: use multi-model routing, prefix-cache reuse, and fallback retries so every task is completed by the right model at a sensible price.

    Specs are the starting point, data is the evidence, and continuous re-testing is how model selection actually lands in practice.