Gemini
Call Gemini models through Aiflow with the OpenAI-compatible endpoints.
Aiflow serves Gemini through Antigravity. You call it with the same
OpenAI-compatible API and sk-... key as every other model. Aiflow converts the
request to Gemini's format and converts the answer back, so you don't need a
Google SDK or a Google API key.
Models
| Model ID | Model |
|---|---|
ag/gemini-pro-agent | Gemini 3.1 Pro |
ag/gemini-3.6-flash-high | Gemini 3.6 Flash |
ag/gemini-3.7-flash-high | Gemini 3.7 Flash |
ag/gemini-3.8-flash-high | Gemini 3.8 Flash |
Every ag/ model appears in /v1/models. Older
antigravity-gemini-... IDs still work for existing clients.
Endpoints
Gemini models work on two endpoints:
| Method | Path |
|---|---|
POST | /v1/chat/completions |
POST | /v1/responses |
They are not available on /v1/messages, and Aiflow has no native Gemini
generateContent endpoint.
Chat Completions
curl https://api.tryaiflow.io/v1/chat/completions \
-H "Authorization: Bearer $AIFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ag/gemini-3.8-flash-high",
"messages": [
{ "role": "system", "content": "Answer in one sentence." },
{ "role": "user", "content": "What is a mutex?" }
]
}'Responses
curl https://api.tryaiflow.io/v1/responses \
-H "Authorization: Bearer $AIFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ag/gemini-pro-agent",
"instructions": "Answer in one sentence.",
"input": "What is a mutex?"
}'OpenAI SDK
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.AIFLOW_API_KEY,
baseURL: 'https://api.tryaiflow.io/v1',
});
const completion = await client.chat.completions.create({
model: 'ag/gemini-3.8-flash-high',
messages: [{ role: 'user', content: 'Reply with ok' }],
});
console.log(completion.choices[0].message.content);Supported input
| Feature | Chat Completions | Responses |
|---|---|---|
| Text | system, developer, user, assistant | instructions and input messages |
| Images | image_url as a base64 data URL | input_image as a base64 data URL |
| Function tools | tools with type: "function" | tools with type: "function" |
| Tool results | tool messages | function_call_output items |
| Output limit | max_tokens or max_completion_tokens | max_output_tokens |
| Temperature | temperature | Not forwarded |
Limits
- Function tools only. Built-in tools such as web search and file search are rejected.
- No
previous_response_id. Send the full conversation ininputon each request. - Buffered streaming.
stream: truereturns valid SSE, but the events arrive together after Gemini finishes the answer. Tokens are not streamed one by one. - Account-enabled keys only. A key that is limited to upstream routing gets
403. Contact support if you need Gemini access on your key.
Gemini usage counts against the same key budget as other models. Check it with the Usage API.