Claude Sonnet 4.6
Anthropic Claude Sonnet 4.6 — balanced model offering speed and intelligence. Native /v1/messages protocol with streaming, tool use, and optional extended thinking.
Model
| Model Name | Context Window | Reasoning |
|---|---|---|
claude-sonnet-4-6 | 200K tokens | Yes (optional thinkingFlag) |
Pricing
Per-token billing:
| Type | Credits / 1M tokens | Price / 1M tokens |
|---|---|---|
| Input | 300 credits | $1.50 |
| Output | 1500 credits | $7.50 |
Endpoint
POST https://api.aivideoapi.ai/v1/messages
Compatible with the Anthropic Messages API. You can use @anthropic-ai/sdk directly by setting baseURL to https://api.aivideoapi.ai/v1.
Create Message
curl -X POST https://api.aivideoapi.ai/v1/messages \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [
{ "role": "user", "content": "Write a haiku about autumn" }
],
"stream": false
}'
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Must be claude-sonnet-4-6 |
messages | array | Yes | Conversation messages |
stream | boolean | No | Enable streaming (default: true) |
tools | array | No | Callable tools |
thinkingFlag | boolean | No | Enable extended thinking |
Response (Non-Streaming)
{
"role": "assistant",
"type": "message",
"id": "msg_01ABC...",
"model": "claude-sonnet-4-6",
"stop_reason": "end_turn",
"content": [
{ "type": "text", "text": "Crisp leaves twirl down\nMorning frost paints golden boughs\nSilent autumn breathes" }
],
"usage": { "input_tokens": 18, "output_tokens": 42 },
"credits_consumed": 0.06
}
Field reference matches Claude Opus 4.6 docs. credits_consumed reflects the credits actually charged on this platform, computed at this model's rate (input 300 / output 1500 credits per 1M tokens).
Response (Streaming)
See the Claude Opus 4.6 docs for the full SSE event format (event names are identical).
Examples
Multi-Turn Conversation
curl -X POST https://api.aivideoapi.ai/v1/messages \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [
{ "role": "user", "content": "Recommend a sci-fi novel" },
{ "role": "assistant", "content": "I recommend The Three-Body Problem." },
{ "role": "user", "content": "Why?" }
]
}'
Function Calling
curl -X POST https://api.aivideoapi.ai/v1/messages \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [
{ "role": "user", "content": "Check status of order 12345" }
],
"tools": [
{
"name": "get_order_status",
"description": "Look up an order by ID",
"input_schema": {
"type": "object",
"properties": {
"order_id": { "type": "string" }
},
"required": ["order_id"]
}
}
]
}'
Error Codes
When a request fails, the API returns a JSON error response:
{
"error": {
"code": "insufficient_credits",
"message": "Your credit balance is too low. Please top up.",
"type": "billing_error"
}
}
Error Reference
| HTTP Status | Code | Type | Description |
|---|---|---|---|
| 400 | invalid_request | invalid_request_error | Missing or invalid parameters |
| 401 | invalid_api_key | authentication_error | API key is invalid, disabled, or deleted |
| 402 | insufficient_credits | billing_error | Credit balance too low, please top up |
| 403 | ip_not_allowed | permission_error | Request IP not in the key's allowlist |
| 404 | model_not_found | invalid_request_error | Model does not exist or is inactive |
| 404 | task_not_found | invalid_request_error | Task ID does not exist |
| 429 | rate_limit_exceeded | rate_limit_error | Too many requests, please slow down |
| 429 | spend_limit_exceeded | billing_error | Key spend limit reached (hourly/daily/total) |
| 500 | internal_error | api_error | Unexpected server error |
| 503 | upstream_error | upstream_error | Upstream AI provider returned an error |
Common Scenarios
invalid_request (400)
Returned when required fields are missing or invalid.
{
"error": {
"code": "invalid_request",
"message": "'model' is required.",
"type": "invalid_request_error"
}
}
insufficient_credits (402)
Your balance is too low. Check your balance with GET /v1/credits and top up in Dashboard > Billing.
invalid_api_key (401)
Possible causes:
- The key does not start with
sk- - The key has been disabled or deleted
- The user account has been banned
upstream_error (503)
The upstream AI provider returned an error. This may happen when:
- The input contains sensitive or prohibited content
- The provider is temporarily unavailable
- The request parameters are not supported by the provider
Credits are automatically refunded when a task fails due to upstream errors.