Skip to content
Sign in

Claude Sonnet 5

claude-sonnet-5

Sonnet 5 is Anthropic’s most powerful Sonnet-level model, with frontier performance in coding, agentic, and professional work. It supports adaptive thinking with selectable reasoning effort levels (low, medium, high, maximum, and ultra-high), a 1M token context window, and text, image, and file inputs. Sonnet 5 uses a newer tokenizer and includes real-time web protection measures that block certain high-risk dual-use activities.

Context window1.0M
ProviderClaude
Released2026/07/02

Playground

Pricing

The same model is available through multiple service channels — choose based on latency, reliability and cost.

Prices in $ / 1M tokens
To pick a channel, add a provider field to the request body, for example "provider": { "channel": "direct" }. Valid values are direct / stable / economical; omit it to use the default channel.

Direct

Direct upstream connection — best when you need native behavior and the full context window.

InputOutputCache readCache write
3.00/M15.00/M0.20/M3.75/M
20% off

Preferred

A balanced route optimized for availability and speed — a good default for production traffic.

InputOutputCache readCache write
3.002.40/M15.0012.00/M0.200.16/M3.753.00/M

Overview

Input
Text Image
Output
Text

Claude Sonnet 5 API: Cutting-Edge Coding and Agentic Capabilities at the Sonnet Tier

Claude Sonnet 5 is Anthropic's strongest Sonnet-tier model to date, pushing the Sonnet tier to near-Opus levels in coding, agents, and professional work. It comes with adaptive thinking enabled by default, supports five levels of reasoning Effort from low to max, a 1M token context window, and text, image, and file input.

For production workloads that need to balance quality, speed, and cost, Sonnet 5 is usually a more cost-effective choice than the flagship tier: it approaches Opus-level performance on most coding and agentic tasks, but with higher throughput and lower per-unit cost.

SeaWhale AI offers both the Anthropic-native Messages API and an OpenAI-compatible interface, so tool calling, thinking control, caching, and multimodal input are all directly available.

Get API Key · Model ID: claude-sonnet-5


Why Choose Claude Sonnet 5

  • Strongest performance at the Sonnet tier — coding and agentic capabilities are far ahead of Sonnet 4.6, approaching the Opus tier on most tasks
  • Adaptive thinking enabled by default — no need to manually configure a thinking budget; the model allocates reasoning depth based on task complexity
  • Five levels of reasoning Effortlow / medium / high / xhigh / max, giving precise control over intelligence and cost based on task difficulty
  • 1M token context — load extra-long codebases, research materials, and multi-turn agent traces in one go
  • High-resolution vision — up to 2576 pixels on the long edge, significantly improving comprehension of charts, documents, and UI screenshots

Core Capabilities

01 Coding and Long-Horizon Agents

The biggest improvements in Sonnet 5 over the previous generation are in coding and agentic tasks. It can understand cross-file dependencies, complete multi-file feature development, perform repository-level refactoring, and remain stable across long chains of tool calls.

  • Multi-file feature development and repository-level refactoring
  • Tool calling, result verification, and path adjustment
  • A more proactive self-verification loop than the previous generation

02 Adjustable Reasoning Effort and Adaptive Thinking

The model decides the depth of thinking based on the task; you only need to set an Effort level. Use medium for everyday tasks to save tokens, switch to xhigh for tough problems to get stronger reasoning, and drop to low for latency-sensitive scenarios.

  • Defaults to high, balancing quality and cost
  • xhigh is for the hardest coding and agentic tasks
  • Supports turning off thinking for the lowest latency

03 1M Token Long Context

Within the full 1M token window, instruction following, tool calling, and reasoning quality remain stable, making it suitable for large codebase analysis, long-document Q&A, and cross-session agent memory.

  • Processing of extra-long codebases and document collections
  • Up to 128K output tokens
  • Reliable tool calling even over long contexts

04 Vision and Document Understanding

Supports text, image, and file input; with high-resolution vision up to 2576 pixels on the long edge, chart transcription, UI replication, and PDF and technical drawing analysis are all more accurate.

  • Parsing of charts, tables, and technical drawings
  • UI screenshot understanding and frontend visual replication
  • Extraction from scanned and complex-layout documents

Best Use Cases

Scenario Description
Production-grade coding assistant High-throughput code completion, refactoring, and review at a lower cost than the flagship tier
Agentic workflows Multi-step tool calling, result verification, and autonomous execution
Long-document analysis Process research materials, contracts, and technical documents within a 1M token window
Multimodal tasks Chart reading, UI understanding, and information extraction from scanned documents
Customer service and conversational products Controllable latency at low Effort, with quality still significantly better than the previous generation
Batch processing pipelines Extraction, classification, and structured output at high concurrency

Claude Sonnet 5 vs. Claude Opus 4.8 and Sonnet 4.6

Capability Claude Sonnet 5 Claude Sonnet 4.6 Claude Opus 4.8
Model ID claude-sonnet-5 claude-sonnet-4-6 claude-opus-4-8
Positioning Best balance of speed and intelligence Balanced tier of the previous generation Flagship long-horizon agent
Context window 1M tokens 1M tokens 1M tokens
Max output 128K tokens 128K tokens 128K tokens
Thinking mode Adaptive, enabled by default Adaptive, requires explicit enabling Adaptive, requires explicit enabling
Effort levels low → max (including xhigh) low → max low → max
Vision resolution High resolution (2576px) Standard (1568px) High resolution (2576px)

For specific billing, refer to the real-time price card at the top of the page.


How to Use the Claude Sonnet 5 API

1. Create a SeaWhale AI API key Generate an API key in the console and top up your balance.

2. Choose your calling method Anthropic-native capabilities (thinking, cache_control, anthropic-beta) go through /v1/messages; projects that already use the OpenAI SDK can directly use /v1/chat/completions.

3. Make a request

curl -X POST https://api.seawhaleai.com/v1/messages \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 16000,
    "thinking": {"type": "adaptive"},
    "output_config": {"effort": "high"},
    "messages": [
      {"role": "user", "content": "梳理这个仓库的模块依赖,指出循环依赖并给出拆解方案。"}
    ]
  }'

FAQ

What's the difference between Claude Sonnet 5 and Sonnet 4.6? Coding and agentic capabilities have improved substantially, adaptive thinking is now enabled by default, a new xhigh Effort level has been added, and high-resolution vision is supported at the Sonnet tier for the first time.

When should I choose Opus instead of Sonnet 5? Choose the Opus tier when you need the longest-horizon autonomous execution, the deepest reasoning, or the highest one-shot delivery quality. For the vast majority of production coding, analysis, and agentic work, Sonnet 5 is sufficient and more cost-effective.

How should I set Effort? Default to high; use xhigh for the hardest coding and agentic tasks; use medium for cost-sensitive batch tasks; and use low for simple tasks such as classification and extraction.

How much context and output does it support? A 1M token context window, with up to 128K output tokens per request. For larger outputs, streaming is recommended.

Can I get the thinking content? The full thinking text is not returned by default. If you need to show the reasoning process to users, set thinking.display to summarized to get a summary.

What input modalities are supported? Text, images, and files. The visual long edge is up to 2576 pixels, and coordinates correspond one-to-one with pixels.


Why Choose SeaWhale AI for the Claude Sonnet 5 API

  • Dual interface access — choose between the native Messages API and the OpenAI-compatible interface, with extremely low migration cost
  • Full capability passthrough — thinking control, Effort, prompt caching, tool calling, and multimodal input are all available
  • Unified billing and usage — shared keys and billing with other models, so costs are transparent at a glance
  • Stable direct connection in China — no need to set up your own proxy; latency and availability are guaranteed by the platform.

API

API integration

Model IDUse this value as the model in inference requests
claude-sonnet-5
API KeyBearer token used to authenticate inference requests
Base URLOpenAI compatible · /chat/completions
OpenAIhttps://api.seawhaleai.com/v2/
provider OptionalSelects a service channel; omit it and the system picks the default
"provider": { "channel": "direct" }

claude-sonnet-5 usage examples

SeaWhale AI is compatible with the OpenAI API protocol, so you can call it with the OpenAI SDK or plain HTTP requests. Streaming is enabled by default.

About the provider parameter (optional, a SeaWhale AI extension): most models are served over several channels that differ slightly in price and reliability. Add a provider field to the request body to pick one; omit it and the system selects the default channel — normal calls are unaffected.

provider is not part of the official OpenAI protocol — it is a SeaWhale AI extension that only takes effect on this platform. The OpenAI SDK allows custom fields like this to pass through; see the examples below.

ValueChannelBest for
directDirectThe official upstream link, for native behavior and the full context window
stablePreferredBalanced availability and speed — a good default for production traffic
economicalEconomyCost first, well suited to batch processing and price-sensitive workloads

Available channels and their prices are listed under "Pricing" above (channels vary by model). Additional notes:

  • Syntax: "provider": { "channel": "direct" }.
  • If the requested channel is not enabled for that model, the request automatically falls back to the default channel and returns normally — it does not error.
  • With the official SDKs: in Python pass it via extra_body; in Node.js put it directly on the request object and it passes through. In TypeScript projects, add a // @ts-expect-error line to skip the type check.
js
curl https://api.seawhaleai.com/v2/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "model": "claude-sonnet-5",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello!"}
    ],
    "provider": { "channel": "direct" },
    "stream": true
  }'
# provider is optional — remove this line to use the default channel
js
from openai import OpenAI

client = OpenAI(
    base_url="https://api.seawhaleai.com/v2",
    api_key="<API_KEY>",
)

stream = client.chat.completions.create(
    model="claude-sonnet-5",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"},
    ],
    stream=True,
    # Optional: pick a service channel; omit to use the default
    extra_body={"provider": {"channel": "direct"}},
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
js
import OpenAI from 'openai'

const client = new OpenAI({
  baseURL: 'https://api.seawhaleai.com/v2',
  apiKey: '<API_KEY>',
})

const stream = await client.chat.completions.create({
  model: 'claude-sonnet-5',
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'Hello!' },
  ],
  stream: true,
  // Optional: pick a service channel; omit to use the default
  // @ts-expect-error provider is a SeaWhale AI extension, not in the OpenAI SDK types
  provider: { channel: 'direct' },
})

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? '')
}