Claude model comparison cover showing Opus and Sonnet differences
AI/ML

What Are Claude Opus and Claude Sonnet? (Simple Explanation)

Think of Anthropic (the company that makes Claude) as a car manufacturer. They make different models for different needs

By Pankaj Sonani from aigrama
#ai-ml#llm-architecture

The Family Analogy

Think of Anthropic (the company that makes Claude) as a car manufacturer. They make different models for different needs:

ModelCar AnalogyWhat It Means
Claude OpusLuxury sedanThe most powerful, smartest, most capable model. Handles the hardest problems. More expensive and slower.
Claude SonnetReliable mid-range carVery capable, but balanced for everyday use. Faster and cheaper than Opus. Good enough for most tasks.
Claude HaikuEfficient compact carExtremely fast and cheap. Good for simple, high-volume tasks.

The Simple Rule

  • Opus = When the task is really hard and accuracy matters more than speed or cost
  • Sonnet = When the task is normal difficulty and you want a good balance
  • Haiku = When you need to do thousands of simple things quickly and cheaply

Simple Explanation (For Non-Technical Readers)

Imagine Claude as a giant pattern-matching machine. During training, it read an enormous library of text—books, articles, code, conversations. It doesn’t memorize; it learns the relationships between words, ideas, and concepts.

When you ask Claude something, it:

  1. Breaks your question into small pieces (called tokens)
  2. Runs those pieces through layers of understanding (like passing a message through many people, each adding their interpretation)
  3. Predicts the most helpful next piece, then the next, building a response one small chunk at a time

The difference between Opus and Sonnet is mostly size and depth:

  • Opus has more layers, more parameters (the “knobs” that get tuned during learning), and more computational power behind it. This means it can hold more complex reasoning in its “mind” at once.
  • Sonnet is slightly smaller and optimized for efficiency. It still has the same fundamental architecture but trades some raw reasoning power for speed and cost.

Technical Explanation (For Developers/Engineers)

Architecture Foundation: Both Opus and Sonnet are decoder-only transformer models. The key architectural components:

  1. Tokenization: Input text is tokenized (Claude uses a variant of BPE tokenization). A token is roughly 0.75 words. “Technical blogging” might become [“Techn”, “ical”, ” blog”, “ging”].

  2. Embedding Layer: Each token is mapped to a high-dimensional vector (the embedding space). Claude’s embeddings capture semantic meaning—similar concepts are close together in this space.

  3. Transformer Blocks (The difference maker):

    • Each block contains multi-head self-attention followed by a feed-forward network
    • Opus has more transformer blocks and wider layers (more parameters overall, likely in the hundreds of billions)
    • Sonnet has fewer blocks/narrower layers, optimized through distillation and efficient attention mechanisms
    • Both use grouped-query attention (GQA) for memory efficiency during inference
  4. Self-Attention Mechanism:

    • For each token, the model computes attention scores against all other tokens in the context window
    • This is how Claude “understands context”—the word “bank” gets different representations depending on whether surrounding words are about finance or rivers
    • Computational complexity: O(n²) where n is context length. This is why longer contexts cost more and why Sonnet’s efficiency optimizations matter
  5. Context Window:

    • Both models support 200K tokens (roughly 150,000 words or a 500-page book)
    • The KV cache (key-value cache storing previous attention computations) enables efficient multi-turn conversations without recomputing the entire history
  6. Training Approach:

    • Pre-training: Next-token prediction on a massive corpus (details proprietary, but includes web text, books, code)
    • RLHF (Reinforcement Learning from Human Feedback): Anthropic’s signature approach
    • Constitutional AI: Claude is trained with a “constitution” of principles that guide its behavior—this is Anthropic’s differentiator, focusing on helpfulness and harmlessness
    • The same constitution applies to both Opus and Sonnet, so their values are identical; only their capabilities differ
  7. Inference Differences:

    • Opus: Runs on more compute (likely more GPUs/TPUs in parallel), uses full precision or near-full precision weights, minimal quantization
    • Sonnet: Likely uses some form of quantization (reducing numerical precision of weights), optimized attention kernels, possibly speculative decoding for faster generation
    • This is why Sonnet can be 2-3x faster and significantly cheaper while maintaining ~90%+ of Opus’s capability on most tasks

The Practical Upshot: If you think of the transformer as a deep thinking pipeline, Opus is a wider, deeper pipe that can hold more nuance simultaneously. Sonnet is a slightly narrower pipe optimized to flow faster. For most tasks, the difference is imperceptible. It only shows on tasks requiring very deep reasoning, subtle nuance, or extremely precise instruction-following.


Getting Started (The First Step)

  1. Go to claude.ai
  2. Create a free account (email or Google login)
  3. Free tier gives you Sonnet with some usage limits
  4. Upgrade to Claude Pro ($20/month) to access Opus and get higher usage limits
  5. For API access, go to console.anthropic.com, create an API key, and you can call both models programmatically

Example 1: Technical Blog Writing (Both Audiences)

The Prompt (Your Thinking):

I want to write a blog post about why startups should use PostgreSQL instead of MongoDB for most use cases.

My key points:
- Relational data is more common than people think
- ACID compliance matters when money is involved
- Modern PostgreSQL has great JSON support anyway
- The ORM argument for MongoDB is weak

Target audience: Technical founders who default to MongoDB

Tone: Opinionated but fair, not preachy

Structure:
1. Hook about a common startup database migration nightmare
2. Acknowledge MongoDB's genuine strengths
3. Then systematically address each misconception
4. Practical migration guide
5. Conclusion

Write a 1500-word draft following this structure. Use concrete examples.

What Sonnet Would Produce: A solid, well-structured draft. Good flow. Decent examples. Might occasionally use slightly generic phrasing. Would take about 15-20 seconds.

What Opus Would Produce: Subtle differences—more varied sentence structure, more surprising and memorable examples, tighter reasoning that anticipates counterarguments better. Might catch a nuance in your outline that Sonnet missed. Takes 30-45 seconds.

How to Iterate: Sonnet: “Take section 3 and make the argument sharper. Use a real-world scenario.” Opus: Same instruction, but Opus might produce a more structurally interesting revision, perhaps reorganizing the argument flow for maximum impact.


Example 2: How a Non-Technical User Might Use Claude

Scenario: A marketing manager needs to understand a technical concept to communicate with their engineering team.

Their Approach:

  1. Start simple: “Explain what an API is like I’m a complete beginner”
  2. Ask for analogies: “Can you give me a metaphor from everyday life?”
  3. Verify understanding: “So if I understand correctly, an API is like a waiter in a restaurant—I tell the waiter what I want from the kitchen, and they bring it back. Is that right?”
  4. Ask for practical application: “Given that understanding, what questions should I ask our engineering team about our API strategy?”
  5. Ask for communication help: “Draft an email to our CTO asking about API documentation timelines, using the correct terminology so I sound informed.”

Which Model to Use: Sonnet is perfect for this. It’s fast, responsive, and the tasks don’t require Opus-level reasoning depth.


Example 3: How a Technical User Might Use Claude

Scenario: A developer needs to design a complex system architecture.

Their Approach:

  1. Context dump: “I’m building a real-time collaboration feature. Multiple users editing the same document simultaneously. I need to handle conflict resolution. Here’s my current stack: React frontend, Node.js backend, PostgreSQL database. Here are my constraints: [list].”
  2. Ask for analysis: “What are the three main architectural approaches to conflict resolution for collaborative editing? Compare them with pros/cons for my specific stack.”
  3. Deep dive: “Let’s go deeper on Operational Transformation. Walk me through how I’d implement a basic OT system in Node.js, with code examples.”
  4. Stress test: “Given the approach you just outlined, what are the failure modes? What happens if a WebSocket connection drops mid-edit? How would you handle recovery?”
  5. Iterate: “Actually, I think CRDTs might be better for my use case. Compare your OT implementation against a CRDT approach for offline-first editing.”

Which Model to Use: This is where Opus shines. The multi-step reasoning, holding complex context across long conversations, and catching subtle edge cases. Sonnet would do a good job too, but Opus might catch a failure mode Sonnet misses.


A Practical Getting Started Guide

Step 1: Create Your Account

  • Go to claude.ai
  • Sign up with email or Google
  • You’re now on the free tier (Sonnet access)

Step 2: Understand the Interface

  • The chat interface is straightforward—like any messaging app
  • You can attach files (PDFs, images, code files, spreadsheets)
  • There’s a “Projects” feature (Pro only): Create a project, upload reference documents, set custom instructions. This is extremely useful for maintaining consistent context across conversations.

Step 3: Learn Effective Prompting (Simple Rules)

For Non-Technical Users:

  • Be specific about what you want: Instead of “Tell me about databases,” say “Compare PostgreSQL and MongoDB for a small e-commerce site with 1000 products. I’m non-technical and deciding which to use.”
  • Give examples of good output: “Write an email like this one [paste example] but for this new situation.”
  • Ask for formats: “Summarize this in 3 bullet points, each under 50 words.”
  • Course-correct: “That was too technical. Try again for someone with no tech background.”

For Technical Users:

  • Provide full context upfront: Your stack, your constraints, what you’ve already tried
  • Specify the output format: “Give me the solution in Python with type hints, async/await patterns, and error handling.”
  • Use the Projects feature: Upload your API docs, codebase context, or style guides
  • Chain complex tasks: “First, analyze this architecture for single points of failure. Then, propose three mitigations. Finally, rank them by implementation complexity.”

Step 4: Know When to Switch Models (If You Have Pro)

Use Sonnet when:

  • You need fast responses
  • The task is straightforward
  • You’re iterating quickly
  • You’re doing many smaller tasks

Switch to Opus when:

  • Sonnet’s answer feels slightly off or shallow
  • You’re working on something where mistakes are costly
  • The reasoning chain is deep and complex
  • You need maximum nuance and precision
  • You’re making a final, important decision

Step 5: The Projects Feature (Secret Weapon)

This is worth setting up immediately:

  1. Create a “Project” in Claude
  2. Upload your context documents (style guides, technical specs, past writing samples)
  3. Set custom instructions: “Always write in my voice. My writing style is [description]. I prefer short paragraphs, active voice, and concrete examples over abstract explanations.”
  4. Now every conversation in that project automatically follows your rules

Summary: The Mental Model for Choosing

Think of it this way:

When You…Use…
Are brainstorming or exploringSonnet (fast iteration)
Need a quick explanationSonnet
Are drafting something routineSonnet
Are making a high-stakes decisionOpus
Need maximum accuracy on a hard problemOpus
Are working on a final, publishable versionOpus
Have a massive volume of simple tasksHaiku (via API)

The non-technical user’s shortcut: Start with Sonnet. If the answer seems a bit shallow or not quite right, switch to Opus for that specific question. You’ll develop an intuition for when each is needed.

The technical user’s shortcut: Use Opus for architecture decisions, complex debugging, and critical code reviews. Use Sonnet for documentation generation, boilerplate code, and quick syntax questions. Use Haiku via API for automated pipelines, chat moderation, or high-volume simple tasks.


Let me expand on the three areas you asked about. I’ll keep this practical and example-driven, with clear separation between concepts for non-technical and technical readers.


Part 1: Claude Projects — Full Setup Guide

What Is a Project? (Simple Explanation)

Imagine you have a personal assistant. Every time you start a new conversation, they forget everything you’ve told them before. That’s normal Claude.

A Project is like giving your assistant a permanent notebook. You write down your preferences, your style, important reference documents, and key information. Now every conversation within that Project starts with the assistant already knowing all of that.

When Should You Create a Project?

Create a separate Project for each distinct area of your work:

Project NameWhat You’d Store In It
”Blog Writing”Your writing style guide, past blog posts, common outlines, target audience descriptions
”Work Reports”Company style guide, report templates, jargon glossary, past reports
”Learning Python”Your current skill level, learning goals, code examples you like
”Home Renovation”Room measurements, contractor quotes, inspiration photos, budget spreadsheet

Step-by-Step Setup (With Screenshot Descriptions)

Step 1: Create the Project

  • Click “Projects” in the left sidebar of claude.ai
  • Click “Create Project”
  • Give it a name: “Technical Blog Writing”
  • Write a description: “All my technical blog drafts, style guides, and publishing workflow”

Step 2: Set Custom Instructions (The Most Important Part)

This is where you teach Claude to write like you. Here’s a real example of what to put in custom instructions:

MY WRITING STYLE AND PREFERENCES:

Voice and Tone:
- Conversational but precise. Imagine explaining to a smart colleague over coffee.
- Never use corporate jargon like "leverage," "utilize," "synergy," "deep dive."
- Avoid starting sentences with "However," "Moreover," "Furthermore."
- I prefer short paragraphs. Maximum 3-4 sentences per paragraph.
- Use concrete examples over abstract explanations. Every claim needs a specific instance.

Structural Preferences:
- Blog posts should start with a hook: a surprising fact, a provocative question, or a short story.
- Use subheadings every 300-400 words.
- End with a clear takeaway, not a vague summary.
- Code blocks should always have comments explaining the non-obvious parts.

Things to Never Do:
- Don't add fluff introductions like "In today's fast-paced digital world..."
- Don't end with "In conclusion..." or "To sum up..."
- Don't use metaphors without a concrete anchor. "This is like a car engine" means nothing without explaining which part.

About Me:
- I'm a backend developer with 8 years of experience, now blogging for an audience of mid-level developers.
- I prefer Python and Go examples.
- My readers are practical—they want solutions, not theory.

Step 3: Upload Knowledge Files

Click “Add Content” and upload documents that Claude should reference:

  • Style guide: If you have a formal style guide, upload it
  • Your best posts: Upload 3-5 blog posts you’re proud of. Claude will learn your voice from these
  • Common reference material: API documentation you frequently write about, your product’s technical specs
  • Templates: If you have a standard blog post template, upload it

Example: For a technical blogger writing about Kubernetes:

Files to upload:
- style-guide.md (my writing preferences)
- best-post-1.md (a post I'm proud of)
- best-post-2.md (another strong example)
- k8s-glossary.md (common Kubernetes terms with my preferred definitions)
- blog-template.md (my standard post structure)

Now when you start a conversation in this Project and say “Draft a post about Kubernetes pod scheduling,” Claude already knows your voice, your template structure, your preferred terminology, and what good looks like for you.


Part 2: API Usage Patterns

Simple Explanation (Non-Technical)

An API (Application Programming Interface) is a way for your own software to talk to Claude without going through the claude.ai website.

Think of it this way:

  • claude.ai website = Going to a restaurant and ordering from a waiter
  • API = Having the restaurant’s kitchen in your own house. You can cook whatever you want, whenever you want, and build your own ordering system.

You’d use the API if you want to build something custom—like a writing tool that automatically drafts blog posts from your notes, or a chatbot on your own website.

Common API Usage Patterns

Pattern 1: The Batch Writer Your software takes a folder of markdown notes, sends each to Claude’s API with instructions to turn them into blog drafts, and saves the results.

Pattern 2: The Interactive Editor A custom writing interface where you highlight a paragraph, press a button, and Claude rewrites just that paragraph through the API.

Pattern 3: The Multi-Model Pipeline Your software sends the same prompt to both Opus and Sonnet through the API, gets both responses, and lets you compare them side by side.

Practical API Setup (Minimal Technical Knowledge Required)

The simplest way to start with the API without deep coding knowledge:

Option A: Use a No-Code Tool

  • Zapier or Make.com have Claude integrations. You can set up: “When I add a note to this Google Doc, send it to Claude and save the response in another document.” No code required.

Option B: Use a Pre-Built Writing Tool

  • TypingMind, Typist, or NovelCrafter are writing tools that connect to Claude’s API. You put in your API key, and they give you a nice writing interface powered by Claude instead of the claude.ai chat interface.

Option C: Simple Python Script (For Beginners Willing to Try Code)

# This is a complete, working script. You only need to:
# 1. Install Python
# 2. Run: pip install anthropic
# 3. Get an API key from console.anthropic.com
# 4. Replace "YOUR_API_KEY_HERE" with your actual key

from anthropic import Anthropic

client = Anthropic(api_key="YOUR_API_KEY_HERE")

# Your blog post notes
my_notes = """
Topic: Why we switched from MongoDB to PostgreSQL
Key points:
- Data integrity issues with MongoDB
- PostgreSQL JSON support is good enough now
- Team already knew SQL
"""

# The system prompt (like Projects custom instructions)
system_prompt = """
You are a technical blog writer. Write in a conversational but precise tone.
Use short paragraphs. Start with a hook. No corporate jargon.
"""

# Send to Claude
response = client.messages.create(
    model="claude-sonnet-3-5-20241022",  # Use sonnet for speed
    max_tokens=2000,
    system=system_prompt,
    messages=[
        {"role": "user", "content": f"Turn these notes into a blog post draft:\n\n{my_notes}"}
    ]
)

# Print the result
print(response.content[0].text)

# Save to a file
with open("blog_draft.md", "w") as file:
    file.write(response.content[0].text)

Cost context: Using the API, Sonnet costs roughly $3 per million input tokens and $15 per million output tokens. For a typical blog post (1000 words of notes, 1500 words of output), you’re looking at roughly $0.02-0.05 per draft.


Part 3: Prompting Techniques for Non-Technical People

Forget the complex “prompt engineering” advice you see online. For non-technical users, effective prompting comes down to a few simple patterns.

Pattern 1: The “Persona + Task + Format” Formula

This is your everyday prompt structure. Fill in three blanks:

“[Act as a specific person] + [Do this specific thing] + [In this specific format]”

Bad prompt: “Write about databases.”

Good prompt: “Act as a patient teacher explaining databases to a complete beginner. Compare SQL and NoSQL databases. Format your answer as a conversation between a teacher and student, with clear examples for each concept.”

Why this works: You’ve given Claude a role (patient teacher), a task (compare SQL and NoSQL), and a format (teacher-student conversation with examples).

Pattern 2: The “Good Example / Bad Example” Technique

This is the single most powerful technique for getting exactly what you want. Show Claude what you like and what you don’t like.

The Prompt Structure:

I want you to [task].

Here's an example of what I consider GOOD:
[Paste a good example]

Here's an example of what I consider BAD:
[Paste a bad example]

Now do [task] in the style of the good example.

Real Example for a Non-Technical Manager Writing a Project Update:

I want you to write a weekly project update email to my team.

GOOD example (the style I want):
"Team — Quick update on the website redesign. Design mockups are done (link below). Engineering starts Tuesday. One hiccup: we're still waiting on copy from marketing. I'll chase that tomorrow. No other blockers. Full details in the attached doc if you want them."

BAD example (the style I DON'T want):
"Dear Team, I hope this message finds you well. As we continue to make progress on our quarterly initiatives, I wanted to take a moment to provide a comprehensive overview of our current status regarding the website redesign project..."

Now write this week's update. My bullet points: design phase complete, development starts Monday, budget is on track, need decisions on mobile layout by Friday.

Claude will immediately understand your communication style from the examples and replicate it.

Pattern 3: The “I’ll Know It When I See It” Iteration Loop

You don’t need the perfect prompt upfront. Use this conversation flow:

Round 1: Give a rough request “Summarize this article for me.”

Round 2: Correct what’s wrong “That’s too long. Make it 3 sentences max.”

Round 3: Refine further “Good length, but it’s too formal. Make it sound like you’re texting a friend.”

Round 4: Add nuance “Perfect tone. Now add one sentence at the end about why this matters for my job in marketing.”

The key insight: You don’t need to anticipate everything in your first prompt. Claude remembers the conversation. Build toward what you want across multiple messages.

Pattern 4: The “Explain It to My Specific Audience” Technique

When you need to communicate a technical concept to a specific group:

The Prompt:

Explain [concept] to [specific audience with context].

The audience is:
- What they already know: [their background]
- What they care about: [their priorities]
- What confuses them: [common misconceptions]
- What they need to do with this information: [the action]

Real Example:

Explain containerization (Docker) to my company's marketing team.

The audience is:
- What they already know: They use software daily but have never coded. They understand "apps" and "websites."
- What they care about: Why this makes our product releases faster and more reliable. How to explain it to customers.
- What confuses them: They think "containers" are like shipping containers and get confused by technical diagrams.
- What they need to do with this information: Write accurate marketing copy about our new containerized product without making technical mistakes.

Use an analogy from the restaurant industry. Avoid the word "container" in the explanation if possible.

Pattern 5: The “No, Try Again Differently” Refusal

Many people accept Claude’s first answer even when it’s not quite right. Instead, get comfortable pushing back:

Instead of starting over, say things like:

  • “That’s close but too formal. Try again, this time imagine you’re explaining it to a friend at a bar.”
  • “You’re using too many technical terms. Rewrite this as if you’re explaining it to your grandmother who has never used a computer.”
  • “That example doesn’t resonate with me. Give me three completely different analogies for the same concept.”
  • “You’re writing too much. Cut this by 50% but keep all the key facts.”
  • “I like paragraph 2 but paragraphs 1 and 3 miss the mark. Rewrite only those, keeping paragraph 2 exactly as is.”

Pattern 6: The “Structure Your Thinking” Technique

For complex requests where you want Claude to think before writing:

The Prompt:

I want you to [final task]. But before you write anything, do this:

Step 1: Summarize your understanding of what I'm asking for. I'll confirm it's correct.
Step 2: Outline your approach in 3-5 bullet points.
Step 3: Once I approve the outline, write the full version.

Don't skip ahead. Wait for my confirmation after each step.

Why this works: It prevents Claude from running off in the wrong direction on a complex task. You catch misunderstandings early.


Putting It All Together: A Complete Workflow for a Non-Technical Blogger

Here’s how a non-technical person who wants to write a technical blog would use everything we’ve covered:

Setup (Do Once):

  1. Create a “Blog Writing” Project in Claude
  2. Set custom instructions with your voice, style, and preferences
  3. Upload 3-5 of your best posts as examples
  4. Upload any style guide or template you use

Writing a New Post (Repeat Each Time):

Message 1 — The Brain Dump:

I want to write a post about [topic]. Here are my rough thoughts and key points:

[Paste your messy notes, bullet points, voice memos transcribed, whatever you have]

Don't write the post yet. First, organize these thoughts into a logical outline and suggest a structure. Also tell me what's missing—what should I add to make this post stronger?

Message 2 — Adjust the Outline:

Good outline. Let's adjust:
- Move point 3 before point 2—that flow makes more sense
- Add a section about [missing topic you thought of]
- The conclusion should emphasize [specific takeaway]

Now draft the post following this adjusted outline. Write around 1500 words. Remember my style: short paragraphs, concrete examples, no corporate jargon.

Message 3 — The First Edit:

Good first draft. Specific changes:
- The intro is weak. Start with [the specific hook you want]
- Section 2 needs a concrete code example showing [specific thing]
- Cut section 4 by half. It's repetitive.
- The tone in section 3 is too academic. Make it more conversational.

Message 4 — Polish:

Much better. Now let's polish:
- Read the whole post and flag any sentences that sound awkward or "AI-generated"
- Check for varied sentence length. Some should be very short. Some longer.
- Make sure I'm not using the same transition words repeatedly
- Add one unexpected but relevant analogy somewhere in section 2

Message 5 — Final Check:

Almost done. One last pass:
- Read this as if you're a skeptical reader. What counterarguments would they raise? Add brief acknowledgments of those counterarguments.
- Check if the conclusion actually delivers on the promise made in the introduction.
- Give me three title options that are specific, provocative, and not clickbait.

Quick Reference Card: Which Technique When?

You Want To…Use This Technique
Start any new taskPersona + Task + Format
Get your exact styleGood Example / Bad Example
Improve a responseIteration Loop (don’t restart)
Explain something to a specific personExplain to My Audience
Claude got it wrongNo, Try Again Differently
Tackle a complex taskStructure Your Thinking
Write consistently over timeProjects with Custom Instructions
Automate repeated tasksAPI with a simple script or no-code tool