AI Video APIAI Video API


Gemini 3 Flash

Google Gemini 3 Flash — fast multimodal model. Native Gemini protocol (not OpenAI-compatible). Supports text, image, audio, video, and document input with thinking levels (thinkingLevel), Google Search grounding, and function calling.

Model

Model NameContext WindowReasoning
gemini-3-flash1M tokensYes (thinkingConfig)

Pricing

Per-token billing:

TypeCredits / 1M tokensPrice / 1M tokens
Input120 credits$0.60
Output240 credits$1.20

Endpoints

POST https://api.aivideoapi.ai/v1/gemini/v1beta/models/gemini-3-flash:streamGenerateContent
POST https://api.aivideoapi.ai/v1/gemini/v1beta/models/gemini-3-flash:generateContent

The URL suffix selects streaming behavior: streamGenerateContent returns SSE chunks, generateContent returns one response. Compatible with the Google GenAI SDK by setting baseUrl to https://api.aivideoapi.ai/v1/gemini.

Create Message

curl -X POST "https://api.aivideoapi.ai/v1/gemini/v1beta/models/gemini-3-flash:streamGenerateContent" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      { "role": "user", "parts": [{ "text": "What is the weather in Beijing today?" }] }
    ]
  }'

Request Body

FieldTypeRequiredDescription
contentsarrayYesConversation content array
toolsarrayNoTool definitions (googleSearch or functionDeclarations)
generationConfigobjectNoGeneration config including thinkingConfig

Contents

Each message has a role (user or model) and a parts array:

{
  "role": "user",
  "parts": [
    { "text": "What is in this image?" },
    { "inline_data": { "mime_type": "image/jpeg", "data": "<base64...>" } }
  ]
}

thinkingConfig

{
  "generationConfig": {
    "thinkingConfig": {
      "includeThoughts": true,
      "thinkingLevel": "high"
    }
  }
}

thinkingLevel: low or high.

Response

{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [{ "text": "It is sunny in Beijing today..." }]
      },
      "finishReason": "STOP"
    }
  ],
  "modelVersion": "gemini-3-flash",
  "usageMetadata": {
    "promptTokenCount": 12,
    "candidatesTokenCount": 18,
    "thoughtsTokenCount": 55,
    "totalTokenCount": 85
  }
}

Examples

Google Search Grounding

curl -X POST "https://api.aivideoapi.ai/v1/gemini/v1beta/models/gemini-3-flash:generateContent" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      { "role": "user", "parts": [{ "text": "Latest tech news today" }] }
    ],
    "tools": [{ "googleSearch": {} }]
  }'

Function Calling

curl -X POST "https://api.aivideoapi.ai/v1/gemini/v1beta/models/gemini-3-flash:generateContent" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      { "role": "user", "parts": [{ "text": "What is the weather in Beijing?" }] }
    ],
    "tools": [
      {
        "functionDeclarations": [
          {
            "name": "get_weather_forecast",
            "description": "Get weather forecast for a location",
            "parameters": {
              "type": "OBJECT",
              "properties": {
                "location": { "type": "STRING", "description": "City name" }
              },
              "required": ["location"]
            }
          }
        ]
      }
    ]
  }'

Restriction: googleSearch and functionDeclarations cannot be used together.


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.