nano-banana-2 or nano-banana-pro. Image generation runs asynchronously: submit a task, poll its status, and retrieve the generated image from images[].url once it succeeds.| Model | Use Cases |
|---|---|
nano-banana-2 | General-purpose text-to-image, reference-guided generation, and fast image output. |
nano-banana-pro | High-resolution images, product photography, complex instructions, and scenes requiring crisp text or fine detail. |
GET /v1/models for the authoritative list.gemini-3.0-pro-image and gemini-3.1-flash-image also work with this async endpoint, sharing the exact request fields and limits of nano-banana-pro and nano-banana-2, respectively. Alternatively, use Gemini Native Sync Image Generation.nano-banana-2.1, use Gemini Native Sync Image Generation (POST /v1beta/models/nano-banana-2.1:generateContent)./v1/chat/completions. Selecting them in a chat client will fail.| Model | Input | Capability | Asset Requirements |
|---|---|---|---|
nano-banana-2 | Omit image_urls | Text-to-image | Prompt only. |
nano-banana-2 | Provide image_urls | Reference-guided generation | 1–5 public direct image URLs, applied in array order. |
nano-banana-pro | Omit image_urls | Text-to-image | Prompt only. |
nano-banana-pro | Provide image_urls | Reference-guided generation | 1–14 public direct image URLs, applied in array order. |
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | nano-banana-2 or nano-banana-pro (also accepts gemini-3.1-flash-image or gemini-3.0-pro-image). |
prompt | string | Yes | — | Image generation or editing instructions. Specify subject, scene, composition, material, lighting, and color for best results. |
image_urls | string[] | No | — | Direct HTTPS URLs to reference images. Up to 5 images for nano-banana-2; up to 14 images for nano-banana-pro. Omit this field when not using reference images. |
aspect_ratio | string | No | 9:16 | nano-banana-2 supports 1:1, 16:9, 9:16, 4:3, 3:4, auto. nano-banana-pro supports 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, auto. Both models output 9:16 portrait when omitted or set to auto. Expresses a composition preference and does not guarantee strict adherence to the selected ratio. |
image_size | string | No | 1K | 1K, 2K, or 4K (uppercase K required). Defaults to 1K for both output resolution and billing when omitted. |
n | integer | No | 1 | Only 1 is currently supported; omitting this field is recommended. |
messages, temperature, top_p, or stream.{
"images": [],
"progress": "10%",
"status": "SUBMITTED",
"task_id": "task_xxxxxxxxxxxxxxxxxxxxxxxx"
}task_id. A successful creation response only indicates that the task has entered processing, not that the image has been generated.| Status | Action |
|---|---|
SUBMITTED | Task submitted; continue polling. |
IN_PROGRESS | Generating image; continue polling. |
SUCCESS | Completed; read images[].url. |
FAILURE | Failed; read fail_reason. |
SUCCESS or FAILURE. progress may not appear in every response—clients must not rely on it to detect terminal states.{
"task_id": "task_xxxxxxxxxxxxxxxxxxxxxxxx",
"status": "SUCCESS",
"progress": "100%",
"images": [
{
"index": 0,
"url": "https://example.com/result.png",
"mime_type": "image/png"
}
]
}| Field | Description |
|---|---|
images[].index | Zero-based image index. |
images[].url | Image download URL. |
images[].mime_type | Image MIME type; some storage backends may return application/octet-stream. |
fail_reason | Failure reason, present only when status is FAILURE. Raw diagnostic error text—do not parse against a fixed format. |
usage; clients should not depend on them.image_urls accepts up to 5 images for nano-banana-2 and up to 14 images for nano-banana-pro. Omit image_urls when not using reference images—do not pass an empty array.image_size only accepts 1K, 2K, or 4K. Lowercase k and other size values are not part of the public API contract.aspect_ratio only accepts the values listed in the parameter table; unsupported ratios return a parameter error. Omitting aspect_ratio or passing auto generates a 9:16 portrait image.aspect_ratio expresses a composition preference and does not guarantee strict adherence to the selected ratio. If your workflow requires an exact aspect ratio, validate and crop the image after generation.n must be 1.400 invalid request parameters, 401 missing or invalid API key, 403 insufficient balance/quota or missing model permission, 404 task not found, 429 rate limit exceeded, 503 service temporarily unavailable, 500 / 502 transient server error.