Claude Opus 4.6
Anthropic Claude Opus 4.6 — flagship reasoning model. Native /v1/messages protocol with streaming, tool use, and optional extended thinking.
Model
| Model Name | Context Window | Reasoning |
|---|---|---|
claude-opus-4-6 | 200K tokens | Yes (optional thinkingFlag) |
Pricing
Per-token billing:
| Type | Credits / 1M tokens | Price / 1M tokens |
|---|---|---|
| Input | 500 credits | $2.50 |
| Output | 2500 credits | $12.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-opus-4-6",
"messages": [
{ "role": "user", "content": "Explain quantum computing in simple terms" }
],
"stream": false
}'
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Must be claude-opus-4-6 |
messages | array | Yes | Conversation messages |
stream | boolean | No | Enable streaming (default: true) |
tools | array | No | Callable tools, each with name/description/input_schema |
thinkingFlag | boolean | No | Enable extended thinking |
Messages
{
"role": "user",
"content": "Hello"
}
Or multimodal content blocks:
{
"role": "user",
"content": [
{ "type": "text", "text": "What is in this image?" },
{ "type": "image", "source": { "type": "url", "url": "https://example.com/photo.jpg" } }
]
}
Response (Non-Streaming)
{
"role": "assistant",
"type": "message",
"id": "msg_bbb32326-155e-4dec-aa49-9899e2cada52",
"model": "claude-opus-4-6",
"stop_reason": "end_turn",
"content": [
{ "type": "text", "text": "Quantum computing uses qubits..." }
],
"usage": {
"input_tokens": 20,
"output_tokens": 661
},
"credits_consumed": 1.66
}
| Field | Type | Description |
|---|---|---|
id | string | Unique message identifier |
type | string | Always message |
role | string | Always assistant |
model | string | Model that produced the response |
stop_reason | string | One of end_turn, max_tokens, stop_sequence, tool_use |
content | array | Response content blocks (text or tool_use) |
usage.input_tokens | int | Number of input tokens |
usage.output_tokens | int | Number of output tokens |
credits_consumed | number | Credits actually charged for this call (computed at this platform's rate, independent of upstream's internal value) |
Response (Streaming)
When stream: true, returns SSE events:
event: message_start
data: {"type":"message_start","message":{"id":"msg_...","usage":{"input_tokens":12,"output_tokens":1}}}
event: content_block_delta
data: {"type":"content_block_delta","delta":{"type":"text_delta","text":"Quantum"}}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":86}}
event: message_stop
data: {"type":"message_stop"}
Examples
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-opus-4-6",
"messages": [
{ "role": "user", "content": "What is the weather in Boston today?" }
],
"tools": [
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {
"location": { "type": "string", "description": "City and state, e.g. Boston, MA" }
},
"required": ["location"]
}
}
],
"stream": false
}'
Extended Thinking
curl -X POST https://api.aivideoapi.ai/v1/messages \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-6",
"messages": [
{ "role": "user", "content": "Prove there are infinitely many primes" }
],
"thinkingFlag": true
}'
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.