How to Choose a Mainstream LLM Agent: Pricing, Capabilities, and a Practical Testing Guide
This guide lays out a practical framework for choosing a mainstream LLM for Agent workloads. It begins by defining input modality and acceptance criteria to narrow the candidate pool, then builds a cost model that accounts for token pricing, accumulated history, tool returns, and retries. It explains why specs and naming suffixes are only filters rather than proof of performance, and why total cost of ownership often matters more than per-token price. Finally, it shows how to re-test candidates on the same representative task set and keep model selection controllable over time through unified routing, fallback, and observability. By the end, readers can answer two questions: whether a cheaper model can pass on the first try, and whether a pricier model can reduce rework.
Introduction: Same Task, Wildly Different Bills
Even for the same job—read a file, write some code, call a tool—the cost of a single turn can differ several-fold, sometimes tens of times, between models. Take a call with 100,000 input tokens and 2,000 output tokens: at the common range of CNY 0.4–2 per million input tokens and CNY 2–16 per million output tokens, the per-call cost lands somewhere between roughly CNY 0.072 and CNY 0.232—a gap of more than threefold. When the job grows into an Agent that calls the model repeatedly, that gap multiplies.
But price is only the surface. Two questions matter more: Can the cheaper model get it right the first time? Can the pricier model reduce rework? The first step in selection isn’t comparing unit prices—it’s answering two questions:
- Input side: What does the task need the model to understand? Plain text, mixed text and images, or video directly?
- Acceptance side: What counts as “done right”? Can a program reliably parse the format? Are tool calls complete? Can the reasoning be reviewed?
Once you define these two questions clearly, the candidate list usually shrinks from “every model” to two or three. The rest of this guide follows this order: define inputs and acceptance → build a cost model → align pricing units → re-test on the same task set.
1. Define Inputs and Acceptance Before Opening the Price List
1.1 First filter: by input type
Agent tasks fall into three broad categories, with input requirements increasing in that order:
- Plain text understanding: long-document summarization, contract clause comparison, log root-cause analysis. Most mainstream models can handle these, so selection comes down to context utilization and cost.
- Image and text understanding: screenshot recognition, receipt and form extraction, converting UIs into structured data. This requires native image input support. “Can it read images?” is a hard gate—rule out any model that lacks the capability.
- Video understanding: scenarios that need direct understanding of video content, such as operation-demo review, surveillance footage analysis, or extracting key points from instructional videos. Keep only candidates with native video input. Don’t substitute a “extract frames, then treat them as images” workaround. Frame extraction loses temporal information and hurts tasks sensitive to motion continuity and the ordering of events.
Engineering tip: Input documents are often long, but the part the model actually needs to “see” may be just a small segment. Let the program handle retrieval, filtering, and structured extraction, then hand the model the trimmed context. This is usually cheaper and more stable than stuffing the entire document in.
1.2 Second filter: by acceptance criteria
Acceptance criteria determine the requirements on output budget and format. Write each one out explicitly:
- Is strict output format required? When you need complete code files, schema-conformant JSON, or directly renderable tables, output must parse reliably. Prefer models with strong instruction following and structured output, and add format validation plus auto-repair on the client side.
- Must the reasoning be preserved? Audit, compliance, and teaching scenarios need reasoning steps in the output. Backend tasks focused on parsing and data ingestion don’t—turn off thinking mode to control cost.
- Is per-step output large? When generating a full module, a long document, or a large dataset in one shot, the output cap directly determines whether you can finish in one turn. Truncated output not only wastes tokens already generated but can also break downstream steps.
- Is it user-facing? For user-facing, latency-sensitive scenarios, prefer fast, lightweight models. Offline batch processing can tolerate higher latency in exchange for better quality.
The output of this step is an “admission list.” For example:
| Scenario | Input | Acceptance Criteria | Admission Condition |
|---|---|---|---|
| Invoice recognition and storage | Image | JSON parses; key-field accuracy ≥ agreed threshold | Supports image input; stable structured output |
| Requirements doc to API definition | Text | Compiles; passes contract tests | Strong code generation; output rarely truncated |
| Demo video review | Video | Correct steps and order; verifiable conclusions | Native video input support |
Only after the list is settled can you move on to cost estimation.
2. Build a Cost Model: Start by Counting Tokens
2.1 What goes into one Agent call
The base cost of a single model call is:
cost per call = input tokens × input price + output tokens × output price
An Agent task’s real cost adds three more factors:
- History accumulation: In a multi-turn conversation, prior messages are counted into the input of every subsequent turn. The input to the nth call is roughly “system prompt + all prior messages + tool returns up to turn n−1.”
- Tool returns: Web page text, retrieved snippets, API responses, file contents—these are often one to two orders of magnitude longer than the user’s original question.
- Retries on failure: Failed tool calls, format-parsing failures, and regeneration after failing acceptance all add cost. There’s only one criterion that matters: does it consume new tokens? If yes, it’s billed.
Here’s a three-turn tool-calling example:
# Prices are in CNY per million tokens; sample values are illustrative only, refer to each provider's official pricingPRICING = {"model_economical": {"input": 0.4, "output": 2.0},"model_balanced": {"input": 1.0, "output": 5.0},"model_flagship": {"input": 2.0, "output": 16.0},}def estimate_cost(model: str, prompt_tokens: int, completion_tokens: int) -> float:"""Estimate the model cost of a single call using official documentation"""p = PRICING[model]return (prompt_tokens * p["input"] + completion_tokens * p["output"]) / 1_000_000# Input per turn: system prompt + accumulated history + tool returnsround_prompts = [18000, 42000, 65000]round_completions = [500, 700, 2000] # reasoning content in thinking mode also counts as outputmodel_cost = {m: sum(estimate_cost(m, i, o) for i, o in zip(round_prompts, round_completions))for m in PRICING}for m, cost in model_cost.items():print(f"{m}: model cost {cost:.4f} CNY")# Estimate the budget for 10,000 similar tasks using the accumulated-history curve, with a 20% retry factorTASKS, RETRY_RATE = 10_000, 0.2budget = {m: sum(estimate_cost(m, i, o) for i, o in zip(round_prompts, round_completions))* TASKS * (1 + RETRY_RATE) for m in PRICING}print("Estimated total budget (CNY):", {m: round(v, 2) for m, v in budget.items()})
Once you run the numbers, you’ll find that cost is usually driven not by unit price but by how input tokens accumulate. So compressing tool returns, trimming history promptly, and enabling caching for stable prompt prefixes are typically more effective at cutting costs than switching models.
2.2 Align pricing units: don’t treat a discounted price as the default
Pricing systems vary across providers. You need to align on at least these dimensions before comparing:
- Billing unit: Mixing per-1K-token and per-million-token pricing can create a thousandfold error; token conversion rules (for Chinese, code, and multi-byte characters) may also differ. Normalize everything to CNY per million tokens, and calibrate token counts using the same real samples.
- Input vs. output tiers: Input and output are usually priced separately, with output often costing several times the input price; some models use tiered pricing for extra-long context.
- Cache and batch discounts: Cache hits and offline batch processing can offer meaningful discounts, but each comes with preconditions. Caching requires a stable prefix; batching usually means higher latency.
- What’s billed: Whether thinking content and tool returns count as output; whether retries are billed separately; whether there’s a minimum billing amount.
Maintain an internal “unit-alignment table”: record each candidate’s measured token counts on the same sample set, the per-tier prices, available discounts, and minimum charges, then convert everything with a single formula into “estimated cost per 1,000 similar tasks.” Only then does a price comparison mean anything.
3. Model versions: pin the identifier, regression-test after changes
Models keep evolving. Behind the same name, capability, price, and even API behavior can change. In engineering practice:
- Pin the exact model identifier listed in the official documentation in your config; don’t casually abbreviate it in code, and definitely don’t assemble your own string.
- Before each upgrade, run a regression test on the same acceptance set, comparing success rate, cost, and latency.
- Manage version identifiers centrally through config or a gateway, avoiding scattered hardcoded values across business code.
3. Specs Are a Filter, Not a Performance Ranking
After defining inputs and acceptance, you can reference key specs from each provider’s official documentation to filter out models that don’t meet hard requirements. Focus on these dimensions:
| Spec Dimension | What to Check | Impact on Agent Tasks |
|---|---|---|
| Input modality | Text / image / video | Models without the required modality are out immediately |
| Context window | Stated value; max input limit | Determines how much history and tool returns fit per turn |
| Single output cap | Whether it differs between thinking and non-thinking modes | Determines whether long code/docs finish in one turn |
| Thinking mechanism | Whether it can be turned off; whether it’s controllable | Affects cost and latency |
| Billing basis | Input/output tiers; cache and batch discounts | Determines the actual bill |
Three commonly misread points need clarifying:
- A name suffix doesn’t indicate capability tier. Suffixes like “Max” or “Flash” are just product naming, and each vendor uses them differently; even two models both called “Pro” may emphasize different strengths. Don’t assume a “Max” name makes a model best for Agents, and don’t assume “Flash” limits a model to simple tasks. The only evidence of capability is your own test results on your own task set.
- A long context window isn’t the same as usable memory. Long context is a necessary condition, not a sufficient one. When key information sits in the middle of an extra-long context, whether the model uses it accurately (often called “lost in the middle”) requires a purpose-built test. The longer the context, the higher the input cost per turn, too.
- A stated limit isn’t the same as what’s actually usable. Some models distinguish total context from max single input; the usable length is further constrained by the version, API parameters, and output reservation. Rely on the official documentation, and stress-test the boundaries before going live.
4. Output Budget Isn’t the Final Answer Length
This is the most overlooked detail in selection—and one of the easiest ways to cause production incidents.
- Thinking content consumes the output budget. With thinking mode enabled, the reasoning process uses output tokens too. If the output cap is shared between reasoning and the answer, a long reasoning pass leaves noticeably less room for the actual answer.
- Input and output may share the total window. Some models count this turn’s input and generation together against one total window. That means the idea of “pack in a million-scale input and still output a million-scale answer” is wrong. With extra-long inputs, you must reserve enough room for output.
- Set up finish-reason monitoring. When the API returns a length-based stop reason (which may be labeled
length,max_tokens, etc. across different interfaces), the output was hard-truncated. The text you get may be half a JSON or half a code block, and parsing it directly will certainly fail.
Recommended approach (illustrative):
def call_with_budget_guard(client, messages, max_output_tokens, parse_fn, retry=2):"""Call with an output-budget guard: auto-continue on truncation, degrade gracefully on repeated failures"""for attempt in range(retry + 1):resp = client.chat.completions.create(messages=messages,max_tokens=max_output_tokens,)choice = resp.choices[0]text = choice.message.content or ""if choice.finish_reason == "length":# Response was truncated: feed the existing content back as context and request continuationmessages = messages + [{"role": "assistant", "content": text},{"role": "user", "content": "The previous answer was truncated. Continue from the breakpoint without repeating existing content."},]continuetry:return parse_fn(text) # parse_fn validates JSON/code and other formatsexcept ValueError as e:messages = messages + [{"role": "assistant", "content": text},{"role": "user", "content": f"The answer format is invalid ({e}). Output only the complete content in the agreed format."},]return None # Hand off to the upper-layer routing or fallback strategy
In practice, build three guardrails:
- Match task type to output budget: For long code generation and long-form writing, prefer models with a higher output cap or continuation support.
- Adapt to input length: When input is too long, automatically compress history and truncate tool returns to leave room for output.
- Treat truncation as retry or fallback: Handle a length-based stop reason as an explicit failure signal, not as a success to pass downstream.
5. Don’t Look at Unit Price Alone: Answer “Cheap vs. Expensive” with Total Cost of Ownership
5.1 Three metrics define “get it right the first time”
- First-pass rate: The share of tasks whose first generated output passes all validation and acceptance.
- Average attempts: The average number of model calls needed for a task to eventually succeed.
- Rework rate: The share of tasks that need human intervention or regeneration.
A low-unit-price model with a low first-pass rate drives up the average number of attempts, so the model fee grows several-fold, and the human rework cost is even harder to estimate. A high-unit-price model with a high first-pass rate and little rework may have a lower total cost.
5.2 The total-cost formula
total task cost = model fee + retry fee + human rework cost + opportunity cost
Where:
- model fee ≈ cost per call × average attempts × task volume
- human rework cost ≈ rework rate × task volume × cost per manual fix
Plugging in a set of assumptions (manual fix estimated at CNY 10 each):
| Candidate Model | Input/Output Price (CNY per million tokens) | Per-Call Cost (CNY) | First-Pass Rate | Rework Rate | Total Cost per Task (CNY) |
|---|---|---|---|---|---|
| Lightweight | 0.4 / 2 | 0.072 | 70% | 15% | ~1.69 |
| Balanced | 1.0 / 5 | 0.110 | 90% | 5% | ~0.76 |
| Flagship | 2.0 / 16 | 0.232 | 96% | 2% | ~0.60 |
(These are illustrative; actual values must come from your own business testing.)
Ranked by model fee, the order is lightweight, balanced, flagship. Ranked by total cost, the order flips to flagship, balanced, lightweight. This is the real meaning of “can the cheap one get it right the first time”: you can’t look only at the call price—you have to look at the full cost of getting the task done.
5.3 A tiered strategy
- Simple, high-frequency, fixed format: Field extraction, classification and tagging, templated summarization—use a lightweight model and establish a cost baseline.
- Medium complexity: Multi-step tool calling, structured code generation—use a balanced model with format validation and auto-repair.
- Complex, low fault tolerance: Architecture design, hard-to-reproduce defect localization, high-stakes decision support—use the most capable model and keep human review in the loop.
- Adjust dynamically by task value: The same capability used for internal assistance versus external delivery can have different budget caps.
6. The Final Home for Complex Agents Is Decided by One Shared Task Set
No spec sheet can replace a comparison on real tasks. Design your re-test as follows:
- Build a representative task set: Sample from real business logs, covering simple, medium, and complex tiers, with no fewer than several dozen cases per tier; keep a few “trap samples,” such as extra-long inputs, ambiguous instructions, and tasks requiring multi-tool coordination.
- Fix inputs and judging criteria: All candidate models use exactly the same inputs, tool definitions, and acceptance rules—avoid “everyone tests their own way.”
- Record metrics across multiple dimensions:
| Metric | Definition | Purpose |
|---|---|---|
| Task success rate | Share of tasks passing all acceptance checks | Core effectiveness metric |
| Tool-call accuracy | Share with correct name, arguments, and sequencing | Pinpoints Agent pipeline issues |
| First-pass rate | Share passing acceptance on the first output | Measures “get it right the first time” ability |
| Average steps/rounds | Average calls needed to complete a task | Identifies inefficient reasoning and loops |
| P95 latency | End-to-end time for 95% of tasks | Assesses user experience |
| Cost per task | Mean of model fee + retry fee | Converts to total cost |
- Use a unified score: Weight by business priority, for example
overall score = success rate × 0.5 + cost score × 0.3 + latency score × 0.2, to avoid being led astray by a single metric. - Keep regressing after launch: When a model version updates, re-run the same task set and watch for metric drift.
Task execution and acceptance can be split into an “executor” and a “verifier” layer (illustrative):
def run_agent_task(model, task, tools, max_steps=12):"""Run a single Agent task, returning the execution trace and usage for batch evaluation"""messages = [{"role": "system", "content": task.system_prompt},{"role": "user", "content": task.query}]usage = {"prompt": 0, "completion": 0}trace = []for step in range(max_steps):resp = call_with_budget_guard_for_tools(model, messages, tools) # must return tool callsusage["prompt"] += resp.usage.prompt_tokensusage["completion"] += resp.usage.completion_tokensif resp.finish_reason == "length":trace.append({"step": step, "event": "output_truncated"})return {"ok": False, "reason": "output_truncated", "trace": trace, "usage": usage}if resp.tool_calls:for call in resp.tool_calls:result = dispatch_tool(call) # actually execute the tool and feed the result backtrace.append({"step": step, "tool": call.function.name, "args": call.arguments})messages.append({"role": "assistant", "tool_calls": [call]})messages.append({"role": "tool", "tool_call_id": call.id, "content": result})continuereturn {"ok": task.verify(messages, resp), # verifier: format, rules, tests, manual spot-checks"trace": trace, "usage": usage}return {"ok": False, "reason": "max_steps_exceeded", "trace": trace, "usage": usage}
7. A Suggested Trial Order
- First: high-frequency image/text and structured tasks. Start with a cost-effective lightweight model to establish a cost baseline, then check whether it can reliably pass on the first try under strict acceptance rules.
- Second: budget-sensitive with a larger generation budget. Bring in a model with a higher output cap, and focus on measuring the truncation rate for long code and long documents.
- Third: direct video input. Prioritize candidates with native video support, and use real video samples to test temporal understanding such as event ordering and motion continuity.
- Fourth: complex multi-step Agents. Don’t assume a conclusion—compare candidates head-to-head on the same task set and acceptance rules, and decide by overall score.
8. Engineering: Keeping Selection Controllable Over Time
Selection isn’t a one-time job. Models evolve, prices change, and business needs shift. Build these mechanisms:
- Unified access layer: Hide API differences across providers behind a unified gateway, and manage model identifiers centrally in config for easier gradual rollout and A/B testing.
- Routing and fallback: Send simple requests to lightweight models and escalate complex ones to higher-capability models; when the primary model times out or is rate-limited, automatically fall back to a backup to keep things available.
- Observability: Log each call’s model, input/output token counts, finish reason, latency, and acceptance result; set threshold alerts for cost budget, failure rate, and truncation rate on your monitoring platform.
- Data security and compliance: Choose a deployment form based on data sensitivity; strip irrelevant personal information and sensitive fields from prompts and tool returns; treat model output as untrusted input, and validate tool arguments against a whitelist to guard against prompt injection.
Illustrative: simple routing based on task features
def route(task):# Select candidate models based on input modality and complexityif task.modality == "video":return ["model_vision_pro", "model_vision_lite"] # requires native video understandingif task.complexity == "simple" and task.modality == "text":return ["model_economical", "model_balanced"] # high-frequency simple tasks, prefer lightweightreturn ["model_flagship", "model_balanced"] # complex tasks, prefer flagship
Conclusion
Choosing a mainstream LLM for Agent scenarios is fundamentally a problem of “constraint satisfaction plus cost optimization,” not a single-choice question of “who’s the strongest.”
- Inputs and acceptance define the candidate range: A model that doesn’t support video input shouldn’t enter a video task; strictly formatted tasks need stronger instruction following.
- Aligned units reveal the true cost: Convert prices to the same unit, and count history accumulation, tool returns, and retries into the total.
- Specs are only a filter: Name suffixes, context length, and output budgets can’t directly prove Agent success rates.
- One shared task set decides the final choice: A complex Agent’s model selection should be driven by measured data and continuously regression-tested after version updates.
Follow this order, and you can answer the two questions you started with: whether the cheap model can get it right the first time, and whether the expensive model can reduce rework. The answer isn’t in the spec sheet—it’s on your own task set.
