Chat
Gemini ProtocolComing Soon
Google Gemini generateContent compatible. Text capability implemented, in gray release, not yet open.
⏳ This model is not live yet. The doc below is a preview. It will be callable once released.
Endpoints
| Usage | Method | Path |
|---|---|---|
| Non-streaming | POST | /v1beta/models/{model}:generateContent |
| Streaming (SSE) | POST | /v1beta/models/{model}:streamGenerateContent |
Authentication
Authorization: Bearer <API_KEY> Content-Type: application/json
Supported Models
gemini-* (coming soon)
Request Parameters
| Param | Type | Required | Description |
|---|---|---|---|
| contents | array | Required | Conversation (role/parts) |
| systemInstruction | object | — | System instruction |
| generationConfig | object | — | temperature/topP/maxOutputTokens, etc. |
| tools | — | — | Tools / function calling |
Streaming (SSE)
Use the :streamGenerateContent endpoint for SSE streaming.
Request Example
Non-streaming
curl -X POST "https://api.cqtai.com/v1beta/models/gemini-1.5-pro:generateContent" \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role":"user","parts":[{"text":"你好,介绍一下你自己"}]}]
}'Image Generation
Image Generation (Nano · sync)NEW
Text chat is still in gray release, but synchronous image generation on the same native Gemini generateContent endpoint is already available: pass an image model with generationConfig.responseModalities including "IMAGE", and a single request returns the base64 image directly — no taskId, no polling. The public "Nano tier" is backed by these Gemini image models.
Endpoints
| Usage | Method | Path |
|---|---|---|
| Sync image generation | POST | /v1beta/models/{model}:generateContent |
Supported Models
gemini-2.5-flash-image (Nano, 10, 1K) / gemini-3-pro-image-preview (Nano Pro, 20, 1K/2K/4K) / gemini-3.1-flash-image-preview (Nano 2, 20, 1K/2K/4K).
Request Parameters
| Param | Type | Required | Description |
|---|---|---|---|
| {model} | path | Required | Model id in the URL path (tier mapping): gemini-2.5-flash-image (Nano, 10, 1K) / gemini-3-pro-image-preview (Nano Pro, 20, 1K/2K/4K) / gemini-3.1-flash-image-preview (Nano 2, 20, 1K/2K/4K) |
| contents | array | Required | Native Gemini contents: parts[] holds the text prompt; for image-to-image add an inlineData reference image (base64) |
| generationConfig | object | — | Generation config: responseModalities (incl. "IMAGE"), imageConfig.imageSize (1K/2K/4K), aspectRatio, etc. Fields follow the official Google spec |
Billing & Credits
Nano (gemini-2.5-flash-image) 10/img; Nano Pro (gemini-3-pro-image-preview) 20/img; Nano 2 (gemini-3.1-flash-image-preview) 20/img. This channel charges once per request (not x count).
Besides Authorization: Bearer <API_KEY>, x-goog-api-key is also accepted (your APIKey; either one, not both). Sync image generation is charged once per request, not x count.
Request Example
Text-to-image (sync)
curl -X POST "https://api.cqtai.com/v1beta/models/gemini-2.5-flash-image:generateContent" \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role":"user","parts":[{"text":"a cute cat on a windowsill, soft morning light"}]}],
"generationConfig": {
"responseModalities": ["TEXT","IMAGE"],
"imageConfig": {"imageSize": "1K", "aspectRatio": "1:1"}
}
}'Response Example
{
"candidates": [
{
"content": {
"parts": [
{ "inlineData": { "mimeType": "image/png", "data": "<base64 PNG,原样透传>" } }
]
},
"finishReason": "STOP"
}
]
}Billing & Credits
Billed per token: input × input price + output × output price (cache write ×1.25, cache read ×0.1), then × your rate. count_tokens is free. See the Intro page for model prices.