Gemini image models — API quickstart
Check GET /openai/v1/models with your key before integrating. These are distinct catalog identities; do not assume the preview and non-preview names are aliases or that another model has the same size support.
| Model | imageSize | aspectRatio |
|---|---|---|
google/gemini-nano-banana-2.1 | 1K, 2K, 4K | 16:9, 1:1, 1:4, 1:8, 21:9, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16 |
google/gemini-3-pro-image | 1K, 2K, 4K | 16:9, 1:1, 21:9, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16 |
google/gemini-3.1-flash-image | 512, 1K, 2K, 4K | 16:9, 1:1, 1:4, 1:8, 21:9, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16 |
google/gemini-3.1-flash-lite-image | 1K | 16:9, 1:1, 1:4, 1:8, 21:9, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16 |
google/gemini-3.1-flash-image-preview | 512, 1K, 2K, 4K | 16:9, 1:1, 1:4, 1:8, 21:9, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16 |
google/gemini-2.5-flash-image | 1K | 16:9, 1:1, 21:9, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16 |
This table lists explicit native ratio/tier combinations. Availability still depends on the model and request. Use :generateContent for JSON or :streamGenerateContent?alt=sse for native streamed delivery. The latter can buffer until the image completes and return one chunk; it does not promise progressive previews. OpenAI Images stream is a different, unsupported Gemini-image field.
OpenAI-compatible generation
curl https://api.quotaflow.ai/openai/v1/images/generations \
-H "Authorization: Bearer $QUOTAFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"google/gemini-3.1-flash-image-preview","prompt":"An editorial illustration of a harbor at sunrise.","image_config":{"aspect_ratio":"16:9","image_size":"2K"},"response_format":"b64_json"}'
Read data[].b64_json. Use image_config for model-specific aspect/size controls; a tier alone is square on this surface. Legacy size values remain accepted.
Gemini-native generation
curl "https://api.quotaflow.ai/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
-H "x-goog-api-key: $QUOTAFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":[{"role":"user","parts":[{"text":"An editorial illustration of a harbor at sunrise."}]}],"generationConfig":{"responseModalities":["IMAGE"],"imageConfig":{"aspectRatio":"16:9","imageSize":"2K"}}}'
Read image parts from candidates[].content.parts[].inlineData; do not assume the first part is the image. Native calls accept conversation turns with user/model roles, text and inline image parts, with thought signatures replayed intact. responseModalities can include IMAGE and optional TEXT; omission uses the model's text/image default. Use the model-specific imageConfig and candidateCount: 1. imageSize defaults to 1K when omitted. An omitted native aspectRatio leaves the ratio to the model; unlike a tier on OpenAI Images, it is not forced to 1:1. Unsupported combinations and fields return 400 INVALID_ARGUMENT.
Reference-image edits and billing
Use /openai/v1/images/edits with multipart image[] or JSON inline images[].image_url; on the native endpoint use inlineData. Limits: 1–14 images, 20 MB total, PNG/JPEG/WebP/HEIC/HEIF. Remote URLs, uploaded file_id, masks and OpenAI Images stream are not supported for Gemini images. OpenAI Images can request 1–4 outputs; the native endpoint accepts candidateCount: 1.
Output is Base64, not temporary URL mode. Usage can include validated input, text/thinking and image output counts, or supported estimates when an authoritative reading is absent; see the Images API for fields, errors and billing. Check your account terms for prices.
Native controls and streaming
Native generationConfig also carries thinkingConfig (thinkingLevel, includeThoughts, thinkingBudget) and supported sampling/output controls (temperature, topP, topK, seed, maxOutputTokens, stopSequences, presencePenalty, frequencyPenalty, mediaResolution). systemInstruction and safetySettings are accepted in their native formats. Parameter values remain model-specific. tools.googleSearch grounding, including web/image search types, is available only when the selected model has the corresponding search pricing; custom function tools and cachedContent are not this image contract.
For native SSE, use the same body at :streamGenerateContent?alt=sse; without alt=sse, the streamed wire is an array of chunks. Preserve returned thinking/signatures and image content for follow-up edits. For a steps-based stream or a polymorphic input, see Gemini image Interactions.