Native Gemini API
POST /v1beta/models/{model}:generateContent
Compatible with Google's native generateContent protocol, with Bearer auth. Both text and image generation use this endpoint — drop-in for existing Gemini code.
Request body (generateContent)
| Field | Type | Required | Description | |
|---|---|---|---|---|
contents | object[] | Required | Conversation contents, each {role, parts:[{text\ | inline_data}]} |
systemInstruction | object | Optional | System instruction | |
generationConfig | object | Optional | Generation params: temperature / maxOutputTokens / topP / topK … | |
safetySettings | object[] | Optional | Safety filter settings | |
| Field | Type | Required | Description | |
generationConfig.responseModalities | string[] | Required | Response modalities. Pass ["IMAGE"] for image generation; use ["TEXT","IMAGE"] to also return text | |
generationConfig.imageConfig | object | Required | Image generation config (aspectRatio + imageSize) | |
imageConfig.aspectRatio | string | Required | Aspect ratio: 1:1 / 3:2 / 2:3 / 4:3 / 3:4 / 5:4 / 4:5 / 16:9 / 9:16 / 21:9 | |
imageConfig.imageSize | string | Required | Image quality tier: 1K / 2K / 4K | |
parts[].inline_data | object | Optional | Image-to-image input: { mime_type, data(base64) } inside contents[].parts |
curl "https://us.gsnails.xyz/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{ "role": "user", "parts": [{ "text": "a neon fox, cinematic" }] }],
"generationConfig": {
"responseModalities": ["IMAGE"],
"imageConfig": { "aspectRatio": "16:9", "imageSize": "2K" }
}
}'
Supported models
Image-generation model below; text generation accepts standard Gemini models (e.g. gemini-3-pro-image-preview).
gemini-3.1-flash-image-preview
gemini-3-pro-image-preview