Docs
All model guides

Nano Banana 2

Google · Gemini 3.1 Flash Image

nano-banana-2-ext

Google’s fast image model for everyday generation and edits. Resolutions from 0.5K to 4K, including very wide poster ratios. Use Pro when the final layout needs more care.

Text-to-imageImage-to-imageImage editFast route
WorkbenchGenerate with Nano Banana 2
Sign in to generate · 2.5 Credits

Credits are reserved before generation and released automatically if it fails.

Output

Completed images appear here after a successful Credit debit.

API

Call Nano Banana 2

ImgRouter uses one request contract. Send this model ID to POST /v1/images/generations. Examples below match the recommended defaults on this page.

POST/v1/images/generations
cURL
curl https://api.imgrouter.com/v1/images/generations \
  -H "Authorization: Bearer $IMGROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: nano-banana-2-ext-generate-001" \
  -d '{
  "model": "nano-banana-2-ext",
  "prompt": "A cozy coffee shop interior with warm lighting, wooden tables, and plants by the window on a rainy afternoon.",
  "size": "16:9",
  "resolution": "2K",
  "n": 1
}'
Request body

Parameters and usage notes

These are the ImgRouter fields. Official upstream names such as image_urls are mapped from reference_images.

modelstring · requiredDefault and required: nano-banana-2-ext. Official aliases: nano-banana-2-ext, gemini-3.1-flash-image-preview, nano-banana-2.
promptstring · requiredText instruction, 1–5,000 characters. Describe the image or the edit you want.
sizestring · default 16:9Aspect ratio. Supported: auto, 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, 9:16, 5:4, 4:5, 21:9, 1:4, 4:1, 1:8, 8:1. Prefer an explicit ratio instead of auto when you need predictable framing.
resolutionstring · default 2KOutput tier. Supported: 0.5K, 1K, 2K, 4K. Higher tiers cost more Credits.
ninteger · 1–1Number of output images. Send a number, not a quoted string. Defaults to 1 and cannot exceed 1.
reference_imagesstring[] · max 14Public HTTPS image URLs for image-to-image or edit. Send this field to POST /v1/images/edits. Official docs may call this image_urls.

Model aliases

nano-banana-2-ext — ImgRouter route. Compatible with gemini-3.1-flash-image-preview.

gemini-3.1-flash-image-preview — Official standard name on the upstream docs.

nano-banana-2 — Official-channel alias. Not this ImgRouter route.

Official-only fields

These appear on the official docs page. ImgRouter does not accept them on the unified body.

nsfw_checkboolean · default falseUpstream-only. ImgRouter does not accept this field; keep moderation on your side if needed.
official_fallbackboolean · default falseUpstream-only official-channel fallback. Not accepted on ImgRouter requests.
google_searchboolean · default falseUpstream-only text search enhancement. Not accepted on ImgRouter requests.
google_image_searchboolean · default falseUpstream-only image search. Requires google_search on the official API; not accepted here.
image_urlsstring[]Official docs name for reference images. Use reference_images on ImgRouter instead.
Controls

Size, resolution, and output

Aspect ratio or size

auto1:13:22:34:33:416:99:165:44:521:91:44:11:88:1

Resolution

0.5K1K2K4K

Output format

url

Route notes

Supports generation and editing up to 4K with fourteen reference images.

Extreme banner and poster ratios are supported, including 1:8 and 8:1.

Use auto only when automatic framing is acceptable.

Reference workflow

Edit with reference images

Send public HTTPS source images with the same core controls. This route accepts up to 14 reference images.

POST/v1/images/edits
cURL
curl https://api.imgrouter.com/v1/images/edits \
  -H "Authorization: Bearer $IMGROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: nano-banana-2-ext-edit-001" \
  -d '{
  "model": "nano-banana-2-ext",
  "prompt": "Preserve the subject and composition. Change the scene to soft blue hour.",
  "size": "16:9",
  "resolution": "2K",
  "n": 1,
  "reference_images": [
    "https://example.com/reference.jpg"
  ]
}'
Response

Read the completed output

Successful requests return completed image URLs and a request ID. Store the assets you need permanently; routed output URLs may expire.

200 · JSON
{
  "id": "req_01K4…",
  "object": "image.generation",
  "created": 1787424152,
  "data": [
    { "url": "https://static.imgrouter.com/images/req_01K4.webp" }
  ],
  "usage": { "images": 1 }
}

Use GET /v1/requests/{request_id} for reconciliation and GET /v1/balance for the authenticated key's current Credit position.