Sub topic 8
Choosing between model tiers
This chapter assumes you can read basic Python and know what an agent loop is. You should also know how input and output tokens are priced, which an earlier chapter covered. Here you will learn how model tiers differ, how to compare them on a given task, and where people most often go wrong.
What a tier is
Most providers sell several models from the same family at different points on a capability and price curve. These are called model tiers. The names vary by provider, but the pattern is the same:
- A small tier is cheap and fast. It handles well-defined work such as summarizing output, classifying, extracting fields, and running simple edits.
- A mid tier balances cost and capability. It is the usual default for everyday coding steps.
- A large tier is the most capable. It costs the most per token and usually responds more slowly. It is best for planning, ambiguous problems, and hard debugging.
A tier is not a fixed quality level. A small model released this year may beat a large model from two years ago. Compare models within the current lineup, and recheck when the lineup changes.
The three dimensions
A tier choice trades off three things at once.
| Dimension | What it measures | What it affects |
|---|---|---|
| Capability | How often the model produces a correct result on your kind of task | Retries, review effort, failed tasks |
| Cost | Price per input and output token | Spend per request and per session |
| Latency | Time to the first token and time to finish a response | Waiting time in each turn of the loop |
Latency matters more in an agent than in a chat. A loop with 30 turns repeats the model's delay 30 times. A model that is two seconds slower per turn adds a minute of waiting to the session, even if the answers are good.
Price ratios between tiers are often large. As a placeholder, suppose the large tier charges five times the small tier per token. If both models complete the task, the small one is far cheaper. If the small model fails and you rerun with the large one, you have paid for both attempts.
Why price per token is not the whole story
Token price is only one input to the real cost of finishing a task. Three other factors change the result.
- Tokens used per task. A stronger model may reach the answer in fewer turns, with less backtracking. A weaker model may wander, read extra files, and repeat tool calls. Each extra turn resends the whole context.
- Success rate. A failed attempt still costs money. It also costs your time to notice and redo it.
- Verbosity. Models differ in how much they write. Output tokens are the more expensive kind, so a chatty model can cost more than its price list suggests.
The effective cost of a model is its total spend divided by the number of tasks it actually resolved:
def cost_per_resolved(total_cost_usd, resolved_count):
if resolved_count == 0:
return float("inf")
return total_cost_usd / resolved_count
# Placeholder results from running the same 50 tasks with two models.
cheap = cost_per_resolved(total_cost_usd=20.0, resolved_count=20) # 1.00
strong = cost_per_resolved(total_cost_usd=45.0, resolved_count=40) # 1.125
print(cheap, strong)In this example the cheaper model spent less in total, yet its cost per resolved task is almost the same as the strong model's. The strong model resolved twice as many tasks. If you also count the time spent on the 30 tasks the cheap model failed, the strong model is the better choice. A later chapter treats this metric in detail. For now, remember that a tier comparison needs success counts, not only price lists.
Matching tiers to task types
You do not need one model for the whole session. Different steps in a coding agent make different demands.
| Step type | Typical demand | Usual starting tier |
|---|---|---|
| Planning a multi-file change | Reasoning over many constraints | Large |
| Writing or editing code in a known pattern | Following a clear spec | Mid |
| Summarizing a long tool output | Compression, little reasoning | Small |
| Running tests and reporting failures | Reading structured output | Small |
| Diagnosing a failure with no obvious cause | Open-ended reasoning | Large |
| Renaming, formatting, mechanical edits | Pattern application | Small or mid |
Treat the third column as a starting hypothesis. Verify it on your own tasks. Routing steps to tiers is covered in a later chapter.
A decision flow
When you are unsure which tier to use, start from the cheapest tier that could plausibly work and escalate on evidence of failure.
This flow only works when you have a cheap, automatic check, such as a test suite, a type checker, or a linter. Without one, you cannot tell whether the small model succeeded, and escalation becomes guesswork.
Comparing tiers on your own work
Public benchmarks are a starting point. They rarely match your codebase, language, or tool setup. A small local evaluation gives better evidence.
- Pick 20 to 50 real tasks from your own history, each with an automatic pass or fail check.
- Run each task with each candidate model, using the same prompts and tools.
- Record total cost, number of turns, wall-clock time, and whether the check passed.
- Compute cost per resolved task and median time per task for each model.
Run each task more than once if you can. Model output varies between runs, and a single run can mislead you. With small samples, differences of a few percentage points are noise.
Pricing details that change the comparison
- Long-context surcharges. Some providers charge a higher rate once a request passes a certain size. A model that looks cheaper may cost more in a long session.
- Cache pricing. Cached input tokens are billed at a lower rate, and the discount differs by provider. A model with a better cache discount can win in long loops, even with a higher base price.
- Reasoning tokens. Models that think before answering produce extra output tokens that are billed. Two models with the same output price can differ widely in real output volume.
- Tokenizer differences. The same text may produce different token counts on different models, so equal per-token prices do not mean equal cost.
You can fold the first two into a cost estimate by using your measured usage data rather than assuming a flat rate.
Common mistakes
- Choosing by list price alone. This ignores retries and failed tasks.
- Using the largest model everywhere. Many steps, such as summarizing output, gain nothing from extra capability.
- Using the smallest model everywhere. Failures in planning steps can cause expensive wrong work later in the loop.
- Switching models mid-session without thinking about caching. A cached prefix belongs to a specific model. Changing models usually means paying full price to rebuild the context.
- Judging from one example. A model that handled one task well may fail on the next.
- Ignoring latency. Slow models add waiting time to every turn of a long loop.
- Never rechecking. New releases shift the best choice. Rerun your evaluation when the lineup changes.
Edge cases
- Tasks where failure is cheap to detect. If a test suite fails within seconds, trying a small model first costs little. Escalate freely.
- Tasks where failure is hard to detect. If a wrong answer looks plausible, such as a subtle security bug, prefer the stronger model up front. The cost of a missed error exceeds the token savings.
- Very short tasks. When a task uses only a few thousand tokens, the dollar difference between tiers is tiny. Optimize for success rate and latency instead.
- Very long sessions. When the context is large, the input price and cache discount dominate. Compare tiers on those numbers.
Summary of decision criteria
- Can you check the result automatically? If yes, start small and escalate. If no, start stronger.
- Is the step mechanical or open-ended? Mechanical steps suit small tiers. Open-ended ones suit large tiers.
- How long is the loop? Longer loops magnify both latency and per-turn token costs.
- What does your own evaluation say? Trust measured cost per resolved task over list prices.
Exercise
You run the same 40 tasks with two models. Model A spends $12.00 in total and resolves 16 tasks. Model B spends $26.00 in total and resolves 32 tasks. Compute the cost per resolved task for each model. Which is cheaper per resolved task, and what other factor should you weigh before choosing?
Show answer
Model A costs 12.00 / 16 = $0.75 per resolved task. Model B costs 26.00 / 32 = $0.8125 per resolved task. Model A is slightly cheaper per resolved task, but the gap is small. Model A fails 24 tasks, against 8 for Model B, so you should weigh the time and effort needed to handle those extra failures, plus latency and the variation between runs. Given those, Model B is likely the better choice unless failures are very cheap to catch and retry.
Exercise
Why can switching from a mid-tier to a large-tier model for one step in the middle of a long session cost more than the price difference per token suggests?
Show answer
The cached prefix belongs to the original model. The new model has no cache for it, so the whole context is billed at the full input rate for that turn. If the context is large, this one-time cost can exceed the savings from using the better-suited model.