claude-sonnet-5 API
Build long-context chat, image-aware workflows, and tool-driven applications with claude-sonnet-5 on Openrouter API.
claude-sonnet-5claude-sonnet-5 API pricing
All prices in USD. Openrouter API rates compared with the official list price for the same unit.
| Token type | Openrouter API | Official | Save |
|---|---|---|---|
| Input per 1M tokens | $1.76 | $2.00 | −12% |
| Cached input per 1M tokens | $0.176 | $0.20 | −12% |
| Cache write (5 min) per 1M tokens | $2.20 | $2.50 | −12% |
| Cache write (1 hour) per 1M tokens | $3.52 | $4.00 | −12% |
| Output per 1M tokens | $8.80 | $10.00 | −12% |
What is claude-sonnet-5?
claude-sonnet-5 is an Anthropic chat model in the Claude Sonnet family, available through Openrouter API for conversational applications and workflows that need substantial input capacity. It accepts up to 1,000,000 input tokens and generates up to 128,000 output tokens. The documented Claude Messages interface supports text and image content, multi-turn conversations, tool use, and extended thinking. Developers can set system instructions, control generation length, and stream responses through Server-Sent Events.
Call claude-sonnet-5 using Openrouter API’s OpenAI-compatible base URL, https://openrouterapi.ru/v1, or use the native Anthropic-compatible Messages endpoint. Openrouter API provides one API key and pay-as-you-go billing, charging only for successful requests. Input costs $1.76 per 1M tokens and output costs $8.80 per 1M tokens. Prompt-cache reads and writes have separate rates, with 5-minute and 1-hour cache-write options. The default configuration is about 12% below the developer's list price.
claude-sonnet-5 highlights
Large Input Capacity
Provide up to 1,000,000 input tokens per request, with a maximum output of 128,000 tokens.
Text And Images
The Claude Messages interface supports multimodal content including text and images, alongside multi-turn conversations.
Tools And Thinking
Define tools and configure tool choice for application workflows. The Messages interface also exposes extended thinking through the thinking parameter.
Prompt Cache Support
The model supports prompt-cache reads and cache writes. Cache-write pricing includes 5-minute and 1-hour TTL options.
How to call the claude-sonnet-5 API in 4 steps
- 01
Get an API key
Sign in to Openrouter API, top up from $50, and create an sk-ora key in the console.
- 02
Set the base URL
Use https://openrouterapi.ru/v1 as the base URL in your SDK or HTTP client.
- 03
Send the request
Call POST /v1/chat/completions with "model": "claude-sonnet-5" and the parameters below.
- 04
Handle the response
Read the response (or stream tokens with stream: true). Usage and cost appear in your console.
Request examples
Documentation: Claude Messages APIcurl https://openrouterapi.ru/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTERAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain what an AI API gateway does in two sentences."}
],
"stream": false
}'Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Required | claude-sonnet-4-6 | Model name |
messages | array | Required | — | List of messages |
role | string | Required | user | Role type |
content | string | Required | — | Message content |
max_tokens | integer | Required | — | Maximum tokens to generate (**required**, same as Anthropic official) |
thinking | object | Optional | — | Extended thinking configuration |
system | string | array | Optional | — | System prompt |
temperature | number | Optional | — | Temperature parameter, range 0-1 |
top_p | number | Optional | — | Nucleus sampling parameter, range 0-1 |
top_k | integer | Optional | — | Top-K sampling |
stream | boolean | Optional | — | Enable streaming |
stop_sequences | array | Optional | — | Stop sequences |
metadata | object | Optional | — | Metadata |
tools | array | Optional | — | Tool definitions |
tool_choice | object | Optional | — | Tool choice strategy |
What you can build with claude-sonnet-5
Document review assistants
Build workflows that submit substantial source material and request summaries, comparisons, or answers grounded in the supplied documents.
Image-aware support
Let users submit images alongside text questions through the Claude Messages interface for conversational assistance.
Tool-connected applications
Define application tools for assistants that need to request external information or actions, with your application handling tool execution.
Shared-context workspaces
Use prompt caching for workflows that repeatedly reference the same instructions or source material across conversations.
Tips for better results
- 01
Set output budgets
Include max_tokens when using the Claude Messages endpoint; it is required. Choose a task-appropriate budget within the 128,000-token output maximum.
- 02
Plan cache lifetimes
Cache reads cost $0.176 per 1M tokens. Cache writes cost $2.20 per 1M tokens for a 5-minute TTL or $3.52 per 1M tokens for a 1-hour TTL; account for write costs when planning reuse.
- 03
Keep thinking signatures
Configure extended thinking with the thinking parameter rather than a platform-side alias. If you pass thinking blocks back in a multi-turn conversation, preserve their signature unchanged.
- 04
Match the API format
Use a separate system parameter for Claude Messages, rather than a system message in the messages array. Set stream explicitly and use either temperature or top_p, as recommended in the Messages documentation.
Limits and things to know
Maximum input is 1,000,000 tokens, and maximum output is 128,000 tokens.
The Claude Messages endpoint requires max_tokens; generation may stop before reaching that value.
Inference responses under /v1 follow the standard Anthropic Messages format (no extra wrapper).
claude-sonnet-5 API FAQ
How much does claude-sonnet-5 cost on Openrouter API?
Input costs $1.76 per 1M tokens, and output costs $8.80 per 1M tokens. The default configuration is about 12% below the developer's list price, with pay-as-you-go billing only for successful requests.
What are the prompt-caching prices?
Cached input reads cost $0.176 per 1M tokens. Cache writes cost $2.20 per 1M tokens with a 5-minute TTL or $3.52 per 1M tokens with a 1-hour TTL.
How do I call claude-sonnet-5 through Openrouter API?
Set model to claude-sonnet-5 and send POST /v1/chat/completions using the base URL https://openrouterapi.ru/v1 and Bearer authentication. For the native Anthropic-compatible format, use POST /v1/messages with either x-api-key or Bearer authentication.
Which controls does the Claude Messages endpoint support?
It supports system instructions, required max_tokens, thinking, temperature, top_p, top_k, streaming, stop sequences, tools, and tool_choice. Claude Messages uses a separate system parameter for system prompts.
What are the input and output limits?
claude-sonnet-5 supports a maximum input of 1,000,000 tokens and a maximum output of 128,000 tokens. The documented Claude Messages interface accepts text and image content.
Can I use claude-sonnet-5 commercially?
Commercial use is subject to the model developer's terms. Review the applicable Anthropic and Openrouter API terms before deploying your application.
Related models
claude-sonnet-4-5
claude-sonnet-4-5-20250929
claude-sonnet-4-5-20250929-thinking
claude-sonnet-4-6
claude-sonnet-4-6-thinking
claude-sonnet-5-5
claude-fable-5
claude-fable-5.1
Start building with claude-sonnet-5
One key, pay as you go from $50, billed only for successful requests.
