Anthropic's Claude 3 lineup gave us three models: Haiku (small and fast), Sonnet (balanced), and Opus (the big one). I've been using all three through the API for two months. Here's when each one earns its cost, with a focus on the Opus vs Sonnet decision since that's where most developers are making their tradeoff.

The price difference is significant

Opus costs $15 per million input tokens and $75 per million output tokens. Sonnet costs $3 and $15 respectively. That's a 5x difference. For a single question, the cost is negligible. For a pipeline making thousands of calls per day, it's the difference between a reasonable API bill and an alarming one. This means the question isn't "which is better" but "when is Opus worth 5x the price."

Where Opus clearly wins

Complex multi-step reasoning. When I need the model to hold multiple constraints in mind simultaneously and produce a coherent solution, Opus is noticeably better. Architecture design with specific requirements, analyzing a codebase for a subtle bug, evaluating tradeoffs across multiple dimensions. Sonnet handles these tasks adequately, but Opus produces more thorough and nuanced responses.

Long document analysis. Both models support the same context window, but Opus does more with that context. When I paste 50K tokens of code and ask for a comprehensive review, Opus catches issues that Sonnet misses. It's better at maintaining attention across the full input, especially for details buried in the middle of long documents.

Ambiguous or underspecified prompts. When my prompt isn't perfectly clear (which happens more often than I'd like to admit), Opus makes better assumptions and asks better clarifying questions. Sonnet is more likely to pick one interpretation and run with it, which might not be the interpretation I intended.

Creative technical solutions. For problems where the standard approach isn't good enough and I need something clever, Opus suggests more creative solutions. It draws on analogies from different domains and proposes approaches I hadn't considered. Sonnet sticks more closely to conventional patterns.

Where Sonnet is the right choice

Straightforward code generation. "Write a function that validates email addresses." "Create a REST endpoint for user registration." For well-defined, standard tasks, Sonnet produces code that's just as good as Opus. The quality difference only appears on harder problems.

Bulk processing. If I'm running 1,000 API calls to classify documents, generate summaries, or extract structured data, Sonnet at 5x lower cost is the obvious choice. The marginal quality improvement from Opus doesn't justify 5x the spend when you're processing at scale.

Interactive development. When I'm coding and need quick answers, rapid function generation, and fast feedback loops, Sonnet's lower latency matters. Opus takes noticeably longer to respond, and in an interactive workflow, waiting 10 seconds instead of 3 seconds breaks your focus.

Simple Q&A. Factual questions, documentation lookups, explanation of error messages. Sonnet handles these perfectly. Sending these to Opus is like hiring a senior architect to answer "what does this error code mean."

My decision framework

I route tasks based on a simple mental model. Is this a task where being 10% smarter matters? If yes, Opus. If the task is well-defined and the difference between a good answer and a great answer is minimal, Sonnet.

In practice, this means about 20% of my API calls go to Opus and 80% go to Sonnet. The 20% that go to Opus are the high-value calls: architecture decisions, complex debugging, code review for critical paths, and anything where I'll act on the output without significant human review.

Don't forget Haiku

Haiku at $0.25/$1.25 per million tokens is absurdly cheap and surprisingly capable. I use it for classification, extraction, and simple transformation tasks. It's the workhorse behind my automated pipelines. For anything that doesn't require reasoning, just pattern matching and formatting, Haiku does the job at 60x less than Opus.

The practical setup

I have a simple routing function in my codebase that picks the model based on the task type. Architecture and review calls go to Opus. Standard coding tasks go to Sonnet. Classification and extraction go to Haiku. This isn't sophisticated, but it keeps my costs reasonable while ensuring quality where it matters most.

The Claude 3 lineup is well-designed. Instead of one model trying to be everything, you get three tools sized for different jobs. Use them accordingly and your API bills will thank you while your output quality stays high.