Alright, let’s talk about the main event: the Claude model family. You’ve got three options—Haiku, Sonnet, and Opus—and your job is to know which one to pick for the task at hand. This isn’t just about picking the “smartest” one; it’s about picking the right tool. Using Opus to summarize a tweet is like using a particle accelerator to crack a walnut. Impressive? Sure. A grotesque waste of resources? Absolutely.

Think of them as a spectrum: Haiku is fast and cheap, Sonnet is the well-rounded workhorse, and Opus is the deep-thinking powerhouse you call in for the really gnarly problems. Their intelligence and capability (and cost) scale in that order.

The Pragmatic Workhorse: Claude Sonnet

If you’re building a product and you’re not sure which model to use, start with Sonnet. I’m serious. It’s the default for a reason. It offers an almost perfect balance of speed, cost, and intelligence for the vast majority of tasks. It’s your reliable mid-range sedan: it gets you where you need to go, efficiently and without fuss. It excels at general Q&A, summarization, coding help, and multistep reasoning. Most of the examples you’ll see in the docs (and in this book) use Sonnet because it’s the sensible choice.

# A classic, sensible use of Sonnet
from anthropic import Anthropic

client = Anthropic()
response = client.messages.create(
    model="claude-3-sonnet-20240229",
    max_tokens=500,
    temperature=0.7, # A little creativity for a blog post
    messages=[{
        "role": "user",
        "content": "Write a short, engaging intro for a blog post about the history of API design, from SOAP to REST to GraphQL."
    }]
)
print(response.content[0].text)

The Speed Demon: Claude Haiku

Meet Haiku, the fastest and most affordable model in the lineup. Its purpose isn’t to write you a sonnet about the nature of consciousness (that’s Sonnet and Opus’s job); its purpose is to be instant. Use it for simple classifications, light-weight moderation, effortless data extraction, and any other high-volume, low-complexity task where latency is a killer. The first time you run a Haiku request, you’ll laugh at how quickly it returns. It feels like the future.

# Perfect use case for Haiku: simple, fast, high-volume classification
client = Anthropic()
response = client.messages.create(
    model="claude-3-haiku-20240307",
    max_tokens=10, # You only need a single word back!
    temperature=0, # You want a deterministic classification
    messages=[{
        "role": "user",
        "content": "Classify the sentiment of this user review as 'POSITIVE', 'NEGATIVE', or 'NEUTRAL': 'The new update finally fixed the battery drain issue! Loving it so far.'"
    }]
)
print(response.content[0].text) # Almost certainly outputs: POSITIVE

The Big Gun: Claude Opus

Opus is the intellectual heavyweight. It’s significantly more expensive and a tad slower, but for tasks requiring deep reasoning, complex analysis, or nuanced understanding, nothing else comes close. This is the model you use to analyze a 100-page PDF and draw connective insights, to brainstorm a novel business strategy, or to solve a fiendishly difficult logic puzzle. Don’t use it for everything. Save it. Cherish it. Bill your clients accordingly.

# A task worthy of Opus's capabilities
client = Anthropic()
response = client.messages.create(
    model="claude-3-opus-20240229",
    max_tokens=1000,
    temperature=0,
    messages=[{
        "role": "user",
        "content": "Review the attached research paper (PDF). First, summarize the core thesis and methodology. Second, identify the strongest supporting evidence. Third, pinpoint the most significant potential flaw or limitation in the authors' argument. Be critical and concise."
    }]
)
# ... you'd attach the PDF bytes here using the 'tools' parameter

The “Which Model Should I Use?” Cheat Sheet

Stop guessing. Here’s your decision tree:

  • Is it a high-volume, simple task where speed and cost are paramount?Haiku.
  • Are you prototyping, building a general feature, or need a great balance of smart and fast?Sonnet. (You’ll be here 80% of the time).
  • Are you tackling a problem that requires deep, connective, groundbreaking intelligence and the outcome is mission-critical?Opus.

One crucial technicality: the model version. You’ll notice the full model IDs include a date stamp (e.g., claude-3-sonnet-20240229). This “pins” your application to a specific version of the model, ensuring consistent behavior even as Anthropic releases newer, potentially slightly different versions. For prototyping, you can just use claude-3-sonnet-latest, but for any production system, pin your model version. The last thing you want is a surprise model update subtly changing your API’s behavior on a Tuesday morning. Trust me.