AI Video APIAI Video API


Gemini 3 Pro

Google Gemini 3 Pro — flagship multimodal model exposed via the OpenAI-compatible /v1/chat/completions endpoint. Supports text, image, video, audio, and PDF input with Google Search grounding, function calling, and structured JSON output.

Model

Model NameContext WindowReasoning
gemini-3-pro1M tokensYes (enabled by default)

Pricing

Per-token billing:

TypeCredits / 1M tokensPrice / 1M tokens
Input160 credits$0.80
Output960 credits$4.80

Endpoint

POST https://api.aivideoapi.ai/v1/chat/completions

OpenAI Chat Completions–compatible. Use the openai SDK directly with baseURL set to https://api.aivideoapi.ai/v1.

Create Chat Completion

curl -X POST https://api.aivideoapi.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3-pro",
    "messages": [
      { "role": "user", "content": "Explain relativity in simple terms" }
    ]
  }'

Request Body

FieldTypeRequiredDescription
modelstringYesMust be gemini-3-pro
messagesarrayYesConversation messages
streambooleanNoEnable streaming (default: true)
toolsarrayNoTool definitions (googleSearch or function)
include_thoughtsbooleanNoInclude reasoning thoughts (default: true)
reasoning_effortstringNolow or high (default: high)
response_formatobjectNoJSON Schema for structured output

Restrictions: tools and response_format are mutually exclusive. Google Search and function calling are also mutually exclusive.

Multimodal Messages

All media types (image / video / audio / PDF) share the same image_url structure:

{
  "role": "user",
  "content": [
    { "type": "text", "text": "What does this document say?" },
    { "type": "image_url", "image_url": { "url": "https://example.com/doc.pdf" } }
  ]
}

Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "gemini-3-pro",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Relativity has two parts..." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 12, "completion_tokens": 86, "total_tokens": 98 }
}

Examples

Google Search Grounding

curl -X POST https://api.aivideoapi.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3-pro",
    "messages": [
      { "role": "user", "content": "Bitcoin price today" }
    ],
    "tools": [{ "type": "function", "function": { "name": "googleSearch" } }]
  }'

Structured Output

curl -X POST https://api.aivideoapi.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3-pro",
    "messages": [
      { "role": "user", "content": "List 3 famous scientists" }
    ],
    "response_format": {
      "type": "json_schema",
      "json_schema": {
        "name": "scientists",
        "strict": true,
        "schema": {
          "type": "object",
          "properties": {
            "list": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": { "type": "string" },
                  "field": { "type": "string" }
                },
                "required": ["name", "field"]
              }
            }
          },
          "required": ["list"]
        }
      }
    }
  }'

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.