Loading

Choosing the right model

Lesson 35 min
Loading

Choosing the right model

You're shipping an app with Claude. Which model do you pick? If you default to the smartest one, your API bill will surprise you. Pick the cheapest one, and the output might not hold up. Each model has different trade-offs, and picking the right one affects both quality and cost.

The model tiers

Anthropic currently offers four model tiers, and you choose between them with the model parameter in your API call. The models overview lists the current model and ID for each tier.

  • Claude Fable is the tier above Opus, built for your toughest challenges. It comes at a higher cost than Opus, so reserve it for work where that extra capability is worth paying for.
  • Claude Opus is the most capable of the three core model families, but also the slowest and highest cost of the three. Use it for deep reasoning, complex analysis, multi-step coding, and nuanced writing.
  • Claude Haiku is the fastest and lowest cost, optimized for speed and cost efficiency rather than maximum intelligence. Use it for high-volume, low-complexity work like classification, extraction, and routing.
  • Claude Sonnet sits in the sweet spot: a balanced combination of intelligence, speed, and cost that works well for most production work.

Three cards comparing three of the four Claude model tiers: Haiku (fastest, lowest cost, for classification and routing), Sonnet (capable and fast, for most production work), and Opus (labeled most intelligent and highest cost, for deep reasoning and complex analysis). The fourth tier, Claude Fable, sits above Opus in capability and cost and is not shown.

Start with a simple evaluation

Before you write production code, set up a simple evaluation: a set of example inputs that you run through each model and score against what good output means for your use case. You don't need anything fancy — 20 or 30 representative examples from your actual workload is enough to start.

Then work your way up the tiers:

  1. Run your examples through Haiku first. If the quality holds, you're done — and you just saved a lot of money.
  2. If it doesn't, step up to Sonnet.
  3. Only reach for Opus when the task needs it.

Comparing the tiers side by side

Let's see the difference between the tiers, not just talk about it. We'll send the same prompt through all three models and watch the latency and token counts:

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

const client = new Anthropic();
const models = ["claude-opus-5-5", "claude-sonnet-5-5", "claude-haiku-5-5"];
const prompt = "Define prompt caching in two sentences.";

for (const model of models) {
  const start = Date.now();
  const response = await client.messages.create({
    model,
    max_tokens: 1024,
    messages: [{ role: "user", content: prompt }],
  });
  const { input_tokens, output_tokens } = response.usage;
  console.log(`\n[${model}] ${Date.now() - start}ms in=${input_tokens} out=${output_tokens}`);
  for (const block of response.content) {
    if (block.type === "text") console.log(block.text);
  }
}

The model IDs in this sample were the latest in November 2026, so copy today's IDs from the models overview before you run it. Recent models think by default, and their thinking tokens count toward max_tokens, so set it high enough to leave room for both the thinking and the response text.

Two things are going on here:

  • The loop swaps the model field on each request. Same prompt, same max tokens — only the model changes.
  • response.usage gives you the input and output tokens straight back from the API, which is what your bill is calculated on.

Save the script as compare.mts in your project folder from "Your first API call." That folder already has the SDK and your .env.local file. Run the script with Node.js 24 or later:

node --env-file=.env.local compare.mts

Terminal output from running the same prompt through Opus, Sonnet, and Haiku, showing each model's latency and input/output token counts

Run it and you'll see three models and three sets of numbers. Opus usually takes the longest and reads the most polished — but for a two-sentence definition, that polish is wasted. Sonnet tightens the writing up a little. And Haiku comes back, often in under a second, with a very competent two-sentence answer. It's honestly perfect for this kind of scenario.

And that's the whole point: the right model is the cheapest one whose output you'd actually ship. For a definition, Haiku is plenty. For drafting a regulatory response, you'd run the same comparison and probably end up on Opus. The eval is the same shape every single time.

Routing different work to different models

In a real app, you'd route different kinds of work to different models inside the same endpoint. Take an operations dashboard with a document processing route:

  • Every incoming file gets classified with Haiku.
  • Client updates get drafted with Sonnet.
  • Only RFP responses reach for Opus.

One queue, three models, picked per task.

Recap

  • Anthropic offers four model tiers: Fable for the highest available capability, Opus for hard problems, Sonnet for daily work, and Haiku for volume.
  • Set up a simple evaluation — 20 or 30 representative examples from your real workload — before writing production code.
  • Run the eval from Haiku upward and stop at the cheapest model whose output you'd actually ship.
  • response.usage reports input and output tokens, which is what your bill is based on.
  • In production, route different tasks to different models inside the same endpoint instead of picking one model for everything.