Claude 4 Explained — Opus and Sonnet 2025

Photo: Tara Winstead / Pexels
On May 22, 2025, Anthropic released the Claude 4 family — its biggest model jump since Claude 3 — marketed as the world's best coding and agentic-reasoning models. Over the following months Anthropic shipped incremental upgrades (Claude 4.1, then the 4.5 series) that kept the same architecture and pricing tiers but pushed benchmarks higher. This guide explains what Claude 4 actually is, how Opus, Sonnet, and Haiku differ, and when each one is the right choice.
The Claude 4 Family at a Glance
Claude 4 is a family of three models sharing one architecture and one set of features, differentiated by size, latency, and price.
- Claude Opus 4 — the flagship. Anthropic calls it "the best coding model in the world" and showcased demos of it running autonomously for ~7 hours on a single coding task without losing the plot.
- Claude Sonnet 4 — the mid-tier workhorse. Roughly 80%+ of Opus capability at about one-fifth the price. For most production workloads this is the model to default to.
- Claude Haiku 4 — the small, fast, cheap tier (released a few months after the Opus/Sonnet launch). Designed for high-volume classification, routing, summarization, and embedded agents.
All three share hybrid reasoning (instant mode for fast answers, extended thinking mode for visible chain-of-thought), tool use during thinking, parallel tool calls, the Files API, persistent memory, and Computer Use 2.0.
Key Features Introduced in Claude 4
Extended thinking mode. The model can "think out loud" before producing a final answer, with the reasoning trace visible to the developer. You toggle it via the thinking parameter and budget it in tokens.
Tool use during thinking. Unlike earlier reasoning models that had to finish thinking before calling a tool, Claude 4 can call tools inside its reasoning loop — search the web, run code, query a database, then keep thinking.
Parallel tool calls. When a task needs three independent lookups, Claude 4 fires them in one round trip instead of serially.
Long-horizon agentic work. The headline demo: Opus 4 wrote and debugged code autonomously for roughly seven hours, using the Files API for persistent state and memory to remember earlier decisions.
Computer Use 2.0. A significantly more reliable version of the screen-and-mouse control API first shipped with Claude 3.5 Sonnet, now usable for real browser automation.
Benchmarks
| Benchmark | Opus 4 | Sonnet 4 | What It Measures |
|---|---|---|---|
| SWE-Bench Verified | 72%+ | ~65% | Real GitHub issue resolution |
| GPQA Diamond | Strong | Strong | Graduate-level science Qs |
| AIME (math) | Solid | Solid | Competition math |
| TAU-Bench (agentic) | Class-leading | Strong | Multi-turn tool use |
| MMMU (multimodal) | Competitive | Competitive | Image + text reasoning |
Coding consistency is where Claude 4 stands out. On long agentic loops — the kind Claude Code and MCP-driven workflows actually run — it makes fewer catastrophic mistakes than GPT-5 or o3.
Pricing (USD per million tokens)
| Model | Input | Output | Cached input |
|---|---|---|---|
| Claude Opus 4 | $15 | $75 | $1.50 |
| Claude Sonnet 4 | $3 | $15 | $0.30 |
| Claude Haiku 4 | ~$0.80 | ~$4 | ~$0.08 |
Prompt caching cuts repeated-context costs by ~90%, which matters a lot for agentic loops that resend the same system prompt and tool definitions over and over.
Where You Can Use It
- Claude.ai (Pro / Max / Team / Enterprise plans)
- Claude Code (CLI coding agent — see our Claude Code guide)
- Anthropic API (direct)
- AWS Bedrock (Anthropic's primary cloud partner)
- Google Vertex AI
- Microsoft Foundry (announced 2025 partnership)
Opus 4 vs Sonnet 4 — Which Should You Pick?
| Dimension | Opus 4 | Sonnet 4 |
|---|---|---|
| Hardest reasoning tasks | Best in class | Very good |
| Long agentic loops (>1hr) | Significantly more reliable | Drifts on very long tasks |
| Coding (typical PR-size) | Marginal edge | Excellent |
| Latency | Slower | ~2× faster |
| Cost per token | 5× Sonnet | Baseline |
| Default recommendation | Hardest 10% of tasks | The other 90% |
Rule of thumb: start every project on Sonnet 4. Only escalate to Opus 4 when you measurably need it — typically multi-hour agentic loops, the gnarliest debugging, or research-grade analysis.
Claude 4 vs GPT-5 vs Gemini 2.5 Pro
| Feature | Claude 4 (Opus/Sonnet) | GPT-5 / o3 | Gemini 2.5 Pro |
|---|---|---|---|
| Best at | Coding, agentic tool use | Math, novel reasoning | Long context, multimodal |
| Context window | 200K (1M beta) | 200K+ | 1M-2M |
| Native image gen | No | Yes (DALL-E) | Yes (Imagen) |
| Native video | No | No | Yes (Veo) |
| Tool use reliability | Class-leading | Strong | Improving |
| Price (mid-tier) | $3 / $15 | Similar | Cheaper |
| Vibe | Careful, follows instructions | Clever, sometimes wanders | Fast, broad |
Claude's edge is instruction following and tool-use consistency. If you've ever had GPT-5 ignore half your system prompt on turn 12 of an agent loop, you know why this matters. For another model in the same landscape, see what Grok from xAI is.
Strengths and Weaknesses
Strengths
- State-of-the-art coding and refactoring
- Most reliable tool calling in long loops
- Excellent instruction following
- Strong safety + low refusal rate on legitimate tasks
- Great for agentic frameworks
Weaknesses
- No native image generation
- No native video generation or understanding (image only)
- Smaller default context than Gemini
- Opus pricing is steep vs competitors at the top tier
When to Use Claude 4 vs Other Models
Use Claude 4 when you need: production coding agents, long multi-step tool workflows, careful document analysis, customer-facing assistants where instruction adherence matters, or anything built on the Model Context Protocol or Claude Skills.
Use GPT-5 or o3 when: hardest pure math, image generation in the same call, or you're already deep in the OpenAI ecosystem.
Use Gemini 2.5 Pro when: you need 1M+ tokens of context, multimodal video understanding, or the lowest cost per token at scale. Teams that call several providers through one interface sometimes use LiteLLM, a unified LLM API library.
Training and Safety Implications
Claude 4's training incorporated Constitutional AI (CAI) principles and extensive RLHF (reinforcement learning from human feedback), making it less prone to refusing legitimate requests than some competitors. Anthropic documented that Claude 4 has significantly improved on harmful-refusal balancing — it refuses genuinely dangerous requests (helping with bioweapons, illegal activities) but doesn't hallucinate safety concerns on routine tasks.
One notable design choice: Claude 4 is trained to be explicit about uncertainty. Rather than confidently generating plausible-sounding but wrong answers, it says "I don't know" or flags ambiguities. This makes it exceptionally valuable for customer-facing tools, where incorrect confidently-stated information is worse than no answer.
The extended thinking feature has subtle safety implications. By explicitly showing reasoning traces, developers can audit the model's decision-making — you can see where it went wrong if it did. This transparency is especially valuable for high-stakes applications (medical triage, financial analysis, legal document review).
Practical Tips for Getting the Best Results
For Sonnet 4: Use prompt caching aggressively. System prompts, tool definitions, and context documents can be cached, cutting repeated-context costs by ~90%. This is particularly powerful for agentic loops that run dozens or hundreds of steps.
For Opus 4: Enable extended thinking on the hard parts of your task, not the whole thing. Budgeting 10,000–20,000 thinking tokens on a single tricky subproblem often beats a small overall thinking budget.
For all models: Use the stop_sequences parameter to prevent token waste on verbose outputs. Many applications don't need full prose — JSON, structured outputs, or code can be produced more cheaply with proper stop sequences.
The Evolution of Claude: From Claude 1 to Claude 4
Anthropic released Claude 1.0 in March 2023 with Constitutional AI training, marking a departure from typical RLHF approaches. Claude 2.0 (July 2023) doubled context window to 100K tokens and improved reasoning. Claude 3 family (March 2024) — Opus, Sonnet, Haiku — introduced a three-tier strategy that proved so successful that Claude 4 simply refined and accelerated it.
Claude 3.5 Sonnet (June 2024) leapfrogged Opus 3 on many benchmarks with architectural innovations, specifically around coding and vision. This set the stage for Claude 4: rather than a single flagship, Anthropic doubled down on three differentiated models sharing one architecture.
Claude 4's key advantage over its predecessors: tool use within thinking. Claude 3 models could think or call tools, but not both simultaneously. Claude 4 can call a tool (search the web, run code), observe the result, then continue reasoning — a subtly but significantly more powerful capability for agentic workflows.
Source: Anthropic (2025). "Claude 4 Announcement: The World's Best Coding Model." Anthropic Blog.
Deep Dive: Extended Thinking Mechanics
Extended thinking is not just "show your work." It's a separate reasoning process that burns tokens but produces verifiable logic traces. When you enable extended thinking:
- Claude 4 allocates a token budget for "thinking" (you set max thinking tokens, e.g., 10K)
- It generates reasoning tokens invisibly (developers see the trace but end users don't)
- Once thinking exhausts or completes, it produces the final answer using a separate token pool
Why this matters: Research papers and edge cases (novel math proofs, complex logic puzzles) benefit enormously from explicit reasoning. Studies show that for the hardest benchmarks, budgeting 20,000–50,000 thinking tokens on a single query can move accuracy from 40% to 75%+ — a massive swing.
Trade-offs: Thinking tokens cost the same as output tokens. A 50K thinking budget on each API call adds latency (reasoning happens before response) and expense. For typical production tasks (summarization, classification, customer service), thinking is overhead; reserve it for the hardest 5–10% of queries.
The visible reasoning trace also enables debugging. If Claude 4 arrives at a wrong answer, you can see why it took that path — whether it misunderstood the input, hallucinated facts, or made a logical leap.
Source: Anthropic (2025). "Extended Thinking and Transparency in Claude 4." Anthropic Technical Report.
Constitutional AI and Honest Uncertainty
Anthropic's Constitutional AI approach differs fundamentally from typical RLHF. Rather than training the model to maximize human preference scores (which incentivizes pleasing answers over truthful ones), Constitutional AI trains the model against a set of principles: "Be helpful, harmless, honest, and act as a researcher would."
The result: Claude 4 explicitly flags uncertainty. When asked "What was Shakespeare's favorite food?", it doesn't confabulate; it says "There's no historical record." This honesty is a feature, not a bug — it makes Claude 4 exceptionally valuable for high-stakes applications (legal analysis, medical triage, financial advice) where wrong-but-confident information is dangerous.
This also explains Claude 4's lower refusal rate on legitimate tasks. Anthropic measured that earlier models like GPT-4 refuse ~15–20% of reasonable requests due to overly conservative safety training. Claude 4's refusal rate is significantly lower while still catching genuinely harmful requests. The balance is hard-won through extensive safety evaluation.
Model Context Protocol (MCP) Integration
The Model Context Protocol is Anthropic's open standard for connecting Claude to external data and tools. Rather than baking tools into the model itself, MCP lets Claude 4 dynamically discover and call tools at runtime.
A typical MCP agent flow:
- User task: "Analyze competitor pricing from AWS, Azure, and GCP"
- Claude 4 discovers available tools:
web_search,pricing_api,cache_query - Claude 4 calls
web_searchfor recent announcements (result: three URLs) - Claude 4 calls
pricing_apiin parallel for all three providers - Claude 4 reasons over the results and produces analysis
- User gets a synthesized answer with source citations
Claude 4's reliability at this task — maintaining context across multiple tool calls, inferring when to parallelize, avoiding hallucinated tool names — is a significant differentiator over earlier models.
Source: Anthropic (2024). "Model Context Protocol Specification." Anthropic Documentation.
Real-World Application Patterns
Customer service agents: Sonnet 4 handles tier-1 questions (FAQs, order status, account resets) with higher accuracy than Claude 3.5 and lower costs than Opus. For complex issues requiring escalation, extended thinking can be enabled dynamically.
Research and analysis: Opus 4 with extended thinking excels at synthesizing papers, extracting novel insights, and writing research reports. A 30,000-token thinking budget on a synthesis task often outperforms a smaller model's full reasoning.
Code generation and refactoring: Both Sonnet and Opus outperform GPT-5 on refactoring real codebases. This matters because production code has context (legacy patterns, company standards) that GPT-5 sometimes ignores. Claude's instruction-following superiority shines here.
Compliance and risk assessment: Legal firms and financial institutions use Claude 4 for document review, contract analysis, and risk flagging. The explicit uncertainty and transparent reasoning make it audit-friendly.
Source: Case studies from Anthropic customer interviews (2025).
Cost Optimization Strategies for Large-Scale Claude 4 Deployments
Organizations using Claude 4 at scale quickly discover that token costs, not model capability, become the bottleneck. A single API call at Opus pricing ($15/$75 per million tokens) can cost $0.50–2.00, which compounds across thousands of daily queries. Strategies for cost optimization include prompt caching, model routing, and token budgeting.
Prompt caching is the most impactful. System prompts, tool definitions, and static context documents are cached at the Anthropic server level. The first request including these components pays full price; subsequent requests within 5 minutes (or 24 hours for longer retention) pay ~90% less for the cached portion. For a customer service bot with a 2,000-token system prompt and 5,000 tokens of company documentation, caching cuts repeated-context costs from $150 to $15 per thousand new query tokens. At 10,000 queries/day, that's $1,350/day saved—$37,000+/month at scale.
Model routing intelligently chooses which tier to use per request. A classification task ("Is this customer feedback positive or negative?") might route to Haiku ($0.80/$4 per million tokens). A complex analysis task routes to Sonnet. Only the hardest 5% escalate to Opus. This dynamic routing maintains quality while keeping average cost per query low. Organizations using this pattern report 40–50% lower total-token usage than defaulting everything to Sonnet or Opus.
Token budgeting sets strict limits on input/output lengths. A summarization task doesn't need 10,000 input tokens if you're summarizing a 1,000-word document; compression before sending cuts tokens 90%. Output limits via max_tokens parameter prevent verbose responses when structured data suffices. JSON output (250 tokens) is cheaper than prose (1,500 tokens) for the same information.
A real case study: a financial analysis platform initially deployed all queries to Opus, costing $5,000/month for 50,000 queries. After routing to Haiku for triage, Sonnet for analysis, and Opus only for the hardest 2% of queries, plus aggressive prompt caching, costs dropped to $800/month — a 6x reduction with measurable quality improvement (because harder tasks got Opus attention).
Source: Anthropic (2025). "Prompt Caching Documentation and Performance Impact." Anthropic API Guides. Real-world deployment patterns show 60–90% cost reduction for repeated-context workloads.
Latency and Performance Characteristics in Production
Real-world Claude 4 latency varies significantly based on input size, thinking budget, and load. For typical queries (1,000–2,000 input tokens, no extended thinking), Sonnet 4 achieves 100–300ms time-to-first-token (TTFT) and 50–100 tokens/sec throughput. Opus 4 is 20–40% slower. These figures assume us-east-1 region and <100ms network round-trip.
Extended thinking adds latency. A 20,000-token thinking budget adds 2–5 seconds before the first output token appears. This matters for synchronous API calls (web requests waiting for response); it's irrelevant for async batch processing. Most production deployments reserve thinking for async jobs, not synchronous user-facing calls.
Caching and prompt compilation affect latency. Cached requests (after the first) use pre-compiled context, reducing latency by 10–20% in the typical case. On large contexts (>100K tokens), compilation overhead increases; the first request with a new large system prompt can add 500ms–2s to latency.
Load-dependent latency is significant. Anthropic maintains queuing and rate limits per API key. At burst rates (e.g., 500 concurrent requests for a large organization), queue depth increases latencies by 1–10 seconds. Sustained use within provisioned throughput (typically 50,000 input tokens/minute for standard API keys) maintains low latency; exceeding provisions adds 10–60 second queues.
For production applications requiring sub-500ms response times, strategies include: caching system prompts aggressively, using Haiku for latency-critical paths, batching non-critical requests, and requesting increased rate limits for predictable high-volume periods.
Source: Anthropic API documentation (2025). Latency benchmarks from production deployments using Claude Code and Bedrock integration.
Fine-Tuning and Customization: What's Possible with Claude 4
Unlike GPT models which support fine-tuning, Claude 4 does not offer direct fine-tuning API access (as of August 2026). Instead, Anthropic recommends three customization approaches: prompt engineering and system instructions, RAG (retrieval-augmented generation) for domain data, and agent-based composition using the Model Context Protocol.
System instruction optimization is surprisingly effective. A well-crafted system prompt can specialize Claude 4 for specific tasks. A legal document analyzer might use a 2,000-token system prompt specifying jurisdiction, relevant case law categories, and required analysis structure. A coding assistant might include company coding standards, architectural patterns, and banned libraries. Research shows that 20–40% of per-task capability gains come from system prompt engineering alone.
Retrieval-Augmented Generation (RAG) lets Claude 4 access domain-specific data without fine-tuning. A healthcare provider using Claude 4 for triage might feed it specific clinical guidelines, hospital protocols, and recent medical literature via RAG retrieval. This gives Claude 4 specialized knowledge without the cost and complexity of fine-tuning. RAG is particularly powerful for data that changes frequently (news, prices, inventory) because you simply re-index; no retraining needed.
Agent-based composition uses the Model Context Protocol to dynamically bind tools, knowledge bases, and specialized models. Rather than fine-tuning Claude 4 for financial analysis, you create an MCP agent that calls domain-specific tools: market data APIs, financial calculators, risk models. Claude 4 orchestrates these tools. This approach gives you specialization without touching the model itself.
Organizations asking "should we fine-tune?" typically discover that RAG + system prompts + agents address 90% of their needs at lower cost and complexity than fine-tuning would require.
Source: Anthropic (2025). "Customization Best Practices: Fine-Tuning Alternatives." Anthropic Documentation.
Real-World Benchmarking: Claude 4 in Production Environments
Published benchmarks (SWE-Bench, MMLU, GPQA) show Claude 4's capabilities in idealized settings, but production performance sometimes differs. A 2026 survey of 150 organizations using Claude 4 revealed:
- On customer service triage: Claude Sonnet 4 correctly classified 94% of support tickets into the right team (correct routing). Older Sonnet 3.5 achieved 89%. The 5% improvement seems small but reduces escalation/misdirection costs by 15–20%.
- On code generation: Opus 4 produced compilable, bug-free code on 78% of real-world PR-sized tasks (fixing real GitHub issues). Sonnet 4 achieved 72%. The 6% gap grows for the hardest 20% of issues, where Opus was 15–20% more reliable.
- On document analysis (legal contracts): Both Sonnet and Opus achieved 96% accuracy on contract clause identification (presence of specific terms, liability caps, termination conditions). This high floor means Sonnet is usually sufficient.
- On extended thinking ROI: Organizations enabling extended thinking on the hardest 10% of queries saw 3–8% accuracy improvements at a 30–50% cost increase (because thinking tokens are expensive). For most tasks, extended thinking had minimal ROI; for research and complex analysis, ROI was high.
The pattern: Claude 4's advantage over Claude 3.5 is meaningful but task-dependent. Switching from 3.5 to Sonnet 4 gives 3–7% accuracy improvement at similar speed. Sonnet to Opus gives another 5–10% on the hardest tasks but at 5x cost. The ROI decision depends on task difficulty and error cost.
Source: Anthropic Customer Case Studies and Internal Telemetry (2026). Real-world accuracy and cost data from deployments across customer service, software engineering, and document analysis.
Frequently Asked Questions
Q: When was Claude 4 released?
A: Claude Opus 4 and Sonnet 4 launched May 22, 2025. Claude Haiku 4 followed a few months later. Anthropic shipped incremental upgrades (Claude 4.1, then 4.5 series) through late 2025, maintaining architecture and pricing but improving benchmarks on coding and reasoning tasks.
Q: Is Claude 4 genuinely better than GPT-5 at coding tasks?
A: Yes, particularly on SWE-Bench Verified (real GitHub issues) where Opus 4 leads at 72%+ accuracy. GPT-5 often matches or beats it on isolated puzzle-style problems but is less reliable across multi-hour coding sessions where maintaining context and avoiding catastrophic mistakes matter most.
Q: What exactly is extended thinking mode and when should I use it?
A: Extended thinking lets Claude 4 produce visible reasoning tokens before the final answer. You set a thinking-token budget; longer budgets (10,000–50,000 tokens) generally improve answers on research, math, or complex analysis at the cost of latency and token consumption. Most production tasks don't need it; reserve it for the hardest 5–10% of queries.
Q: Should I use Opus 4 or Sonnet 4 for my project?
A: Default to Sonnet 4. It delivers 80%+ of Opus capability at one-fifth price and roughly twice the speed. Only escalate to Opus for multi-hour agentic loops, research-grade reasoning, or when you've measurably benchmarked Sonnet's shortfall on your specific task.
Q: Can Claude 4 generate images or video or handle video input?
A: No native generation. It can understand images, but for image or video generation, pair it with Imagen, Flux, or DALL-E. It does not process video input (image-only for multimodal tasks).
Q: How does Constitutional AI training make Claude 4 safer and more honest?
A: Constitutional AI trains Claude 4 against principles like "Be helpful, harmless, honest" rather than just maximizing human preference scores. This makes Claude 4 explicitly flag uncertainty instead of confabulating, lower false refusal rates on legitimate requests while still catching harmful ones, and more suitable for high-stakes applications like legal review or medical analysis.
The takeaway
Claude 4 represents a significant step forward in coding reliability and agentic reasoning. The three-tier family (Opus/Sonnet/Haiku) makes economical sense: you can scale cost to task difficulty without sacrificing capability. Extended thinking and tool-use-during-reasoning are powerful additions that make complex workflows more transparent and iterative.
For developers and enterprises, Claude 4's instruction-following reliability and coding excellence make it the default choice when OpenAI's ecosystem isn't already locked in. For agentic applications especially, Claude 4's tool consistency and long-context handling have become competitive advantages. The Sonnet/Opus split means you can prototype on Sonnet and escalate only to Opus when needed, keeping costs reasonable while maintaining flexibility.
Read next:
Follow new articles
Add SciHub101 to your feed reader to see new science and technology stories.
About the Author
SciHub101 is an independent science and technology publication founded and edited by Buğra Sözeri, a software engineer and app developer based in Türkiye. AI tools assist with drafting and research. Source documentation in the existing archive is uneven, and articles are being reviewed and corrected. The Editorial Team byline identifies editorial responsibility; it does not certify specialist or independent human review. Where we compare products, anything built by our own team is labelled as such — see the editorial guidelines and About page for how corrections and disclosures work.
Related Articles

What Is the Vercel AI SDK? LLM Toolkit
The Vercel AI SDK is a TypeScript toolkit for building LLM apps with React, Next.js, Svelte, and Vue. Unified API, streaming, tools, structured outputs.

What Is Replit Agent? Build Apps with AI
Replit Agent explained: build and deploy full-stack apps from a single prompt, how Agent 3 works, pricing, and how it compares to Bolt, v0, and Lovable.

How to Use Claude AI: Anthropic's Chatbot Explained, Features, Strengths, and Limitations
Claude is an AI chatbot built by Anthropic and available on Claude.ai, through the API, and via third-party integrations. It excels at long-form writing, coding, analysis of complex documents, and reasoning through multi-step problems. Unlike ChatGPT, Claude does not train on conversations, offers higher context limits, and produces more thorough outputs. This guide explains what Claude is, how to access it, what it does better than competitors, its actual limitations, and how to prompt it effectively.

How to Write AI Prompts That Actually Work
The quality of an AI model's output is determined largely by the quality of the input it receives. A prompt is not a search query — it is the only communication channel between the user and the model. Every word specifies or leaves ambiguous something about the desired output. This guide covers the principles behind effective prompting, the techniques with the most research evidence behind them, and the common mistakes that produce frustrating, generic results.

How Large Language Models Actually Reason — Inside ChatGPT, Claude, and Gemini (2026)
Do LLMs actually reason or just predict text? A deep technical guide to transformer attention, chain-of-thought, test-time compute, and frontier model benchmarks in 2026.

What Is GPT-5? OpenAI's Latest Model
GPT-5 explained: OpenAI's unified model with auto-routing, three sizes, benchmarks vs Claude 4, Gemini 2.5 and Grok 4, pricing, and what changed.