+160 XP

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 a deliberate trade between raw capability, latency, and cost. Your job as a builder is to route each task to the cheapest tier that still clears the quality bar.

The short version: 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.

The three tiers, by job not by ego

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 the task is well-scoped and the per-call budget is tight, 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 stronger than Haiku and still 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 hard problems: large refactors across many files, deep research synthesis, 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. At the time of writing the current generation is Opus 4.6, Sonnet 4.6, and Haiku 4.5, and that will change again. Pull current model IDs and capabilities from the model overview in the docs instead of hardcoding from memory. The families are the stable concept. The version suffix is what changes.

A concrete routing example

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.

python
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 pay for a label. You do not pay for a model to think out loud.

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 and 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. The call looks different here: a high token budget, tool access, and thinking turned on at a high effort level.

We will get to those controls next.

The large context window changes how you prompt

Claude models carry a large context window. The standard tiers handle around 200,000 tokens, and current Opus and Sonnet models offer a 1 million token window in some configurations. In practice you can drop an entire codebase module, a long contract, or a full meeting transcript into a single message instead of pre-chunking everything through retrieval.

That does not make RAG obsolete. It changes when you reach for it:

  • If the material fits comfortably and you query it once or twice, put it in the prompt. Simpler, fewer moving parts.
  • If the corpus is huge, changes constantly, or gets queried thousands of times, retrieve so you are not paying to re-read the same tokens on every call.

One non-obvious cost lever is prompt caching. When you send the same large prefix (a long system prompt, a big document, a tool schema) 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, the saving is large. The mechanics are in the Messages API docs.

Effort and thinking controls

This is where tier selection stops being binary. Modern Claude models can reason internally before giving a final answer (extended thinking), and you control how much.

More thinking gives better results on hard, multi-step problems and costs more tokens and latency. Less thinking gives fast, cheap answers that are fine for straightforward tasks.

On the newest models the recommended setup is adaptive thinking plus an effort level. You turn thinking on, and the model decides how much to reason based on the request. The effort setting (low, medium, high, or max on Opus) tells it how hard to try overall:

python
resp = client.messages.create(
    model="claude-opus-4-6",
    max_tokens=16000,
    thinking={"type": "adaptive"},
    output_config={"effort": "high"},
    messages=[{"role": "user", "content": "Refactor this module for testability:\n\n" + source}],
)

Older models such as Opus 4.5 and Haiku 4.5 use a fixed budget, thinking={"type": "enabled", "budget_tokens": 4000}. That form is deprecated on the 4.6 models, so if you are upgrading an existing app, check the docs for which parameters each model accepts. Effort also affects plain output and tool calls. On medium or low, a model writes tighter answers and makes fewer exploratory tool calls even with thinking off.

The practical workflow is a two-axis decision:

  1. Pick the family (Haiku, Sonnet, Opus) for the floor of capability you need.
  2. Set the effort for how hard this specific call is.

A Sonnet at high effort can outperform an Opus at low effort on some reasoning tasks, and it costs less. Measure on your own evals before assuming the biggest model wins. The goal is the cheapest combination that is reliable.

Claude's extended thinking, explained

Watch on YouTube

Where the tiers show up across the ecosystem

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 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 save a tone and format so output matches your voice without re-prompting every time.

Skills package reusable instructions and resources the model can invoke for repeatable tasks. Connectors, including the connector directory, link Claude to external tools and data. 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. Learn MCP once and your integrations work across the apps, Claude Code, and your own API agents.

For builders, three surfaces matter most:

  • The Messages API is the raw endpoint where you choose the model ID, set max_tokens, thinking, and effort, attach tools, and use prompt caching. Everything else sits on top of it.
  • Claude Code is Anthropic's agentic coding tool. It runs in your terminal and editor, reads and edits your repo, runs commands, and connects to MCP servers. You can switch models and effort inside it, and it is where long agentic coding tasks live.
  • The Claude Agent SDK gives you the harness Claude Code is built on, so you can build your own agents with the same loop: tool use, file access, and multi-turn execution. Repos and examples are at github.com/anthropics, and the GitHub integration lets Claude open pull requests and respond to issues directly.

The routing logic above applies inside all of these. An agent might use Haiku to triage which files matter, then escalate to Opus for the actual fix. Tiered routing inside one workflow is the advanced pattern worth internalizing.

Knowledge check

1. According to the lesson, what is the primary goal when choosing between Claude model tiers?

2. The lesson describes the difference between the model families as which of the following?

3. In the support tool example, why is Haiku the right choice for tagging incoming tickets by category and urgency?

MULTIPLE CHOICE

4. Select ALL statements that correctly describe when to reach for Opus.

Select all the correct answers.

MULTIPLE CHOICE

5. Select ALL statements that reflect the lesson's guidance on model families and versions.

Select all the correct answers.

A simple routing policy you can actually ship

Do not route by vibes. Write the policy down. Here is a starting template that maps task shape to tier:

yaml
routing:
  - task: classification_or_extraction
    model: haiku
    thinking: disabled
    notes: high volume, constrained output, tiny max_tokens

  - task: drafting_summarizing_coding
    model: sonnet
    effort: medium
    notes: default for most production traffic

  - task: long_agentic_or_deep_reasoning
    model: opus
    thinking: adaptive
    effort: high
    notes: refactors across files, research synthesis, costly-to-be-wrong

Then do two things. First, set guardrails: cap max_tokens per tier so a runaway agent cannot quietly burn your budget. Second, build a small eval set of real tasks and run each tier and effort level against it. You will usually find Sonnet clears the bar on more tasks than you expected, and that you only need Opus on a minority. That is the result you want, because it means you spend Opus money only where it pays off.

A note on cost discipline

Pricing is per-token and differs sharply by tier. Haiku is the cheapest and Opus the most expensive, by a wide margin. Exact numbers change, so check the official pricing page before you model your unit economics. The durable principles:

  • Thinking tokens are billed as output tokens. High effort on Opus adds up fast at scale.
  • Prompt caching is the biggest lever for repetitive large-context calls.
  • Very long prompts on the 1M context window can be billed at a higher rate, so do not fill it just because you can.
  • Escalation beats blanket upgrades. Run the cheap tier first, detect low confidence or failure, then retry on a stronger tier.

Key Takeaways

  • Route by task, not by prestige. Haiku for high-volume classification and extraction, Sonnet as the everyday default, Opus for long agentic work and deep reasoning where a wrong answer is expensive.
  • Tier and effort are separate dials. The family sets the capability floor, and effort (with adaptive thinking on current models) sets how hard each call works. A well-tuned Sonnet often beats an under-tuned Opus.
  • Older models use a fixed budget_tokens for thinking. The newest ones use adaptive thinking and effort, so check which parameters your model ID supports.
  • Use the large context window deliberately. Put material in the prompt when it fits and you query it rarely, retrieve when the corpus is huge or hit constantly, and cache the repeated prefix either way.
  • Write your routing policy down and back it with a real eval set. You will usually need Opus less often than instinct suggests, and MCP plus tiered routing carry across the apps, Claude Code, and the Agent SDK.

What to do, from this lesson

These actions are compiled in the role's Playbook.

  • Route tasks to Haiku, Sonnet, or Opus by cost and difficulty
  • Tune model tier and thinking budget as two separate dials
  • Enable prompt caching on repeated large-context calls
  • Escalate to a stronger tier only on detected low confidence
See the full action playbook →

Related articles

Recent articles from the blog that build on this lesson.