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 Name | Context Window | Reasoning |
|---|---|---|
gemini-3-flash | 1M tokens | Yes (thinkingConfig) |
Pricing
Per-token billing:
| Type | Credits / 1M tokens | Price / 1M tokens |
|---|---|---|
| Input | 120 credits | $0.60 |
| Output | 240 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
| Field | Type | Required | Description |
|---|---|---|---|
contents | array | Yes | Conversation content array |
tools | array | No | Tool definitions (googleSearch or functionDeclarations) |
generationConfig | object | No | Generation 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:
googleSearchandfunctionDeclarationscannot 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 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.