LLM Selection Guide: Pricing, Capabilities, and Agent Practices
This guide explains how to select a general-purpose large language model by treating the decision as constraint solving rather than chasing benchmark scores. It breaks down four key dimensions—context window, output budget, multimodal input, and thinking mode—shows how to compare models by cost per task instead of per-token price, and recommends a layered architecture for building reliable AI agents. Readers will also find a practical checklist for validating model choices with real workloads.
1. The Real Problem: From Benchmarks to Constraint Solving
In engineering practice, choosing a general-purpose LLM is not about picking the “strongest” one. It is about finding the optimal solution under a set of hard constraints. Common constraints include the input size of a single request, the maximum output length required for a single response, whether non-text material such as images or video must be processed, the acceptable cost per million tokens, and the lower and upper bounds on response latency. Writing these constraints down explicitly turns model selection from a subjective preference into a verifiable engineering decision.
One frequent source of confusion needs to be cleared up first: the shorthand names people use often do not match the official API identifiers. Always use the model identifier given in the platform documentation when making calls, and manage these identifiers centrally in a configuration layer. Avoid hardcoding display names into business code; otherwise a single naming change can trigger failures across the entire chain.
2. Technical Meaning of Four Key Dimensions
2.1 Context Window: Nominal Limit vs. Usable Input
Platforms describe context differently. Some write “1M,” some write “1,048,576,” and some note that the “maximum input” is slightly smaller than the nominal value. This is not merely a marketing difference but a reflection of implementation details: the context must hold the system prompt, conversation history, retrieved snippets, and reserved space for the current output at the same time. In engineering terms, treat “maximum input” as the real usable boundary and leave a safety margin.
A practical recommendation is to introduce a token budget allocator that trims and prioritizes content before the request is sent:
def build_prompt(system, history, retrieved, budget):reserve = 4096 # reserve space for outputusable = budget - reserveparts, used = [], 0for chunk in [system] + retrieved + history:n = count_tokens(chunk)if used + n > usable:breakparts.append(chunk); used += nreturn parts
2.2 Output Budget: The Hidden Cost of Long Outputs
Single-response output limits vary widely, ranging from tens of thousands of tokens to hundreds of thousands. The output budget determines whether tasks such as long-document generation, repository-level refactoring, and bulk structured data extraction can be completed in one pass. If the limit is insufficient, you must generate in segments and stitch the results together, which introduces consistency problems and additional retry costs. Another easily overlooked fact is that output tokens are usually more expensive than input tokens, so long-output scenarios are far more sensitive to cost than long-input scenarios.
2.3 Multimodal Input: Split the Pipeline by Modality
Some models support three input types—text, images, and video—while others support only text and images. When selecting a model, split the pipeline by modality rather than requiring a single model to cover every capability. For video material, a more robust approach is to first reduce non-text information to text through frame extraction or transcription, then hand it to a text model for inference. This lowers token consumption and avoids being constrained by a single model’s modality support.
2.4 Thinking Mode: Making Reasoning Depth Adjustable
Some models distinguish between “non-thinking” and “thinking” output budgets, where thinking mode allows a longer reasoning process. In engineering, treat this as a knob you can adjust dynamically: turn thinking off for shallow tasks like intent recognition and format conversion to reduce latency and cost; turn it on for deep tasks like mathematical derivation and complex troubleshooting, and store the thinking content separately for auditing and review.
3. The Right Way to Evaluate Pricing
Do not compare unit prices alone. Convert to “cost per task”:
cost per task = (input tokens × input price + output tokens × output price) / 1e6+ retry count × cost per task
The retry count is determined jointly by the structured-output failure rate and the timeout rate. A model with a slightly higher unit price but stable output formatting and a low failure rate may actually have a lower cost per task. It is advisable to run small-scale load tests with real business samples, measure the average input and output lengths and the failure rate, then plug them into the formula for a side-by-side comparison.
4. A Layered Architecture for Agent Scenarios
Agent reliability comes from layering, not from a single all-purpose model. A three-layer structure can be used: a routing layer with a lightweight model for intent classification and tool selection; an execution layer with a model strong in long context and multimodal capabilities to handle retrieval summarization and code operations; and a verification layer that uses another model or a rules engine to review results. Each layer is billed and rate-limited independently, and the model in any layer can be swapped out, avoiding vendor lock-in.
Supporting engineering practices include: setting a timeout and an idempotency key for every tool call; breaking long tasks into recoverable steps and persisting intermediate state; and using logging services and monitoring alerts to collect token consumption, latency percentiles, and failure reasons, forming a loop for continuous optimization. To handle large-scale concurrency, you can combine container platforms for elastic scaling and use message queues to smooth out traffic peaks.
5. Deployment Checklist
- Define the input modality and maximum input boundary, and reserve output space;
- Measure the distribution of input and output lengths and the failure rate with real samples;
- Make decisions based on cost per task rather than unit price;
- Toggle thinking mode dynamically according to task depth;
- Decouple in layers and preserve model replaceability;
- Build an observability system for tokens and latency.
Evaluated with this framework, the selection result will change as business constraints change, but the decision process remains reproducible and auditable. If an organization wants to validate the approach on Baidu AI Cloud, it can build a prototype based on the general-purpose model service category, use its own dataset to complete the cost accounting, and then scale up.
