Claude Sonnet 4.6
claude-sonnet-4-6Use the Claude Sonnet 4 6 API for chat and coding. Send conversation messages and include tool definitions on supported routes. Use it to work through multi-step coding tasks or review longer technical material. Compare the available provider routes, request examples, and usage prices on OpenAny.
Auto route pricing
Route source: Anthropic
- Input / Output
- Input: $2.897Output: $14.483
- Cache read / write
- Cache read: $0.290Cache write: $3.621
- Context / Max output
- 1000K / 128K
- Live routes
- 1
Rates / 1M tokens
Image output: Price not supplied
These are separate usage rates, not a total request price.
On this page
Overview
Use the Claude Sonnet 4 6 API for chat and coding. Send conversation messages and include tool definitions on supported routes. Use it to work through multi-step coding tasks or review longer technical material. Compare the available provider routes, request examples, and usage prices on OpenAny.
Playground
Other parameters (11)
Result preview
Anthropic · 216ms
Response example. Run to see the actual response.
{
"id": "msg_bdrk_01Bg1KUdHeA2Nf2TMgxsQ2P2",
"model": "claude-sonnet-4-6",
"usage": {
"input_tokens": 0,
"total_tokens": 31,
"output_tokens": 0,
"prompt_tokens": 8,
"completion_tokens": 23,
"input_tokens_details": null,
"prompt_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0,
"cached_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0,
"reasoning_tokens": 0
},
"claude_cache_creation_1_h_tokens": 0,
"claude_cache_creation_5_m_tokens": 0
},
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How are you doing? Is there something I can help you with today? 😊"
},
"finish_reason": "stop"
}
],
"created": 1784810011,
"openmodels_cost": 380
}Agent handoff preview
Providers
| Provider | Pricing | Latency | Uptime | Supply | Route |
|---|---|---|---|---|---|
Live | Input $2.897 / 1M tokens Output $14.483 Cache read $0.290 Cache write $3.621 | 216ms | — | Verified |
- Input
- $2.897
- Output
- $14.483
- Cache read
- $0.290
- Cache write
- $3.621
Source: the selected provider route in OpenAny's public model catalog. A price update timestamp is not supplied.
API
- Base URL
https://api.openany.si/v1- POST
/v1/messages- Authentication
Authorization: Bearer $OPENANY_API_KEY
Request parameters
| Parameter | Type / range | Default value | Required | Description |
|---|---|---|---|---|
max_tokens | integer | — | Yes | Maximum number of tokens to generate. This is required by Anthropic and is a hard limit for total output, including thinking and visible response content. |
messages | array | — | Yes | messages |
model | string | — | Yes | model |
metadata | object | — | No | Metadata object. Can include user_id to identify the end user for abuse monitoring and tracing. Example: {"user_id":"user-123"}. |
stop_sequences | array | — | No | Custom stop sequences. Supports up to 4 strings. Generation stops when any sequence is produced, and the stop sequence is not included in the output. |
stream | boolean | false | No | Whether to enable Server-Sent Events streaming output. |
system | string | array | — | No | system |
temperature | number · 0 ~ 1 | 1 | No | Sampling temperature from 0.0 to 1.0. Higher values make output more random; lower values make output more deterministic. Prefer changing only one of temperature, top_p, or top_k. |
thinking | object | — | No | Extended thinking configuration for supported models. |
tool_choice | object | {"type":"auto"} | No | Controls tool use behavior. Use {"type":"auto"}, {"type":"any"}, or {"type":"tool","name":"tool_name"}. |
tools | array | — | No | Tools available to the model. Each tool should define name, description, and input_schema. |
top_k | integer | — | No | Sample only from the top K most likely tokens. Prefer changing only one of temperature, top_p, or top_k. |
top_p | number · 0 ~ 1 | — | No | Nucleus sampling threshold from 0.0 to 1.0. Prefer changing only one of temperature, top_p, or top_k. |
Request example
curl 'https://api.openany.si/v1/messages' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"max_tokens": 1024,
"messages": [
{
"content": "hello",
"role": "user"
}
],
"model": "claude-sonnet-4-6",
"stream": false,
"temperature": 1,
"tool_choice": {
"type": "auto"
}
}'Response example
Configured response example · not a live result
{
"id": "msg_bdrk_01Bg1KUdHeA2Nf2TMgxsQ2P2",
"model": "claude-sonnet-4-6",
"usage": {
"input_tokens": 0,
"total_tokens": 31,
"output_tokens": 0,
"prompt_tokens": 8,
"completion_tokens": 23,
"input_tokens_details": null,
"prompt_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0,
"cached_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0,
"reasoning_tokens": 0
},
"claude_cache_creation_1_h_tokens": 0,
"claude_cache_creation_5_m_tokens": 0
},
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How are you doing? Is there something I can help you with today? 😊"
},
"finish_reason": "stop"
}
],
"created": 1784810011,
"openmodels_cost": 380
}Error handling
400Check the model ID and request fields.429Retry with exponential backoff.5xxRetry only temporary provider failures.JSON Schema
{
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"max_tokens",
"messages",
"model"
],
"properties": {
"model": {
"type": "string"
},
"tools": {
"type": "array",
"items": {
"type": "object"
},
"description": "Tools available to the model. Each tool should define name, description, and input_schema."
},
"top_k": {
"type": "integer",
"description": "Sample only from the top K most likely tokens. Prefer changing only one of temperature, top_p, or top_k."
},
"top_p": {
"type": "number",
"maximum": 1,
"minimum": 0,
"description": "Nucleus sampling threshold from 0.0 to 1.0. Prefer changing only one of temperature, top_p, or top_k."
},
"stream": {
"type": "boolean",
"default": false,
"description": "Whether to enable Server-Sent Events streaming output."
},
"system": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"text"
],
"properties": {
"text": {
"type": "string"
},
"type": {
"const": "text"
}
}
}
}
]
},
"messages": {
"type": "array",
"items": {
"type": "object",
"required": [
"role",
"content"
],
"properties": {
"role": {
"enum": [
"user",
"assistant"
],
"type": "string",
"description": "Message role. The Messages API does not support a system role inside messages; use the top-level system parameter instead."
},
"content": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string"
}
}
}
}
],
"description": "Message content. Can be a string or an array of typed content blocks such as text, image, tool_result, or document blocks."
}
}
}
},
"metadata": {
"type": "object",
"properties": {
"user_id": {
"type": "string",
"description": "End-user identifier used for abuse monitoring and tracing."
}
},
"description": "Metadata object. Can include user_id to identify the end user for abuse monitoring and tracing. Example: {\"user_id\":\"user-123\"}."
},
"thinking": {
"type": "object",
"properties": {
"type": {
"enum": [
"adaptive",
"enabled"
],
"type": "string",
"description": "Thinking mode type. adaptive is recommended and lets the model decide when and how deeply to think. enabled is supported by older models and usually requires budget_tokens."
},
"budget_tokens": {
"type": "integer",
"description": "Token budget for extended thinking. Used with older enabled thinking mode when supported by the model."
}
},
"description": "Extended thinking configuration for supported models."
},
"max_tokens": {
"type": "integer",
"description": "Maximum number of tokens to generate. This is required by Anthropic and is a hard limit for total output, including thinking and visible response content."
},
"temperature": {
"type": "number",
"default": 1,
"maximum": 1,
"minimum": 0,
"description": "Sampling temperature from 0.0 to 1.0. Higher values make output more random; lower values make output more deterministic. Prefer changing only one of temperature, top_p, or top_k."
},
"tool_choice": {
"type": "object",
"default": {
"type": "auto"
},
"description": "Controls tool use behavior. Use {\"type\":\"auto\"}, {\"type\":\"any\"}, or {\"type\":\"tool\",\"name\":\"tool_name\"}."
},
"stop_sequences": {
"type": "array",
"items": {
"type": "string"
},
"description": "Custom stop sequences. Supports up to 4 strings. Generation stops when any sequence is produced, and the stop sequence is not included in the output."
}
}
}Examples
Request example
POST /v1/messagescurl 'https://api.openany.si/v1/messages' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"max_tokens": 1024,
"messages": [
{
"content": "hello",
"role": "user"
}
],
"model": "claude-sonnet-4-6",
"stream": false,
"temperature": 1,
"tool_choice": {
"type": "auto"
}
}'