AI Video APIAI Video API


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 NameContext WindowReasoning
claude-sonnet-4-6200K tokensYes (optional thinkingFlag)

Pricing

Per-token billing:

TypeCredits / 1M tokensPrice / 1M tokens
Input300 credits$1.50
Output1500 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

FieldTypeRequiredDescription
modelstringYesMust be claude-sonnet-4-6
messagesarrayYesConversation messages
streambooleanNoEnable streaming (default: true)
toolsarrayNoCallable tools
thinkingFlagbooleanNoEnable 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 StatusCodeTypeDescription
400invalid_requestinvalid_request_errorMissing or invalid parameters
401invalid_api_keyauthentication_errorAPI key is invalid, disabled, or deleted
402insufficient_creditsbilling_errorCredit balance too low, please top up
403ip_not_allowedpermission_errorRequest IP not in the key's allowlist
404model_not_foundinvalid_request_errorModel does not exist or is inactive
404task_not_foundinvalid_request_errorTask ID does not exist
429rate_limit_exceededrate_limit_errorToo many requests, please slow down
429spend_limit_exceededbilling_errorKey spend limit reached (hourly/daily/total)
500internal_errorapi_errorUnexpected server error
503upstream_errorupstream_errorUpstream 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.