Skip to content
NewRouters/Documentation
LLM API

claude-sonnet-4-6 · API guide

Integrate claude-sonnet-4-6 through claude. Request examples, parameters, authentication and result handling.

POST/v1/messagesMODELclaude-sonnet-4-6
Official reference claude-sonnet-4-6Checked 2026-10-14Official docs
Code examples & responses
Request & responseExamples
POST/v1/messages
Server-side request
curl "https://newrouters.com/v1/messages" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  --data '{
  "model": "claude-sonnet-4-6",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Explain how an HTTP request works in three concise steps."
    }
  ],
  "stream": false
}'

The API origin is filled in. Set API_KEY before running. Examples never submit automatically.

ResponseSelected fields · illustrative values
200Successful result
JSON
{
  "content": [
    {
      "type": "text",
      "text": "..."
    }
  ],
  "stop_reason": "end_turn"
}
Integration flowAnthropic · Native protocol
  1. Prepare a request01
    API key + model ID

    Use the model’s native protocol and authentication.

    SDK / HTTP
  2. Call the native API02
    POST /v1/messages

    Submit the request structure documented on this page.

    Anthropic
  3. Read the response03
    content[]

    JSON returns a complete result; read SSE increments using native event formats.

    JSON / SSE

Use the exact API model ID claude-sonnet-4-6. This guide describes the platform contract; check the live catalog before calling the model.

An active catalog record means the model is configured; it does not guarantee an available channel. Before integration, check lifecycle, health.status and contract in GET /v1/public-model-catalog. Account pricing is shown in the dashboard. If supply is unavailable, wait for recovery or explicitly select another model. Do not repeatedly submit requests with an unknown outcome.

The platform origin is filled in at build time. Set API_KEY to your server-side key before running.

Terminal window
curl "https://newrouters.com/v1/messages" \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
-H "anthropic-version: 2023-06-01" \
--data '{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Explain how an HTTP request works in three concise steps."
}
],
"stream": false
}'

This model uses the claude protocol. Read its native response and usage fields; do not wrap the request in the media task input envelope.

Supported endpoint templates:

  • POST /v1/messages
  • POST /v1/messages/count_tokens
LimitCatalog value
Context tokens128000
Maximum output tokens64000

For streaming, use the native protocol streaming option and parse its events; check supported capabilities in the live catalog.

Checked: 2026-10-14 · Platform model: claude-sonnet-4-6 · Official reference: claude-sonnet-4-6

Check current availability, contract and account pricing before integration. Keep request IDs and usage receipts when diagnosing errors. Complete API reference