Apply your own routing policies, reduce token costs automatically, and see every routing decision in real time with Merge Gateway.

How Claude Sonnet 5 performs*
What Claude Sonnet 5 costs to run
Test Claude Sonnet 5
with Gateway’s Simulator
See a prompt's output, token spend, latency, and more with Claude Sonnet 5.
Route requests to Claude Sonnet 5 in minutes
1$ pip install merge-gateway-sdk1from merge_gateway import MergeGateway
2
3client = MergeGateway(api_key="YOUR_API_KEY")
4
5response = client.responses.create(
6 model="openai/gpt-5.2",
7 input=[
8 {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
9 {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
10 ],
11)
12
13print(response.output[0].content[0].text)1response = client.responses.create(
2 model="anthropic/claude-sonnet-4-20250514",
3 input=[
4 {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5 {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6 ],
7)1from openai import OpenAI
2
3client = OpenAI(
4 api_key="YOUR_API_KEY",
5 base_url="https://api-gateway.merge.dev/v1/openai",
6)1response = client.chat.completions.create(
2 model="gpt-5.2",
3 messages=[
4 {"role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5 {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6 ],
7)
8
9print(response.choices[0].message.content)1npm install merge-gateway-ai-sdk-provider ai1import { createMergeGateway } from "merge-gateway-ai-sdk-provider";
2
3const gateway = createMergeGateway({
4 apiKey: "YOUR_API_KEY",
5});1import { generateText } from "ai";
2
3const { text } = await generateText({
4 model: gateway("openai/gpt-4o"),
5 prompt: "Explain the concept of recursion in programming with a simple set of examples.",
6});
7
8console.log(text);1import { createOpenAI } from "@ai-sdk/openai";
2
3const gateway = createOpenAI({
4 apiKey: "YOUR_API_KEY",
5 baseURL: "https://api-gateway.merge.dev/v1/ai-sdk",
6});
7
8// All generateText/streamText calls work unchanged1from anthropic import Anthropic
2
3client = Anthropic(
4 api_key="YOUR_API_KEY",
5 base_url="https://api-gateway.merge.dev/v1/anthropic",
6)
7
8message = client.messages.create(
9 model="claude-sonnet-4-20250514",
10 max_tokens=1024,
11 messages=[
12 {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
13 ],
14)
15
16print(message.content[0].text)Explore other models available in Merge Gateway
Claude Sonnet 5 FAQ
Heading
What other models does Anthropic offer?
Anthropic's Claude family is organized into Opus, Sonnet, and Haiku tiers that trade off quality, cost, and speed. Here are some other models Anthropic supports:
- Claude Opus 4.8: the flagship tier, with the highest reasoning and coding quality in the lineup for the most demanding work
- Claude Sonnet 4.6: the prior Sonnet release, offering near-Opus performance at Sonnet pricing
- Claude Opus 4.7: an earlier flagship generation for teams standardized on that version
- Claude 3.7 Sonnet: the first hybrid-reasoning Claude, still used where a stable, well-understood Sonnet is preferred
How does Claude Sonnet 5 differ from Anthropic's other models?
Claude Sonnet 5 is Anthropic's newest mid-tier model, positioned as a cheaper way to run agents while closing much of the quality gap to Opus.
- Agentic focus: Anthropic's most agentic Sonnet to date, with stronger planning, browser and terminal tool use, and autonomous task execution than Claude Sonnet 4.6
- Context window: includes the full 1M-token context window at standard pricing
- Pricing: launched at introductory rates of $2 per 1M input and $10 per 1M output, rising to $3 per 1M input and $15 per 1M output after the introductory period, a steep discount to Claude Opus 4.8
- Positioning: shipped as Anthropic's default model, aimed at production agents that need Opus-adjacent quality at Sonnet economics
Claude Sonnet 5 is best for agentic and coding workloads at scale where you want near-flagship quality without paying flagship rates.
What models should I consider using alongside Claude Sonnet 5?
No single model is optimal for every task. Here are models worth pairing with Claude Sonnet 5 depending on what your product needs:
- Claude Opus 4.8 for the hardest reasoning or coding tasks where you want the absolute top of Anthropic's quality range
- Gemini 3.5 Flash for high-volume, low-complexity work like classification or extraction where Sonnet 5 is more than the task needs
- Gemini 3.1 Pro for multimodal reasoning over long documents or video, which the text-focused Claude tiers don't cover
- GPT-5.5 as a second high-quality general model for cross-provider redundancy and A/B comparison
- DeepSeek V4 Pro as an open-weight option to benchmark on cost for agentic coding
What are the challenges of using Claude Sonnet 5 in my product?
Like any production LLM, Claude Sonnet 5 comes with tradeoffs worth planning for:
- Introductory pricing: the lowest rates apply only during the introductory window, so model your budget against the higher standard rates that follow
- Provider dependency: routing all traffic to Anthropic is fragile if it has an outage or shifts a default model
- Cost at scale: agents that loop through many steps compound token costs quickly, so step limits and budgets matter even at Sonnet pricing
- Large-context cost: using the full 1M-token window on every call is expensive, so trim or retrieve context rather than sending everything
- Default-model drift: because Anthropic ships Sonnet 5 as its default, pin the exact model version in production so a future default change doesn't silently alter behavior
Why should I use Merge Gateway to route LLM requests with Claude Sonnet 5 and every other model?
Using Claude Sonnet 5 through Merge Gateway gives you access to the model itself and the infrastructure layer around it:
- One API, every provider: Reach Claude Sonnet 5 and every other major LLM through a single endpoint and API key, swapping the model string to change providers without touching application code
- Intelligent routing and automatic failover: Merge routes around Anthropic outages automatically, and cost, latency, or quality policies can reduce spend by 40 to 60% without code changes
- Cost governance: Set hard or soft project budgets so Claude Sonnet 5 spend stays in plan, with every request attributed to a model, project, and tag in one billing dashboard
- Build Your Own Router: Define what "best" means with curated benchmarks or your own eval scores, and the router scores each model against your weights and explains every pick
- Security and compliance controls: Apply DLP rules and prompt injection protection before requests reach Anthropic, and enforce per-project model and region policies outside your application
How can I start routing requests to Claude Sonnet 5 via Merge Gateway?
Getting Claude Sonnet 5 running through Merge Gateway takes a few minutes:
1. Create an account and get your API key from the dashboard.
2. Install the Merge Gateway SDK: run pip install merge-gateway-sdk (Python) or npm install merge-gateway-sdk (Node). Alternatively, if you're already using the OpenAI SDK, set base_url = "https://api-gateway.merge.dev/v1/openai" and your existing code works as-is.
3. Make your first request using the provider/model format. For Claude Sonnet 5, the model string is anthropic/claude-sonnet-5. Swap the model string to route to any other provider without changing anything else.
4. Configure a routing policy in the dashboard to set failover behavior, cost limits, and optimization strategy. Your first policy can be as simple as naming Claude Sonnet 5 as primary with one fallback.
Full setup instructions and SDK references are in the Merge Gateway docs.
Try Claude Sonnet 5 through Merge Gateway
Route, observe, and control AI requests across providers from one API.





