API429 / API reference

Chat Completions: text models

POST /v1/chat/completions on API429: available text models, request fields, SSE streaming, Gemini video input and code examples.

Reference version 3.31.0 · revised · the same text in the client portal

Available Models

Model Status Input $/1M tokens Output $/1M tokens Capabilities
gemini-3.8-flash Stable $0.75 $3.75 chat, vision/multimodal input, thinking, JSON/schema, URL context, countTokens
gemini-2.5-flash-lite Stable $0.10 $0.40 chat
gemini-2.5-flash Stable $0.30 $2.50 chat, search
gemini-3.5-flash-lite Stable $0.30 $2.50 chat, streaming, multimodal input, thinking, tools, JSON/schema
gemini-3-flash Preview $0.50 $3.00 chat, streaming, vision (image input), thinking, search
gemini-3.1-flash-lite Stable $0.25 $1.50 chat
gemini-3.1-pro-preview Preview $2.00 $12.00 chat, thinking, search, vision

Gemini 3.8 Flash is GA. The exact public ID is gemini-3.8-flash; do not append -non-thinking, -low, -medium, -high, or another effort suffix. It has a 1,048,576-token input window and a 65,536-token output limit. Select low, medium, or high with thinking_level or reasoning_effort; the default is medium. In Chat/Responses, tools are not supported by API429's adapter for this model. Unsupported Responses tools (including web_search_preview, web_search, and file_search) return HTTP 400; they are never silently treated as text-only requests. Use native Gemini for supported function declarations and URL context.

Gemini 3.8 pricing window. The table shows the promotion through 2026-12-31. Cached input is $0.075/1M, and the $3.75 output rate includes thought tokens. On 2027-01-01 all three rates double to $1.50 input, $0.15 cached input, and $7.50 output; pricing must be updated before then.

Gemini 3.8 request controls. Custom temperature, top_p, top_k, and n / native candidateCount are not supported. Omit them rather than relying on a provider default. frequency_penalty and presence_penalty remain valid.

Gemini 3.8 tool turns. The OpenAI-compatible route rejects tools, tool_choice, assistant tool_calls, and role:"tool" messages for this model. Use the native Gemini route when function calling is required. Native requests support client-executed functionDeclarations and urlContext. Search, Maps, File Search, computer use, and code execution are not part of the current API429 contract for this model.

Gemini 3.8 turn validation. generateContent and OpenAI-compatible chat requests must end with a user turn containing non-whitespace text; assistant or model prefill is rejected. Native FunctionResponse objects must include both a call identifier (call_id or REST id) and name. countTokens accepts chat history independently and counts the supplied system instruction and function declarations as well as message contents.

gemini-3.8-flash is the latest stable Flash model published by API429. The public catalog does not list gemini-3.7-flash or gemini-2.5-pro. For an existing integration, check the exact ID with your key on GET /v1/models.

Gemini 3 Flash. gemini-3-flash works on POST /v1/chat/completions with ordinary or streaming responses and accepts images as image_url content parts (HTTPS URL or data URI). Choose the thinking depth with reasoning_effort (or thinking_level): minimal, low, medium or high. Thinking tokens are billed as output.

For gemini-3.1-pro-preview, the public rates change above 200,000 input tokens. Current rate.

Model aliases (shorthand):

  • gemini-3.1-pro → gemini-3.1-pro-preview
  • Published Flash IDs for new clients: gemini-3-flash and gemini-3.1-flash-lite. Older integrations may use the spellings gemini-3-flash-preview or gemini-3.1-flash-lite-preview; check availability with the same API key.

Fixed reasoning-effort variants. These IDs pin the reasoning budget at request time instead of letting the model choose. They are billed at their base model's rate — the suffix changes latency and depth, not price.

Model Billed as Input $/1M Output $/1M Notes
gemini-3.1-pro-low gemini-3.1-pro-preview $2.00 $12.00 Pro quality with a reduced reasoning budget

Higher-effort variants (-high, -medium) are not currently offered: they do not resolve on our upstream. Request gemini-3.8-flash or gemini-3.1-pro-preview for full reasoning, or pass thinking_level on the base model.

Model suffixes (append to any compatible model):

  • -search — Enable grounded web search (e.g. gemini-3.1-pro-search)
  • -non-thinking — Disable reasoning/thinking mode (e.g. gemini-3.1-pro-non-thinking)
  • -image-generation — Enable inline image output on image-capable models

gemini-3.8-flash is canonical-only in API429 and rejects all of these model-ID suffixes. Use thinking_level or reasoning_effort to select a supported thinking level on this model.

Gemini Live API (advanced)

gemini-3.1-flash-live-preview is a streaming bidirectional audio model served over Google's Live API (bidiGenerateContent). It is not reachable via /v1/chat/completions — clients need to use the native Gemini Live protocol. Contact your administrator if you need Live API access.

Endpoint

POST /v1/chat/completions

Request Body

Field Type Required Default Description
model string No gemini-2.5-flash-lite Model ID from the table above
messages array Yes — Array of message objects
temperature float No 0.7 Creativity (0.0–2.0); unsupported by Gemini 3.8/3.7
max_tokens integer No — Max output tokens
stream boolean No false Enable streaming
top_p float No 0.9 Nucleus sampling; unsupported by Gemini 3.8/3.7
stop string/array No — Stop sequences
tools array No — Function calling tools where the selected model supports the OpenAI-compatible tool adapter; for Gemini 3.8/3.7 use native generateContent
tool_choice string No — auto, none, required; unavailable for Gemini 3.8/3.7 on the OpenAI-compatible route
response_format object No — {"type": "json_object"} or {"type": "json_schema", ...} for JSON mode
parallel_tool_calls boolean No true Allow the model to emit multiple tool calls at once
reasoning_effort string No medium Reasoning depth. GPT-5.6 accepts none, low, medium, high, xhigh, or max (see below).
n integer No 1 Number of completions; values other than 1 are unsupported by Gemini 3.8/3.7

Feature coverage by model family:

Feature Gemini Claude GPT
Function calling (non-stream & stream) ✅ except Gemini 3.8/3.7 on the OpenAI-compatible route ✅ ✅
role:"tool" follow-up (multi-turn) ✅ except Gemini 3.8/3.7 on the OpenAI-compatible route ✅ ✅
tool_choice (auto / required / specific) ✅ except Gemini 3.8/3.7 on the OpenAI-compatible route ✅ ✅
Parallel tool calls ✅ except Gemini 3.8/3.7 on the OpenAI-compatible route ⚠️ (serialised) ✅
JSON mode / JSON schema (response_format) Model/route dependent Route dependent; Claude Web non-strict only, without schema guarantee Model/route dependent
Stop sequences ✅ ✅ ⚠️ (dropped on some GPT models)
Vision (image_url / base64) ✅ ✅ ✅
Video input for text analysis ✅ token-gated Gemini chat only — —
Extended reasoning ✅ via reasoning_effort or -non-thinking suffix ✅ auto on thinking-enabled models ✅ via reasoning_effort or -high / -low model suffix

Notes on reasoning:

For gemini-3.8-flash, tool turns are supported only through the native Gemini generateContent route. The OpenAI-compatible route rejects tools, tool_choice, and role:"tool" instead of dropping Google's required function-call IDs or thought signatures.

  • The reasoning_effort field (low / medium / high) maps to each model's native reasoning budget. On Claude thinking-enabled models temperature must be absent — the gateway strips it automatically.
  • Compatible Gemini models additionally honour a -non-thinking suffix on the model id to disable reasoning entirely. gemini-3.8-flash is excluded: its canonical ID accepts only low, medium, or high thinking levels.
  • GPT reasoning models accept suffixes like -high, -low on the model id as shorthand for reasoning_effort.

Message object (pseudocode: choose one role value):

{
  "role": "system" | "user" | "assistant",
  "content": "text content"
}

For multimodal requests, content may be an array of content parts:

{
  "role": "user",
  "content": [
    {"type": "text", "text": "Describe this video in one paragraph."},
    {
      "type": "input_video",
      "input_video": {
        "format": "mp4",
        "data": "BASE64_VIDEO_BYTES"
      }
    }
  ]
}

Gemini Video Input for Chat

Use this when you want a Gemini text model to analyze an existing video and return text. This is different from the async Video Generation Models section, which creates new videos.

POST /v1/chat/completions

Supported on token-enabled Gemini text models whose IDs match gemini-*, for example gemini-2.5-flash, gemini-3.8-flash and preview Gemini text models when they are visible in GET /v1/models for your token.

Supported client formats:

  • API429 OpenAI-compatible chat extension: content[] item with type: "video_url" and video_url.url.
  • API429 OpenAI-compatible chat extension: content[] item with type: "input_video" and base64 input_video.data.
  • Gemini native: contents[].parts[].fileData.fileUri with mimeType: "video/mp4" or another supported video MIME type.

The client keeps the same OpenAI-compatible request envelope, base URL, and API key flow. Video input is an API429-supported extension inside that envelope; the API validates video input. Malformed video parts return 400 with a specific validation message.

Supported OpenAI-compatible video input parts:

Part type Shape Notes
input_video {"type":"input_video","input_video":{"format":"mp4","data":"<base64>"}} Best for SDK integrations that already have local video bytes.
video_url {"type":"video_url","video_url":{"url":"https://.../clip.mp4","mime_type":"video/mp4"}} URL must be a direct public HTTP(S) file. Redirects are not followed.

Supported formats: mp4, mov, avi, webm.

Current limits:

  • Maximum original client video size: 150 MiB, subject to route-specific limits.
  • Maximum video parts on this OpenAI-compatible endpoint: 1.
  • Large videos may be prepared or compressed; if preparation requires multiple parts, the request is rejected instead of silently dropping video content.
  • For the compatible gemini-3.8-flash inline-video route, original videos up to 30 MB (30,000,000 bytes) are sent directly as inline media. The serialized model request, including text, tools and encoded video, must fit within 42 MB (42,000,000 bytes); otherwise the gateway returns 413. These are gateway safeguards, not Google's limits.
  • Larger files are rejected for this model. Other video models have their own limits.
  • Inline video processing is limited to concurrent request limits through completion or stream closure. When busy, it returns 429 with Retry-After: 5; use bounded retry with backoff. Existing account/rate limits apply.
  • Adapter tests verified approximately 30 MB / 30 seconds with audio and a 5-minute / 15.7 MB video with audio in streaming mode. These synthetic tests are not an arbitrary-duration, audio-quality or latency guarantee; some direct transport tests required more than two minutes.

Other behavior:

  • stream:false and stream:true are both supported.
  • The response is text. Use /v1/videos/generations for video output.
  • These changes cover OpenAI-compatible input_video and video_url inputs; they do not rewrite client-supplied Gemini native fileData references.
  • Full base64 video bodies are redacted from durable request logs.

Python (OpenAI SDK, local video)

import base64
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.api429.com/v1",
    api_key="YOUR_API_KEY",
)

with open("clip.mp4", "rb") as f:
    video_b64 = base64.b64encode(f.read()).decode("ascii")

response = client.chat.completions.create(
    model="gemini-2.5-flash",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Describe what happens in this video."},
            {
                "type": "input_video",
                "input_video": {
                    "format": "mp4",
                    "data": video_b64,
                },
            },
        ],
    }],
    max_tokens=300,
)

print(response.choices[0].message.content)

cURL (direct video URL)

curl https://gateway.api429.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "Summarize this video in 5 bullets."},
        {
          "type": "video_url",
          "video_url": {
            "url": "https://example.com/videos/clip.mp4",
            "mime_type": "video/mp4"
          }
        }
      ]
    }],
    "max_tokens": 500
  }'

cURL (streaming)

curl https://gateway.api429.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash",
    "stream": true,
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "Describe this video in one sentence."},
        {
          "type": "input_video",
          "input_video": {
            "format": "mp4",
            "data": "BASE64_VIDEO_BYTES"
          }
        }
      ]
    }]
  }'

Examples

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.api429.com/v1",
    api_key="YOUR_API_KEY"
)

response = client.chat.completions.create(
    model="gemini-3.1-pro",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum computing in 3 sentences."}
    ],
    temperature=0.7,
    max_tokens=200
)
print(response.choices[0].message.content)

Python (Streaming)

stream = client.chat.completions.create(
    model="gemini-3.1-pro",
    messages=[{"role": "user", "content": "Write a poem about AI"}],
    stream=True
)

finished = False
for chunk in stream:
    if getattr(chunk, "error", None):
        raise RuntimeError("Streaming generation failed; preserve partial output")
    for choice in chunk.choices:  # Usage-only chunks can have no choices.
        if choice.delta.content:
            print(choice.delta.content, end="", flush=True)
        reason = choice.finish_reason
        if reason in {"error", "length", "content_filter"}:
            raise RuntimeError("Generation failed, was truncated, or was filtered")
        if reason in {"stop", "tool_calls"}:
            finished = True
if not finished:
    raise RuntimeError("Stream ended without a terminal completion")

Python (Gemini 3.8 Flash multimodal input)

response = client.chat.completions.create(
    model="gemini-3.8-flash",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Summarize the visual details in this image."},
            {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}},
        ],
    }],
    max_tokens=500,
)
print(response.choices[0].message.content)

Python (Gemini 3.8 Flash structured output)

response = client.chat.completions.create(
    model="gemini-3.8-flash",
    messages=[{"role": "user", "content": "Extract title, date and people from this text."}],
    response_format={"type": "json_object"},
)
print(response.choices[0].message.content)

Python (Function Calling)

response = client.chat.completions.create(
    model="gemini-3-flash",
    messages=[{"role": "user", "content": "What's the weather in Tokyo?"}],
    tools=[{
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get weather for a city",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {"type": "string", "description": "City name"}
                },
                "required": ["city"]
            }
        }
    }],
    tool_choice="auto"
)
# Append -search to enable grounded web search
response = client.chat.completions.create(
    model="gemini-3.1-pro-search",
    messages=[{"role": "user", "content": "What happened in tech news today?"}]
)

cURL

curl https://gateway.api429.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3-flash",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 100
  }'

cURL (Streaming)

curl https://gateway.api429.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3-flash",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

JavaScript / TypeScript

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://gateway.api429.com/v1",
  apiKey: "YOUR_API_KEY",
});

const response = await client.chat.completions.create({
  model: "gemini-3.1-pro",
  messages: [{ role: "user", content: "Hello!" }],
  max_tokens: 100,
});

console.log(response.choices[0].message.content);

Response Format

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1712345678,
  "model": "gemini-3.1-pro",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 8,
    "total_tokens": 20
  }
}

Streaming Response (SSE)

data: {"id":"chatcmpl-abc123","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}

data: {"id":"chatcmpl-abc123","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}

data: {"id":"chatcmpl-abc123","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}

data: {"id":"chatcmpl-abc123","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]

Quickstart: the first request · Models and prices · Get an API key

Telegram