AI & Agents

Claude Sonnet 4: Features, Benchmarks, and When to Use It

Claude Sonnet 4 delivers 72.7% accuracy on SWE-bench Verified at $3 per million input tokens, five times cheaper than Opus 4 with less than a 2-point accuracy gap on coding tasks. This guide covers benchmarks, the Sonnet-vs-Opus cost tradeoff, and practical deployment patterns from CI pipelines to Claude Cowork workflows.

Fast.io Editorial Team 10 min read
AI neural network visualization representing model architecture and intelligence layers

What Is Claude Sonnet 4?

Claude Sonnet 4 scored 72.7% on SWE-bench Verified at $3 per million input tokens, while Opus 4 cost five times more at $15 per million for less than two additional percentage points of coding accuracy (Anthropic, May 2025). That cost-to-performance ratio is why Sonnet became the default model for production API deployments within weeks of its launch.

Claude Sonnet 4 is Anthropic's mid-tier model in the Claude 4 family, released on May 22, 2025. It sits between the faster, cheaper Haiku and the more capable Opus, targeting developers and teams who need strong performance without flagship pricing. The model accepts text, images, and PDFs as input, supports tool calling and multi-step task execution, and runs a 200K token context window.

The Claude 4 family launched with three tiers: Haiku for high-throughput, low-cost work, Sonnet for the production sweet spot, and Opus for the hardest problems. Anthropic positioned Sonnet 4 as the model most developers should reach for first. The reasoning was straightforward: most real-world tasks do not require frontier-level capability, and the cost savings from using Sonnet compound quickly at production scale. A team making 10 million API calls per month saves $120,000 annually by defaulting to Sonnet over Opus on input costs alone.

The standout capability is extended thinking. Sonnet 4 can allocate up to 64,000 tokens of internal reasoning before producing its answer. During that reasoning process, it can call external tools, check intermediate results, and adjust its approach. For coding tasks, this means the model can read a function, identify the likely bug, test its hypothesis against surrounding code, and produce a fix in a single request.

Anthropic measured a 65% reduction in shortcut-taking behavior compared to Sonnet 3.7, the previous generation. When an agentic prompt says "check the tests, then update the implementation, then verify the tests pass again," Sonnet 4 follows those steps instead of jumping ahead to the implementation change. Whether you are running it through the API for automated code review or using it in Claude Cowork sessions for collaborative development, the cost-performance balance makes Sonnet 4 the starting point for most teams.

The model is available through the Anthropic API (model ID: claude-sonnet-4-20250514), Amazon Bedrock, Google Cloud Vertex AI, and Claude.ai. Free Claude.ai users can access Sonnet 4 with usage limits. API pricing is $3 per million input tokens and $15 per million output tokens, consistent with previous Sonnet-tier models.

Benchmark Breakdown: Where the Numbers Land

Benchmarks measure different slices of capability. Here is where Claude Sonnet 4 lands on the evaluations that matter most for developers and technical teams.

SWE-bench Verified measures whether a model can solve real software engineering problems pulled from open-source GitHub repositories. Sonnet 4 scores 72.7% in standard single-attempt configuration. With high-compute settings that run parallel attempts and rejection sampling, the score climbs to 80.2%. SWE-bench has the strongest correlation with real coding ability of any public benchmark, which is why Sonnet 4's score here carries more weight than its numbers on academic tests.

GPQA Diamond tests graduate-level science reasoning across physics, chemistry, and biology. Questions are designed to be solvable by domain experts but difficult for well-informed generalists. Sonnet 4 scores 70.0% without extended thinking enabled. Enabling extended thinking improves this score, particularly on multi-step physics problems where intermediate calculations benefit from the model's internal scratchpad.

MMLU spans 57 academic subjects from high school math to professional medicine and law. Sonnet 4 hits 85.4%, strong but unremarkable among 2025 frontier models. MMLU has become somewhat saturated as a differentiator; the gap between the top 10 models on this benchmark is narrow enough that it rarely drives model selection decisions.

MMMU evaluates multimodal understanding by requiring the model to reason about charts, diagrams, and images alongside text. Sonnet 4 scores 72.6%, reflecting solid visual reasoning that makes it practical for processing screenshots, architectural diagrams, and data visualizations.

AIME poses competition-level mathematics problems. Sonnet 4's 33.1% without extended thinking is its weakest benchmark score. Math competition problems reward sustained, creative reasoning that benefits most from extended thinking budgets. If math-heavy workloads are your primary use case, enabling extended thinking or stepping up to Opus is worth the additional cost.

All benchmark scores were measured without extended thinking by default. Enabling it with a sufficient token budget improves results across every category, with the largest gains on GPQA and AIME where step-by-step reasoning provides the most lift.

What benchmark gaps mean in practice is that Sonnet 4 handles roughly 7 out of 10 real software engineering problems correctly on its first attempt. Opus handles closer to 7.5 out of 10. The difference is almost invisible on a per-task basis but becomes measurable across thousands of tasks. The question is whether that incremental accuracy justifies a 5x cost increase, and for most teams the answer is no.

Real-world results back up the numbers. Block, the payments company, reported that Sonnet 4 was the first model to improve code quality during editing and debugging in their coding agent. That is not a synthetic benchmark. It is the kind of production validation that tells you a model works under real conditions with real codebases and real constraints.

AI analysis dashboard showing model performance metrics and audit data

Sonnet vs Opus: When the 5x Price Premium Is Worth It

The cost gap between Claude Sonnet 4 and Opus shapes how you should architect your AI pipeline. Sonnet 4 costs $3 per million input tokens and $15 per million output tokens. Opus 4.1, the original flagship, costs $15 per million input and $75 per million output. That is a flat 5x multiplier on every API call.

On SWE-bench Verified, the accuracy gap is surprisingly small. Sonnet 4 scores 72.7% while Opus 4.1 scores 74.5%, a difference of 1.8 percentage points. You are paying five times more for roughly 2.5% better coding accuracy.

Here is what the cost difference looks like at scale. A coding agent that processes 100 pull requests per day, with each review consuming an average of 2,000 input tokens and 1,500 output tokens, costs roughly $2.85 per day on Sonnet 4. The same workload on Opus 4.1 costs $14.25 per day. Over a year, that is the difference between $1,040 and $5,200 for a single agent. Multiply by the number of agents in your pipeline, and the gap becomes a line item that finance teams notice.

Opus earns its price on a specific category of tasks: problems with deep dependency chains, ambiguous requirements, and high consequences for errors. Refactoring a payment processing module where a subtle bug means lost revenue justifies the premium. Generating unit tests, writing documentation, or reviewing pull requests for common patterns does not.

A practical routing strategy is to default every API call to Sonnet and promote to Opus only when specific conditions are met. Route on estimated task complexity (context length and instruction depth), error sensitivity (reversible draft vs. production deployment), and whether the task involves multi-file coordination across a large codebase.

Research published at ICLR 2025 (the RouteLLM paper) demonstrated that intelligent model routing reduces API costs by over 85% while preserving 95% of the output quality from always using the flagship model. You do not need a sophisticated routing system to capture most of those savings. A simple heuristic based on prompt token count and task category gets you most of the way there.

The Sonnet 4 generation has evolved since May 2025. Sonnet 4.5 (September 2025) pushed SWE-bench to 77.2%, and Sonnet 4.6 (February 2026) expanded the context window to 1M tokens while matching Opus 4.5's performance on long-horizon coding tasks. Both updates maintain the original $3/$15 pricing. The newer Opus models (4.6 through 4.8) dropped to $5/$25 per million tokens while increasing capability, with Opus 4.8 now scoring 88.6% on SWE-bench. But the ratio still favors Sonnet for the majority of production work: the cost is lower, the speed is faster, and the accuracy gap is smaller than most teams expect.

Fastio features

Give Your Claude Agents a Persistent Workspace

Fast.io workspaces connect to Claude Sonnet 4 through MCP, giving your agents file storage, versioning, and semantic search without managing infrastructure. Start with a 14-day free trial.

Production Use Cases and Claude Cowork Workflows

Claude Sonnet 4 delivers the most value when it operates as a component in a larger system. These are the patterns that get the most from the model in production.

Coding agents and CI integration. Sonnet 4's SWE-bench score and reduced shortcut-taking make it a strong backbone for automated code review, test generation, and PR summary tools. Extended thinking handles multi-step reasoning without requiring the calling application to manage chain-of-thought prompting externally. Developers using Claude Code report that Sonnet handles the majority of daily coding tasks, with Opus reserved for complex refactoring and architectural decisions that span many files.

Document processing and structured extraction. The 200K context window accommodates most business documents in a single request. Teams processing contracts, invoices, research papers, or technical specifications use Sonnet 4 to pull structured data from unstructured sources. For workflows that span hundreds of files, Fast.io's Metadata Views lets you describe the fields you want extracted in natural language. AI designs a typed schema and populates a sortable, filterable spreadsheet across every file in the workspace, turning document stacks into queryable databases without writing extraction rules.

Multi-agent orchestration. The cost-efficient pattern for multi-agent systems is to assign Sonnet 4 to worker agents and reserve Opus for the orchestrator. Worker agents handle discrete tasks like research, drafting, and data validation. The orchestrator manages coordination, resolves conflicts between worker outputs, and produces final synthesis. This tiered architecture keeps per-task costs close to Sonnet pricing while capturing Opus quality on the planning layer where reasoning errors are most expensive.

Claude Cowork and collaborative development. In team environments where both AI agents and humans contribute to the same project, the coordination layer matters as much as the model. Agents write intermediate results, humans review and redirect, and the next agent picks up from the latest state. Fast.io workspaces provide this coordination with MCP-native access. Claude Sonnet 4 agents connect through the Fast.io MCP server, which exposes a consolidated MCP toolset for file operations, workspace management, and AI-powered semantic search. When Intelligence Mode is enabled on a workspace, uploaded files are automatically indexed for RAG. Agents can ask questions about existing documents and receive answers with citations, without managing a separate vector database.

For teams building Claude-powered applications, persistent workspaces solve the context window problem without prompt engineering workarounds. Instead of threading all relevant information through a single expanding prompt, agents write results to the workspace and retrieve specific files when needed in a later step. This keeps each request within the context window while preserving continuity across a multi-step workflow.

Enterprise deployment. Finance teams use Sonnet 4 for compliance document review and risk scoring. Research organizations use it for literature synthesis, pulling key findings from dozens of papers into structured summaries. Operations teams build automation pipelines that handle routine categorization, extraction, and routing at volumes where the $3/$15 pricing makes per-task costs measured in fractions of a cent.

The most effective architectures combine tiers. Use Sonnet as the default, promote to Opus for tasks that exceed a complexity threshold, and drop to Haiku for trivial classification and routing. Implementation can be as simple as a prompt length check: if the system prompt plus context exceeds a threshold, route to Opus. This keeps average cost close to Sonnet pricing while reaching for Opus quality on the tasks where it matters.

AI agent collaborating with team members through a shared workspace interface

Setting Up Claude Sonnet 4 in Your API Pipeline

Getting started with Claude Sonnet 4 takes an Anthropic API key and a few lines of code. Here is the practical setup, along with cost optimization techniques that make a real difference at scale.

The original Claude Sonnet 4 model ID is claude-sonnet-4-20250514. For the latest Sonnet with a 1M context window and adaptive thinking, use claude-sonnet-4-6. Both cost the same $3/$15 per million tokens.

A basic API call:

import anthropic

client = anthropic.Anthropic()

response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=4096,
    messages=[
        {"role": "user", "content": "Review this function for bugs."}
    ]
)

To enable extended thinking, add the thinking parameter with a token budget:

response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=16000,
    thinking={
        "type": "enabled",
        "budget_tokens": 10000
    },
    messages=[
        {"role": "user", "content": "Refactor this module for testability."}
    ]
)

The budget_tokens value controls how much internal reasoning the model performs before answering. Higher budgets improve accuracy on complex tasks but increase latency and cost, since thinking tokens bill as output tokens at $15 per million.

Two API features cut costs at scale:

Prompt caching stores reusable prompt prefixes on Anthropic's servers and charges cached input tokens at a reduced rate. For repetitive workflows like reviewing files across a repository where the system prompt and codebase context stay constant, caching saves up to 90% on input costs.

Batch API processes requests asynchronously at a 50% discount on both input and output tokens. Nightly code audits, bulk document extraction, and test generation pipelines that do not need real-time responses run at an effective rate of $1.50/$7.50 per million tokens through the batch endpoint.

The model is also available through Amazon Bedrock and Google Cloud Vertex AI with the same capabilities. Cloud provider pricing varies slightly, so check current rates on each platform before committing.

For agent workflows that need persistence across sessions, connecting Claude Sonnet 4 to workspace storage through MCP gives agents file-level memory without growing prompt sizes. The agent writes intermediate results to Fast.io or any MCP-compatible storage, then retrieves specific files in later steps. Full MCP tooling documentation is at mcp.fast.io/skill.md.

The trade-offs between Sonnet versions come down to what your application needs. The original Sonnet 4 has the broadest provider support and the longest track record in production. Sonnet 4.5 improved benchmark scores and added new training data through July 2025. Sonnet 4.6 brought the 1M token context window and adaptive thinking, which lets you control reasoning effort per request rather than setting a fixed thinking budget. For new projects, start with claude-sonnet-4-6 unless you need to match an existing deployment that was validated on an earlier version.

Frequently Asked Questions

What is Claude Sonnet 4?

Claude Sonnet 4 is Anthropic's mid-tier model in the Claude 4 family, released May 22, 2025. It scores 72.7% on SWE-bench Verified, supports extended thinking with up to 64,000 reasoning tokens, and costs $3 per million input tokens and $15 per million output tokens. The model accepts text, images, and PDFs, supports tool use during extended thinking, and is available through the Anthropic API with model ID claude-sonnet-4-20250514.

How does Claude Sonnet 4 compare to Opus 4?

Sonnet 4 costs one-fifth of what Opus 4 charges ($3/$15 vs $15/$75 per million tokens) with a small accuracy gap. On SWE-bench Verified, Sonnet scores 72.7% compared to Opus 4.1's 74.5%, a difference of less than 2 percentage points. Opus is worth the premium for complex multi-file refactors and high-stakes tasks where errors cascade. For code reviews, test generation, and standard development work, Sonnet delivers comparable results at 80% lower cost.

Is Claude Sonnet 4 good for coding?

Yes. Claude Sonnet 4's 72.7% on SWE-bench Verified was state-of-the-art at launch. The model solves real software engineering problems from open-source GitHub repositories, not synthetic puzzles. Block reported that Sonnet 4 was the first model to improve code quality during editing and debugging in their coding agent. Extended thinking lets the model reason through multi-step coding problems in a single request, and the 65% reduction in shortcut-taking compared to Sonnet 3.7 means it follows complex build-test-verify instructions more reliably.

How much does Claude Sonnet 4 cost?

Claude Sonnet 4 costs $3 per million input tokens and $15 per million output tokens through the Anthropic API. Prompt caching reduces input costs by up to 90% for repetitive workflows, and the Batch API offers a 50% discount on both input and output for asynchronous processing. With batch pricing, effective rates drop to $1.50 input and $7.50 output per million tokens. Extended thinking tokens bill as output tokens at the $15 rate.

What is Claude Sonnet 4's context window?

The original Claude Sonnet 4 (claude-sonnet-4-20250514) has a 200K token context window, roughly 150,000 words. The latest version, Claude Sonnet 4.6, expands this to 1M tokens at the same $3/$15 pricing. Extended thinking allocates up to 64,000 additional tokens for internal reasoning, separate from the context window.

What is the latest version of Claude Sonnet?

Claude Sonnet 4.6 (model ID: claude-sonnet-4-6), released February 2026, is the current Sonnet. It features a 1M token context window, adaptive thinking with variable effort settings, and improved benchmark scores. It maintains the same $3/$15 per million token pricing as the original Sonnet 4 and matches the performance of Opus 4.5 on long-horizon coding evaluations while running faster.

Related Resources

Fastio features

Give Your Claude Agents a Persistent Workspace

Fast.io workspaces connect to Claude Sonnet 4 through MCP, giving your agents file storage, versioning, and semantic search without managing infrastructure. Start with a 14-day free trial.