Claude is not one model. It is a family of models, each designed for different tasks and budgets. Choosing the right model can save you money and get you better results.

This is Article 4 in the Claude AI — From Zero to Power User series. You should have completed Article 2: Getting Started before this article.

By the end of this article, you will know exactly when to use Opus, Sonnet, and Haiku.


The Three Tiers

Claude models come in three tiers:

  • Opus — The most intelligent model. Best at complex reasoning, large codebases, and multi-step tasks.
  • Sonnet — The balanced model. Near-Opus intelligence at lower cost. Best for daily coding and production.
  • Haiku — The fastest and cheapest model. Best for classification, extraction, and high-volume tasks.

As of early 2026, the current models are:

ModelAPI IDReleased
Opus 4.6claude-opus-4-6February 5, 2026
Sonnet 4.6claude-sonnet-4-6February 17, 2026
Haiku 4.5claude-haiku-4-5October 1, 2025

Pricing Comparison

Here is what each model costs per million tokens:

ModelInput ($/MTok)Output ($/MTok)Relative Cost
Opus 4.6$5.00$25.005x
Sonnet 4.6$3.00$15.003x
Haiku 4.5$1.00$5.001x (baseline)

Haiku is 5x cheaper than Opus on input and 5x cheaper on output. That is a significant difference at scale.

Real Cost Examples

Let’s compare the cost of common tasks across models:

TaskInput TokensOutput TokensHaiku CostSonnet CostOpus Cost
Simple question50100$0.0006$0.0017$0.0028
Code review (500 lines)2,0001,000$0.007$0.021$0.035
Document analysis (10 pages)10,0002,000$0.02$0.06$0.10
Complex coding task5,0005,000$0.03$0.09$0.15
1000 classifications (batch)50,00010,000$0.10$0.30$0.50

For a single API call, the difference is cents. But at scale — thousands of calls per day — model selection matters a lot.


Benchmark Comparison

Here is how the models compare on major benchmarks as of early 2026:

Coding

BenchmarkOpus 4.6Sonnet 4.6Haiku 4.5
SWE-bench Verified80.8%79.6%~55%
HumanEval~95%~93%~85%

The gap between Opus 4.6 and Sonnet 4.6 on SWE-bench is just 1.2 percentage points. This is the smallest gap ever between an Opus and Sonnet model. Sonnet 4.6 delivers 98% of Opus’s coding performance at 60% of the cost.

Reasoning

BenchmarkOpus 4.6Sonnet 4.6Haiku 4.5
GPQA Diamond (PhD-level)91.3%74.1%~60%
MATH~95%~90%~80%

This is where Opus shines. For complex, multi-step reasoning that requires chaining multiple expert concepts, Opus 4.6 is significantly better than Sonnet. The 17-point gap on GPQA Diamond is substantial.

Long Context

BenchmarkOpus 4.6Sonnet 4.6Haiku 4.5
MRCR v2 (8-needle, 1M)76%~50%N/A

Opus 4.6 is much better at finding specific information in very long documents. If you work with the 1M context window, Opus is the clear winner.

Office and Productivity

BenchmarkOpus 4.6Sonnet 4.6Haiku 4.5
GDPval-AA (office tasks)~1600 Elo1633 Elo~1400 Elo

Interestingly, Sonnet 4.6 leads all models on office productivity tasks. For data analysis, spreadsheet work, and document processing, Sonnet is actually the best choice.


Context Window and Max Output

FeatureOpus 4.6Sonnet 4.6Haiku 4.5
Standard context200K tokens200K tokens200K tokens
Extended context (beta)1M tokens1M tokensNot available
Max output128K tokens64K tokens64K tokens

Important: 1M Context Window Rules

The 1M token context window is a beta feature with specific requirements:

  1. Tier 4 access required — You need $400+ in deposits
  2. Special header — Add the context-1m-2025-08-07 header to your API requests
  3. Premium pricing — Requests exceeding 200K input tokens cost 2x input price and 1.5x output price

For most tasks, the standard 200K context is more than enough. 200K tokens is roughly 150,000 words or 500 pages.


Latency Comparison

Speed matters for real-time applications. Here is how the models compare:

MetricOpus 4.6Sonnet 4.6Haiku 4.5
Time to first token~2-4s~1-2s~0.3-0.5s
Tokens per second~80-100~100-150~200-300

Haiku is 4-6x faster than Opus. For real-time chat interfaces, autocomplete, and high-volume processing, Haiku’s speed is a major advantage.


When to Use Each Model

Use Opus When:

  • Complex multi-step reasoning — Debugging a chain of interconnected issues across multiple files
  • Large codebase analysis — Understanding architecture, finding patterns, planning refactors
  • Long context tasks — Analyzing documents over 100K tokens
  • Agent workflows — Multi-step tasks where accuracy at each step matters
  • Difficult coding problems — Algorithmic challenges, system design, complex integrations

Example: “Analyze this 50-file microservices project, identify all N+1 query problems, and propose a fix for each.”

Use Sonnet When:

  • Daily coding tasks — Writing functions, fixing bugs, adding features
  • Code reviews — Reviewing pull requests, suggesting improvements
  • Production APIs — Serving AI features in your application
  • Document processing — Summarizing, extracting, classifying documents
  • Cost-sensitive applications — When you need good quality at reasonable cost

Example: “Write a REST API endpoint for user registration with input validation and error handling.”

Use Haiku When:

  • Classification — Categorizing support tickets, sentiment analysis
  • Extraction — Pulling structured data from text (names, dates, amounts)
  • High-volume processing — Processing thousands of items per hour
  • Low-latency applications — Chat interfaces, autocomplete, real-time features
  • Simple transformations — Format conversion, text cleanup, translation

Example: “Classify these 10,000 customer reviews as positive, negative, or neutral.”


Model Selection Decision Tree

Follow this flowchart to choose the right model:

Start
  |
  ├── Need PhD-level reasoning? → Opus
  |
  ├── Analyzing 100K+ tokens? → Opus
  |
  ├── Building an agent? → Opus (or Sonnet for simpler agents)
  |
  ├── Need fastest response? → Haiku
  |
  ├── Processing 1000+ items? → Haiku
  |
  ├── Budget under $0.01/call? → Haiku
  |
  └── Everything else → Sonnet

When in doubt, start with Sonnet. It handles 90% of tasks well.


How to Switch Models in Code

Switching models is simple — just change the model parameter:

Python

import anthropic

client = anthropic.Anthropic()

# Use Sonnet for a quick coding task
response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Write a Python function to validate email addresses"}]
)
print(f"Sonnet cost: {response.usage.input_tokens} in, {response.usage.output_tokens} out")

# Use Opus for a complex analysis
response = client.messages.create(
    model="claude-opus-4-6",
    max_tokens=4096,
    messages=[{"role": "user", "content": "Analyze this architecture and suggest improvements for scalability..."}]
)
print(f"Opus cost: {response.usage.input_tokens} in, {response.usage.output_tokens} out")

# Use Haiku for a quick classification
response = client.messages.create(
    model="claude-haiku-4-5",
    max_tokens=10,
    messages=[{"role": "user", "content": "Classify this review as positive or negative: 'Great product!'"}]
)
print(f"Haiku cost: {response.usage.input_tokens} in, {response.usage.output_tokens} out")

TypeScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

// Use Sonnet for a quick coding task
const sonnetResponse = await client.messages.create({
  model: "claude-sonnet-4-6",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Write a function to validate email addresses" }],
});
console.log(`Sonnet: ${sonnetResponse.usage.input_tokens} in, ${sonnetResponse.usage.output_tokens} out`);

// Use Opus for complex analysis
const opusResponse = await client.messages.create({
  model: "claude-opus-4-6",
  max_tokens: 4096,
  messages: [{ role: "user", content: "Analyze this architecture and suggest improvements..." }],
});
console.log(`Opus: ${opusResponse.usage.input_tokens} in, ${opusResponse.usage.output_tokens} out`);

// Use Haiku for classification
const haikuResponse = await client.messages.create({
  model: "claude-haiku-4-5",
  max_tokens: 10,
  messages: [{ role: "user", content: "Classify as positive/negative: 'Great product!'" }],
});
console.log(`Haiku: ${haikuResponse.usage.input_tokens} in, ${haikuResponse.usage.output_tokens} out`);

Smart Model Routing

In production, you can route requests to different models based on the task:

Python

import anthropic

client = anthropic.Anthropic()

def get_model_for_task(task_type: str) -> str:
    """Choose the best model based on task complexity."""
    if task_type in ["agent", "complex_reasoning", "architecture"]:
        return "claude-opus-4-6"
    elif task_type in ["classification", "extraction", "simple_qa"]:
        return "claude-haiku-4-5"
    else:
        return "claude-sonnet-4-6"

def ask_claude(task_type: str, prompt: str) -> str:
    model = get_model_for_task(task_type)
    response = client.messages.create(
        model=model,
        max_tokens=2048,
        messages=[{"role": "user", "content": prompt}]
    )
    return response.content[0].text

# Route to Haiku (cheap and fast)
result = ask_claude("classification", "Is this spam? 'Buy now!!!'")

# Route to Sonnet (balanced)
result = ask_claude("coding", "Write a binary search function")

# Route to Opus (complex)
result = ask_claude("architecture", "Design a microservices system for...")

TypeScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

function getModelForTask(taskType: string): string {
  if (["agent", "complex_reasoning", "architecture"].includes(taskType)) {
    return "claude-opus-4-6";
  } else if (["classification", "extraction", "simple_qa"].includes(taskType)) {
    return "claude-haiku-4-5";
  }
  return "claude-sonnet-4-6";
}

async function askClaude(taskType: string, prompt: string): Promise<string> {
  const model = getModelForTask(taskType);
  const response = await client.messages.create({
    model,
    max_tokens: 2048,
    messages: [{ role: "user", content: prompt }],
  });

  if (response.content[0].type === "text") {
    return response.content[0].text;
  }
  return "";
}

// Route to Haiku
const spam = await askClaude("classification", "Is this spam? 'Buy now!!!'");

// Route to Sonnet
const code = await askClaude("coding", "Write a binary search function");

// Route to Opus
const design = await askClaude("architecture", "Design a microservices system for...");

This pattern reduces costs by 60-80% compared to using Opus for everything.


Legacy Models

Anthropic keeps older models available for backward compatibility:

ModelAPI IDStatus
Opus 4.5claude-opus-4-5Legacy
Sonnet 4.5claude-sonnet-4-5Legacy
Opus 4.1claude-opus-4-1Legacy (expensive: $15/$75 per MTok)

When to use legacy models:

  • Your application was tested and validated against a specific model version
  • You need reproducible results for compliance
  • You are migrating gradually and need time to test with newer models

For new projects, always use the latest models (Opus 4.6, Sonnet 4.6, Haiku 4.5).


Cost Optimization Tips

  1. Start with Sonnet. It handles 90% of tasks well. Only upgrade to Opus when Sonnet is not good enough.
  2. Use Haiku for preprocessing. Classify, filter, and extract before sending to Sonnet or Opus.
  3. Use prompt caching. Cache long system prompts to reduce input costs by 90%. (Covered in a later article.)
  4. Use the Batch API. For non-time-sensitive tasks, the Batch API gives 50% off all models. (Covered in a later article.)
  5. Set appropriate max_tokens. Do not set max_tokens to 4096 if you only need a one-word answer. Lower max_tokens = faster responses.
  6. Monitor costs. Use the API usage dashboard or Claude Code’s /cost command to track spending.

Summary

QuestionAnswer
Best overall model?Sonnet 4.6 — 98% of Opus coding quality at 60% cost
Best for complex reasoning?Opus 4.6 — 91.3% on PhD-level questions
Best for high-volume?Haiku 4.5 — 5x cheaper, 4-6x faster than Opus
Best for production?Sonnet 4.6 — balanced cost, quality, and speed
Best for agents?Opus 4.6 — accuracy matters at every step

What’s Next?

In the next article, we will cover prompt engineering — how to write system prompts, use few-shot examples, and apply chain of thought to get better results from Claude.

Next: Prompt Engineering Basics — System Prompts, Few-Shot, Chain of Thought