Choosing a model
Trade capability, speed and cost across model families.
Create a free account Try part of it here
Why it matters
The same feature can cost $20 a month or $2,000, depending on the model behind it. Teams often start on a bigger model than the job needs. The cheapest model that does the work well is rarely the first one they try. Comparing models, and doing the cost math before you ship, is one of the most practical skills in AI engineering. If you've ever managed a budget, your instincts will help here.
What you'll be able to do
- Compare models on capability, speed, cost, context window and features
- Estimate what a feature will cost per request and per month
- Pick a starting model for a task, and know how to test a cheaper one
- Explain the difference between closed API models and open-weight models
What it covers
- The right tool for the job
- Doing the cost math
- Closed models and open-weight models
- How to choose, in practice
- Worked example: monthly budget for a feature
The right tool for the job
You wouldn't rent a moving truck to carry one box across town. You wouldn't try to move a whole house with a scooter, either. Choosing a model works the same way. Every provider sells a range of models, and they trade off along the same few lines:
| Trait | What it means for you |
|---|---|
| Capability | How well it handles hard reasoning, long instructions, code and subtle writing. |
| Speed | How quickly the first words arrive and how fast the rest streams. Smaller models are faster. |
| Price | Charged per million tokens. Output tokens (what the model writes) cost more than input tokens (what you send). |
| Context window | How many tokens fit in one request, counting your prompt and the reply. |
| Features | Extras such as tool use, reading images and PDFs, structured output, thinking and batch discounts. |
Within one family, bigger models are more capable. They're also slower and cost more. Your job is to match the model to the task.
The Claude family (October 2026)
| Model | Model id | Price per million tokens (input / output) | Best for |
|---|---|---|---|
| Claude Fable 5.1 | claude-fable-5-1 | $10 / $50 | The hardest reasoning and long agent tasks |
| Claude Opus 5.5 | claude-opus-5-5 | $4 / $20 | Default for demanding work: writing, coding, analysis, agents |
| Claude Sonnet 5.5 | claude-sonnet-5-5 | $2 / $10 | Everyday work where speed and cost matter more |
| Claude Haiku 5.5 | claude-haiku-5-5 | $0.10 / $0.50 | High-volume, simple tasks: tagging, routing, short extraction |
All four have a context window of 1 million tokens. Haiku's price applies to prompts up to 100,000 tokens. Prices and models change often. Treat these numbers as a snapshot, and check the provider's pricing page before you set a budget.
Look at the gap between Opus and Haiku. Opus charges $4 per million input tokens. Haiku charges $0.10. So each Haiku input token costs one fortieth as much.
Other providers follow the same pattern. OpenAI's GPT models and Google's Gemini models each come in larger and smaller sizes, with similar trade-offs.
Show the answer
40 times
$20 ÷ $0.50 = 40. Input prices show the same gap: $4 ÷ $0.10 = 40. The answer 19.5 is the difference in dollars ($20 − $0.50), not how many times bigger one price is.
Doing the cost math
You priced a single call in the tokens lesson. Here's the same idea as one line. Prices are quoted per million tokens, so you divide by a million at the end:
cost = (input tokens × input price + output tokens × output price) ÷ 1,000,000
In plain words: price what you sent, price what came back, and add the two. Then divide by a million, because each price covers a million tokens.
Here's an example with small numbers. Say you ask Opus 5.5 to tag one product review with a label, such as "positive" or "shipping problem". The review and your instructions come to about 300 tokens. The reply is about 20 tokens.
- Input: 300 × $4 = 1,200.
- Output: 20 × $20 = 400.
- Add them: 1,200 + 400 = 1,600.
- Divide by a million: 1,600 ÷ 1,000,000 = $0.0016.
The middle numbers aren't dollars yet. They turn into dollars at the last step. The answer, $0.0016, is less than a fifth of a cent. The code below does the same sum for three models. Then it multiplies by 50,000 to price a whole batch of reviews.
PRICES = { # dollars per million tokens: (input, output)
"claude-opus-5-5": (4.00, 20.00),
"claude-sonnet-5-5": (2.00, 10.00),
"claude-haiku-5-5": (0.10, 0.50),
}
def cost(model, input_tokens, output_tokens):
price_in, price_out = PRICES[model]
return (input_tokens * price_in + output_tokens * price_out) / 1_000_000
# Tagging one product review: ~300 tokens in, ~20 out
for model in PRICES:
per_review = cost(model, 300, 20)
print(f"{model:18} ${per_review:.6f} per review, ${per_review * 50_000:,.2f} for 50,000 reviews")PRICES is a dictionary. Each model name maps to a pair: the input price, then the output price. The line price_in, price_out = PRICES[model] unpacks that pair into two names. The :.6f shows six decimal places, so tiny costs don't print as zero.
The gap is huge. The 50,000-review job costs $80 on Opus, $40 on Sonnet and $2 on Haiku. The open question is quality. You'd test it with an eval: a set of examples with answers you trust. Evals come later in this phase. If Haiku tags reviews as well as Opus, the choice is easy. If accuracy drops from 95% to 80%, it might not be.
input_tokens = 1_000_000 print(input_tokens * 4 / 1_000_000)
Show the answer
4.0
Prices are per million tokens, so a million input tokens at $4 costs $4.00.
Using the prices in this lesson. Output costs five times as much as input, so watch how much the output slider moves the total.
Show the answer
$0.009
Input: 2,000 × $2 = 4,000. Output: 500 × $10 = 5,000. Add them to get 9,000, then divide by 1,000,000: $0.009 in total.
Closed models and open-weight models
Think of the difference between eating at a restaurant and getting the recipe. At the restaurant, you order and the food arrives. You never see the kitchen. With the recipe, you can cook at home and change it to taste. But you buy the ingredients and run the kitchen yourself.
Claude, GPT and Gemini are closed models, like the restaurant. You send requests to the provider's API, and you never see the model itself.
Open-weight models are the recipe. Their makers publish the weights, the huge set of numbers the model learned in training. Examples include Meta's Llama, Mistral's models, Alibaba's Qwen and DeepSeek's models. You can download them and run them on your own hardware. You can also rent a server to run them.
| blank | Closed API models | Open-weight models |
|---|---|---|
| Setup | An API key | Servers and GPUs, or a hosting service |
| Top capability | Usually higher | Close behind, improving fast |
| Data | Leaves your systems (under the provider's terms) | Can stay entirely in-house |
| Customizing | Prompts, plus fine-tuning where offered | Full control, including fine-tuning |
A GPU is a graphics chip. It's the kind of processor large models run on fastest. Fine-tuning means training a model a little more on your own examples.
Open-weight doesn't mean free to run. You stop paying per token. Instead, you pay for servers and the work of keeping them running.
Phase 6 covers running open models yourself. For most product work, an API model is the fastest way to get something working.
Show the answer
They stop paying per token, but now pay for servers and the work of running them
Downloading the weights is free, but running them takes servers, usually with GPUs, and people to look after them. Quality still needs testing, and the data can stay on the team's own servers.
How to choose, in practice
- Start capable. Build the first version on a strong model, such as Opus 5.5. That tells you whether the task can be done at all.
- Measure. Collect 20 to 50 real examples, along with the outputs you'd accept. This is your eval set.
- Step down. Run the same prompts on a cheaper model. Compare its results with the strong model's on your eval set.
- Route. Many apps use more than one model. A cheap model handles the easy, high-volume steps. A strong model handles the hard ones.
Before you step down to a cheaper model, try lowering the strong model's effort setting. It trades some depth of reasoning for speed and cost, and the next lesson covers it. It's often a better trade than switching models.
Watch out: thinking counts as output tokens. Some models work through a problem in writing before they answer, and that working-out is called thinking. A reasoning-heavy request on a big model can produce far more output tokens than the visible answer suggests. The next lesson shows how to control that.
Go deeper The math of routing
Go back to the 50,000 reviews. Say your eval shows Haiku handles 80% of them well. The other 20% need Opus. Assume something cheap sorts the reviews, and ignore its cost for now.
- Haiku: 40,000 reviews × $0.00004 = $1.60.
- Opus: 10,000 reviews × $0.0016 = $16.00.
- Total: $1.60 + $16.00 = $17.60.
Sending everything to Opus costs $80, so routing cuts the bill by more than three quarters. Real routers cost something too, and they sometimes send a review the wrong way. So check the mix on your eval as well.
Show the answer
The model thought before answering, and thinking counts as output tokens
150 words is roughly 200 tokens. The rest is the model's thinking. You pay for it at the output price, even if your app never shows it.
Worked example: monthly budget for a feature
A support assistant answers 1,200 questions a day. Each request sends a 3,000-token system prompt plus a question of about 200 tokens. Each reply is about 250 tokens. What does a 30-day month cost on each model?
PRICES = {"claude-opus-5-5": (4.00, 20.00), "claude-sonnet-5-5": (2.00, 10.00), "claude-haiku-5-5": (0.10, 0.50)}
def cost(model, input_tokens, output_tokens):
price_in, price_out = PRICES[model]
return (input_tokens * price_in + output_tokens * price_out) / 1_000_000
requests_per_month = 1_200 * 30
for model in PRICES:
monthly = cost(model, 3_200, 250) * requests_per_month
print(f"{model:18} ${monthly:,.2f} per month")A month has 1,200 × 30 = 36,000 requests. Each one sends 3,000 + 200 = 3,200 input tokens. The code prints $640.80 a month for Opus, $320.40 for Sonnet and $16.02 for Haiku.
Notice where the money goes. On Opus, the input side of the sum is 3,200 × $4 = 12,800. The output side is 250 × $20 = 5,000. Both are divided by the same million, so input makes up more than two-thirds of the bill. That's true even though each output token costs five times as much.
A long system prompt sent with every request adds up fast. Prompt caching gives a discount on exactly this kind of repeated text. You'll meet it in the cost lesson later in this phase.
Show the answer
$176.40
Per request: 1,200 × $2 = 2,400 and 250 × $10 = 2,500. Add them and divide by a million: $0.0049. Times 36,000 requests is $176.40, about 45% less than before. $86.40 forgets the output tokens, and $90.00 forgets the input.
Practice what you just read
- 2 code examples you can edit and run
- a practice exercise that checks your code
- a 5-question quiz
- 4 review cards for spaced repetition
Try a quiz question
Your first version works well on Claude Opus 5.5 but the monthly bill is too high. What's the best next step?