The Claude Models
Anthropic offers several Claude models; pick one by balancing capability, speed, and cost.
Claude comes in several models. They all use the same Messages API — you choose one by setting the model field in your request.
The current family
| Model | Model ID | Best for |
|---|---|---|
| Claude Opus 4.8 | claude-opus-4-8 | The most capable Opus-tier model — hard reasoning, long agentic coding tasks. |
| Claude Sonnet 5 | claude-sonnet-5 | Great balance of quality and cost for high-volume production work. |
| Claude Haiku 4.5 | claude-haiku-4-5-20251001 | Fast and cheap — classification, short replies, simple tasks. |
| Claude Fable 5 | claude-fable-5 | Anthropic's most capable model for the most demanding work. |
How to choose
- Default to a capable model (Opus or Sonnet) while building — quality first.
- Drop to Haiku for cheap, fast tasks that run at high volume.
- Only change the
modelstring — the rest of your code stays the same.
Example
{
"pick_a_model": {
"building_an_app": "claude-opus-4-8",
"high_volume_production": "claude-sonnet-5",
"cheap_fast_classification": "claude-haiku-4-5-20251001",
"hardest_tasks": "claude-fable-5"
}
}When to use it
- Route quick FAQ answers to claude-haiku-4-5 to keep latency under 500 ms and cost near zero.
- Use claude-sonnet-4-5 for complex code generation tasks where accuracy matters more than speed.
- Switch to claude-opus-4-5 only for the most demanding reasoning tasks, such as multi-step financial analysis.
More examples
Selecting Haiku for fast autocomplete
Uses the fastest, cheapest model for a latency-sensitive autocomplete feature.
const msg = await client.messages.create({
model: "claude-haiku-4-5",
max_tokens: 32,
messages: [{ role: "user", content: "Autocomplete: The user wants to" }],
});Sonnet for structured code generation
Targets the balanced model for a task that needs solid reasoning without maximum cost.
const msg = await client.messages.create({
model: "claude-sonnet-4-5",
max_tokens: 1024,
messages: [{
role: "user",
content: "Generate a React hook that debounces a value by 300 ms."
}],
});Model name as an env variable
Externalises the model name so it can be changed per environment without code edits.
const MODEL = process.env.CLAUDE_MODEL ?? "claude-sonnet-4-5";
const msg = await client.messages.create({
model: MODEL,
max_tokens: 512,
messages: [{ role: "user", content: prompt }],
});
Discussion