Claude Sonnet 4.6 Chat API
anthropic/claude-sonnet-4.6Claude Sonnet 4.6 Chat turns ordered text and image messages into code, explanations, and grounded analysis for coding assistants and tool workflows. Its 1M-token context keeps related files and instructions together, while system guidance and tool definitions shape each step.
Claude Sonnet 4.6
Anthropic · chat-completions
Quick start
Send a POST request to /v1/messages with anthropic/claude-sonnet-4.6. Choose JSON or SSE with stream, and receive generated content and usage.
- Endpoint
- POST /v1/messages
- Model ID
- anthropic/claude-sonnet-4.6
- Protocol
- Claude Messages
Request fields
| Field | Requirement | Description |
|---|---|---|
| model | Required | anthropic/claude-sonnet-4.6 |
| messages | Required | A non-empty ordered conversation array; each message has role and content. |
| max_tokens | Required | A positive integer setting the maximum output tokens for this response. |
| system | Optional | System instructions as a string or text blocks. |
| temperature | Optional | Sampling temperature; the playground allows 0–1. |
| top_p | Optional | Nucleus sampling probability; the playground allows 0–1 and defaults to 1. |
| cache_control | Optional | Places a prompt-cache marker on cacheable content. |
| tools | Optional | Defines tools available to the model. |
| tool_choice | Optional | Controls how the model selects a tool. |
| stop_sequences | Optional | Stops generation at a specified string. |
| stream | Optional | Returns an SSE event stream when true. |
Response and usage
Successful responses include generated content and usage. Billing settles from actual input, output, and cache tokens.
Streaming
Set stream: true to read SSE. Finalize usage accounting from the terminal usage event.
curl --request POST \
--url https://api.vidgo.ai/v1/messages \
--header "x-api-key: $VIDGO_API_KEY" \
--header 'anthropic-version: 2023-06-01' \
--header 'Content-Type: application/json' \
--data '{
"model": "anthropic/claude-sonnet-4.6",
"messages": [
{
"role": "user",
"content": "Explain why deterministic retries matter in distributed systems."
}
],
"max_tokens": 1024,
"temperature": 1,
"top_p": 1,
"stream": false
}'Keep API keys on the server. Never expose them in browser code or public repositories.
Continue with
Related Models
Claude Sonnet 4.6 Chat API frequently asked questions
What is the Claude Sonnet 4.6 Chat API?
Claude Sonnet 4.6 is an Anthropic model that turns text and image messages into code, explanations, and analysis. Its 1M-token context helps connect related materials, while system instructions and tools guide multi-step work. Use the Playground above or call Claude Messages and Chat Completions.
How does Claude Sonnet 4.6 help with coding workflows?
Provide requirements, relevant source files, and review feedback as ordered messages. Claude Sonnet 4.6 can draft code, explain changes, and use later turns to work through test findings.
How can Claude Sonnet 4.6 use application tools?
Include tool definitions with names and input schemas. Execute a requested tool in your application, then add its result to the conversation for the next step.
What context and output sizes does Claude Sonnet 4.6 have?
The published model specification is a 1M-token context window and a 128K-token maximum output. This page's Playground offers a 256–8,192-token output control.
How do I include an image in a Claude Sonnet 4.6 request?
Put an image block and the related text question in messages.content. The model uses both inputs to produce a text response.
What does Claude Sonnet 4.6 cost on Vidgo AI?
Input is $1.44 and 288 credits per 1M tokens; output is $7.20 and 1440 credits per 1M tokens. The Pricing section lists both rates.