gemini-3.1-flash-image, gemini-3.0-pro-image, or nano-banana-2.1 via the native Gemini generateContent endpoint. Requests block until image generation completes; clients extract the image directly from the synchronous response following the Client Extraction Order below—there is no async task ID and no polling.Model availability depends on the live response of GET /v1/modelsfor your API key. Do not submit generation requests for models that do not appear in that list.
None of the models on this page support OpenAI-compatible /v1/chat/completions. If you use an OpenAI-style client,gemini-3.1-flash-imageandgemini-3.0-pro-imagecan be called via the async image endpoint described in Calling via the Async Image Endpoint below.
{model} with a model ID available to your API key. Authenticate with your Brioi API key via Authorization: Bearer, the x-goog-api-key header, or the ?key= query parameter—the default x-goog-api-key header sent by official Gemini SDKs works directly.| Model | Positioning | imageSize | aspectRatio |
|---|---|---|---|
gemini-3.1-flash-image | Balanced speed and quality | 1K, 2K, 4K (required) | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 16:9, 9:16, 21:9 |
gemini-3.0-pro-image | Quality-first | 1K, 2K, 4K (required) | 1:1, 2:3, 3:2, 3:4, 4:3, 16:9, 9:16, 21:9 |
nano-banana-2.1 | Balanced speed and quality | 1K, 2K, 4K (optional; defaults to 1K when omitted) | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 16:9, 9:16, 21:9 |
aspectRatio can be omitted to let the model choose its default composition. Because aspectRatio expresses a composition preference, always read the actual pixel dimensions of the returned image. nano-banana-2.1 only supports the generateContent endpoint on this page and does not support the async image endpoint.| Field | Type | Required | Description |
|---|---|---|---|
contents | array | Yes | Conversation turns; must include at least one non-empty item. |
contents[].role | string | No | Recommended value for user prompts: user. |
contents[].parts | array | Yes | Text instructions and reference image parts. |
parts[].text | string | Conditional | Image generation or editing instructions. |
parts[].inlineData | object | No | Base64 reference image containing mimeType and data. |
parts[].fileData | object | No | Public URL reference image containing mimeType and fileUri. |
generationConfig.responseModalities | string[] | Yes | Must include IMAGE. |
generationConfig.imageConfig.imageSize | string | Yes | 1K, 2K, or 4K (uppercase K required). Optional for nano-banana-2.1 (defaults to 1K when omitted). |
generationConfig.imageConfig.aspectRatio | string | No | Aspect ratio supported by the target model. |
fileUri must be a publicly accessible direct HTTPS image URL—not a web page, preview page, or URL requiring login or cookies. mimeType must match the actual MIME type of the remote file.inlineData.data—do not include a data:image/...;base64, prefix.{
"contents": [{
"role": "user",
"parts": [
{"text": "Preserve the product structure and material, and replace the background with a clean white photo studio"},
{
"inlineData": {
"mimeType": "image/png",
"data": "BASE64_IMAGE_DATA"
}
}
]
}],
"generationConfig": {
"responseModalities": ["IMAGE"],
"imageConfig": {
"imageSize": "2K",
"aspectRatio": "1:1"
}
}
}parts may contain both text and images. Standard Gemini image output is located at inlineData.data and should be decoded according to inlineData.mimeType; remote image outputs follow the unified extraction order below.{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"inlineData": {
"mimeType": "image/jpeg",
"data": "BASE64_IMAGE_DATA"
}
}
]
},
"finishReason": "STOP"
}
]
}inlineData is omitted and the generated image is returned as a remote URL inside candidate.content.parts[] via one or both of the following forms:fileData.fileUri inside textfileData.fileUri and a Markdown image URL. Clients must deduplicate URLs rather than treating them as two separate images.{
"candidates": [{
"content": {
"role": "model",
"parts": [
{
"text": ""
},
{
"fileData": {
"mimeType": "image/png",
"fileUri": "https://cdn.example/generated.png"
}
}
]
},
"finishReason": "STOP"
}]
}inlineData.data first if present.fileData.fileUri.parts[].text.Standard Gemini SDKs typically recognize only inlineDataas image output. When handling compatible remote image outputs, callers must implement the extraction and download logic above.
gemini-3.0-pro-image and gemini-3.1-flash-image can also be invoked through the async image endpoints, suitable for clients built around OpenAI-style REST conventions:nano-banana-pro and nano-banana-2, respectively—see Nano Banana Image Generation: pass reference images via image_urls, set size tier and ratio via image_size (1K, 2K, 4K) and aspect_ratio, and set n to 1 only. Allowed aspect_ratio values follow the Nano Banana specification: on the async endpoint, gemini-3.1-flash-image supports only 1:1, 16:9, 9:16, 4:3, 3:4, auto (fewer than on this native endpoint), whereas gemini-3.0-pro-image supports 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, auto. Billing follows the image_size tier at the same pricing as the native endpoint; omitting image_size generates and bills at 1K, and omitting aspect_ratio generates a 9:16 portrait image./v1/chat/completions, nor synchronous /v1/images/generations or /v1/images/edits—use the async image endpoint above or generateContent on this page.generationConfig.responseModalities must include IMAGE.imageSize only accepts 1K, 2K, or 4K; lowercase k is not part of the public API contract.aspectRatio must be an enum value supported by the target model (see Supported Models).mimeType.X-Oneapi-Request-Id response header and error details first to avoid duplicate generations.400 invalid request parameters, 401 missing or invalid API key, 403 insufficient balance/quota or missing model permission, 429 rate limit exceeded, 503 service temporarily unavailable, 500 / 502 transient server error.