Choosing the right model is not a technical decision — it is an economic one. This lesson gives you a decision framework that optimizes for total cost of ownership, not just API cost.
The True Cost Equation
Most people only consider API cost. The real equation is:
Total Cost = API Cost + Human Review Cost + Error Cost + Opportunity Cost
- API Cost: Token pricing (Opus is ~1.7× Sonnet, ~20× Haiku)
- Human Review Cost: Time spent checking and fixing AI output
- Error Cost: Production bugs, security incidents, data corruption
- Opportunity Cost: Slower development velocity from using a weaker model
For critical tasks, Opus 4.6 is often the cheapest option because it minimizes human review and error costs.
Decision Matrix
graph TD
A[New Task] --> B{Correctness<br/>Critical?}
B -->|Yes| C{Budget<br/>Constrained?}
B -->|No| D{Volume<br/>>100/day?}
C -->|No| E[Opus 4.6]
C -->|Yes| F[Opus 4.6 with<br/>cost controls]
D -->|Yes| G[Haiku]
D -->|No| H{Complexity?}
H -->|Simple| G
H -->|Medium| I[Sonnet 4.5]
H -->|Complex| E
Task-to-Model Mapping
| Task Category | Model | Reasoning |
|---|---|---|
| Security audit | Opus 4.6 | Error cost is catastrophic |
| Architecture design | Opus 4.6 | Requires deep multi-step reasoning |
| Code review (critical) | Opus 4.6 | Must catch subtle bugs |
| Code review (routine) | Sonnet 4.5 | Good enough for style and basic issues |
| Bug fixing (complex) | Opus 4.6 | Better at root cause analysis |
| Bug fixing (simple) | Sonnet 4.5 | Cost-effective for straightforward fixes |
| Documentation | Sonnet 4.5 | Quality sufficient, lower cost |
| Code completion | Sonnet 4.5 | Speed matters more than depth |
| Log parsing | Haiku | High volume, pattern matching |
| Data extraction | Haiku | Structured, repetitive tasks |
| Customer support triage | Haiku | Simple classification |
Building an Automated Model Router
from dataclasses import dataclass
from enum import Enum
class ModelTier(Enum):
OPUS = "claude-opus-4-6-20260205"
SONNET = "claude-sonnet-4-5-20241022"
HAIKU = "claude-haiku-3-5-20241022"
@dataclass
class TaskProfile:
correctness_critical: bool
complexity: str # "low", "medium", "high"
volume: str # "single", "batch", "stream"
domain: str # "security", "coding", "content", "data"
def route_to_model(task: TaskProfile) -> ModelTier:
"""Route tasks to the appropriate model tier."""
# Security and architecture always get Opus
if task.domain in ("security", "architecture"):
return ModelTier.OPUS
# Critical correctness gets Opus
if task.correctness_critical and task.complexity != "low":
return ModelTier.OPUS
# High volume simple tasks get Haiku
if task.volume == "stream" and task.complexity == "low":
return ModelTier.HAIKU
# Everything else gets Sonnet
if task.complexity == "high":
return ModelTier.OPUS
return ModelTier.SONNET
Cost Projection Example
A team of 5 engineers using Claude daily:
| Scenario | Opus Only | Smart Routing | Savings |
|---|---|---|---|
| 500 requests/day | $125/day | $45/day | 64% |
| Monthly cost | $3,750 | $1,350 | $2,400/month |
Smart routing sends ~20% of tasks to Opus, ~50% to Sonnet, ~30% to Haiku — without sacrificing quality where it matters.
In the next lesson, we cover the breaking API changes when migrating from Opus 4.5.