Claude Sonnet 5.5 API

Claude Sonnet 5.5 balances speed and capability. It supports a 1M-token context window, 128K output, and adaptive thinking with high effort by default.

POST /v1/messages

claude-sonnet-5-5: Messages, required fields, nested response schema and a fictional example.

Basic request

Required parameters: model, max_tokens, messages

Available parameters: model, max_tokens, messages, system, stream

Request parameters

ParameterTypeRequiredDescription
modelstringYesExact model identifier shown on this page. Options: claude-sonnet-5-5
max_tokensintegerYesRequired output budget; the example is not the model maximum.
messagesarrayYesConversation messages; system instructions belong in system.
systemstringNoOptional system instructions.
streambooleanNoUse SSE events.
## Usage and response conventions - Follow required fields and the nested schema. Optional settings without a documented numeric default use the current model default. - Context, output budgets and media constraints differ by model. Unverified limits are not universal guarantees. - An absent value differs from a reported zero. Read status, content and usage as actually returned. - Replace example.invalid addresses with readable media you are authorized to use. - Save generated files promptly; result links need not remain available indefinitely. ### Conversations and streaming The basic example is non-streaming. Preserve the history required by this protocol. Match tool-call identifiers with their tool results before the next turn. Parse complete SSE events rather than network chunks, and inspect the final event or finish reason. ## Reference Terminology: [Anthropic Messages](https://platform.claude.com/docs/en/api/messages). Use this page's platform base URL and exact model identifier for requests. Reviewed: 2026-11-07. ## Complete nested field reference Array elements use []. Required flags apply only when the enclosing object or content-block variant is used. Response fields can be absent or null as described; false does not imply a fabricated zero. ### Request headers | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `Content-Type` | string | Yes | JSON request-body content type. | | `anthropic-version` | string | Yes | Messages protocol version: 2023-06-01. | ### Request body | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `model` | string | Yes | Exact model identifier shown on this page. Values: claude-sonnet-5-5 | | `max_tokens` | integer | Yes | Required output budget; the example is not the model maximum. Minimum: 1 | | `messages` | array[object] | Yes | Conversation messages; system instructions belong in system. | | `messages[].role` | string | Yes | Message role. Values: user, assistant | | `messages[].content` | string | Yes | Response blocks, including text, reasoning, or tool use. | | `system` | string | No | Optional system instructions. | | `stream` | boolean | No | Use SSE events. Default: false | ### Response 200 | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `id` | string | No | Opaque identifier returned by the API. | | `type` | string | No | Content-block type. | | `role` | string | No | Message role. | | `model` | string | No | Exact model identifier shown on this page. | | `content` | array[object] | No | Response blocks, including text, reasoning, or tool use. | | `content[].type` | string | No | Content-block type. | | `content[].text` | string | No | Text content. | | `content[].thinking` | string | No | Reasoning text when returned. | | `content[].id` | string | No | Opaque identifier returned by the API. | | `content[].name` | string | No | Tool name. | | `content[].input` | object | No | Tool argument object. | | `stop_reason` | string | No | Stop reason, such as end_turn, max_tokens, or tool_use. | | `stop_sequence` | string | No | Matched stop sequence; it may be null. | | `usage` | object | No | Reported usage; absent fields remain unknown. | | `usage.input_tokens` | integer | No | Input tokens. | | `usage.output_tokens` | integer | No | Output tokens. | | `usage.cache_read_input_tokens` | integer | No | Cache-read input tokens. | | `usage.cache_creation_input_tokens` | integer | No | Cache-creation input tokens. | ### Error response structure | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `error` | object | No | Error details for this request. | | `error.message` | string | No | Message content or a readable error explanation, according to its enclosing object. | | `error.type` | string | No | Content-block type. | | `error.code` | string | No | Error code; it may be empty. |

Request example

curl --request POST https://api.router.ai/v1/messages \
  --header "Authorization: Bearer $API_KEY" \
  --header "Content-Type: application/json" \
  --header "anthropic-version: 2023-06-01" \
  --data-raw '{
  "model": "claude-sonnet-5-5",
  "max_tokens": 256,
  "messages": [
    {
      "role": "user",
      "content": "Describe a fictional blue paper boat in one sentence."
    }
  ],
  "stream": false
}'

Endpoint reference: Create a message (Claude native)