# The Claude model family: opus, sonnet, haiku, and when to use each
Picking the wrong Claude tier is the most common way to either burn money or ship something slow and dumb. Anthropic ships three model families, and the difference between them is not "better" versus "worse." It is a deliberate trade between raw capability, latency, and cost, and your job as a builder is to route each task to the cheapest tier that still clears the quality bar.
Here is the mental model before the details: Opus for the hardest reasoning and long agentic work, Sonnet for the everyday balance of smart-and-fast, and Haiku for high-volume, latency-sensitive jobs where you need an answer in a blink.
Think of the families as roles on a team, not a ranking.
Haiku is your fast responder. It is the cheapest and lowest-latency option, built for classification, extraction, routing, short summaries, and the inner loop of pipelines that run thousands of times. When you have a tight per-call budget and the task is well-scoped, Haiku is the default.
Sonnet is the workhorse. It handles most production traffic: drafting, coding, multi-step reasoning, tool use, and document analysis. It is meaningfully stronger than Haiku while staying fast and affordable enough to run at scale. If you are not sure where to start, start here.
Opus is the heavy thinker. Reach for it on genuinely hard problems: large refactors across many files, deep research synthesis, tricky agentic workflows where a wrong intermediate step compounds, and anything where the cost of a bad answer dwarfs the cost of the call.
The version numbers move (Anthropic has shipped Claude 4.x generations of Sonnet and Opus, with Haiku updated alongside), so always pull the current model IDs and capabilities from the model overview in the docs rather than hardcoding from memory. The *families* are the stable concept; the version suffix is what changes.
You are building a support tool with two very different jobs.
Job A: tag incoming tickets by category and urgency. This runs on every ticket, all day, and needs to be fast and cheap. The decision space is small and the prompt is the same every time. This is textbook Haiku.
from anthropic import Anthropic
client = Anthropic()
def classify_ticket(text: str) -> str:
resp = client.messages.create(
model="claude-haiku-4-5",
max_tokens=20,
system="Classify the ticket. Reply with exactly one of: BILLING, BUG, FEATURE, OTHER.",
messages=[{"role": "user", "content": text}],
)
return resp.content[0].text.strip()
print(classify_ticket("I was charged twice this month"))Notice the tight max_tokens and the constrained output. On a classification job you do not pay for a model to think out loud, you pay for a label.
Job B: an agent that resolves a complex bug by reading a multi-file repo, reproducing the issue, and proposing a patch. This is long-horizon, multi-step, and a wrong move early wastes the whole run. This is Opus territory (or a strong Sonnet if budget is tight and the codebase is small). Here the call looks different: high tokentokenA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → budget, tool access, and extended thinking turned on.
We will get to that control next.
Claude models carry a large context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète → (on the order of a couple hundred thousand tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → on the standard tiers, with even larger context available in some configurations). In practice that means you can drop an entire codebase module, a long contract, or a full meeting transcript directly into a single message instead of pre-chunking everything through retrieval.
That does not make RAG obsolete. It changes *when* you reachreachThe number of unique people exposed to your message in a given period. Unlike impressions, reach counts each person once, no matter how often they see it.Voir la définition complète → for it. The rule of thumb:
One non-obvious cost lever: prompt caching. When you send the same large prefix (a long system prompt, a big document, a tool schemaschemaA schema is the formal blueprint that defines how data is structured, named, typed, and related within a database, file, or message.Voir la définition complète →) across many calls, Anthropic can cache it so you do not pay full price to re-process it each time. For agentic loops that re-send the same context every turn, this is a large saving. The mechanics live in the Messages API docs.
This is where tier selection stops being binary. Modern Claude models expose extended thinking (also called the model's reasoning or "thinking" budget): you can let the model produce internal reasoning before its final answer, and you control how much.
More thinking means better results on hard, multi-step problems, at the cost of more tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → and more latency. Less thinking (or none) means fast, cheap answers that are fine for straightforward tasks.
You set this with a thinking parameter and a tokentokenA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → budget:
resp = client.messages.create(
model="claude-opus-4-5",
max_tokens=8000,
thinking={"type": "enabled", "budget_tokens": 4000},
messages=[{"role": "user", "content": "Refactor this module for testability:\n\n" + source}],
)The practical workflow is a two-axis decision, not one:
1. Pick the family (Haiku / Sonnet / Opus) for the floor of capability you need.
2. Tune the thinking budget for how hard *this specific call* is.
A Sonnet with a generous thinking budget can outperform an Opus with thinking off on certain reasoning tasks, and cost less. So measure on your own evals before assuming "biggest model wins." The cheapest reliable combination is the goal, not the most expensive one.
The same families power everything Anthropic ships, but the surface changes which tier you touch and how you steer it.
In the Claude apps (web, desktop, mobile) you usually pick the model from a dropdown. Projects let you pin a model plus persistent context and files for a body of work. Artifacts render generated documents, apps, and diagrams in a side panel you can iterate on. Styles let you save a tone and format so output matches your voice without re-promptingpromptingPrompt engineering is the practice of designing and refining text inputs to guide large language models toward accurate, relevant, and reliable outputs.Voir la définition complète → every time.
Skills package reusable instructions and resources the model can invoke for repeatable tasks, and Connectors (including the connector marketplace) link Claude to external tools and data sources. Under the hood, connectors speak MCP, the Model Context Protocol, the open standard for exposing tools, data, and prompts to a model in a consistent way. Learning MCP once means your integrations work across the apps, Claude Code, and your own APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète → agents.
For builders, three surfaces matter most:
max_tokens and thinking, attach tools, and run prompt caching. Everything else sits on top of this.The routing logic you learned above applies inside all of these. A managed agent might use Haiku to triage which files matter, then escalate to Opus for the actual fix. That kind of tiered routing inside one workflow is the advanced pattern worth internalizing.
Vérification des acquis
1. According to the lesson, what is the core principle a builder should follow when choosing a Claude tier?
2. The lesson recommends that if you are unsure where to start, you should begin with which model family?
3. The lesson advises pulling current model IDs from the docs rather than memory because version numbers change. What does it identify as the STABLE concept across these changes?
4. Select ALL correct answers about tasks that the lesson explicitly associates with Haiku.
Sélectionnez toutes les réponses correctes.
5. Select ALL correct answers that accurately describe Opus according to the lesson.
Sélectionnez toutes les réponses correctes.
Do not route by vibes. Write the policy down. Here is a starting template that maps task shape to tier.
routing:
- task: classification_or_extraction
model: haiku
thinking: disabled
notes: high volume, constrained output, tiny max_tokens
- task: drafting_summarizing_coding
model: sonnet
thinking: low_to_medium
notes: default for most production traffic
- task: long_agentic_or_deep_reasoning
model: opus
thinking: high
notes: refactors across files, research synthesis, costly-to-be-wrongThen do two things. First, set guardrails: cap max_tokens per tier so a runaway agent cannot quietly burn your budget. Second, build a tiny eval set of real tasks and run each tier against it. You will usually find Sonnet clears the bar on more tasks than you expected, and that you only truly need Opus on a minority. That is exactly the result you want: it means you are spending Opus money only where it pays off.
Pricing is per-tokentokenA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → and differs sharply by tier (Haiku is the cheapest, Opus the most expensive, by a wide margin). Because exact numbers change, check the current rates on the official pricing page before you model your unit economics. The durable principles:
thinking budget for how hard the specific call is; a well-tuned Sonnet often beats an under-thinking Opus.