Skip to main content

Nano Banana 2

POST /v1/images/generations
Use nano-banana-2 for image generation and reference-image editing through one public OpenAI Images API style contract.

What This Page Covers

  • This page only covers nano-banana-2
  • The customer-facing entry point is POST /v1/images/generations
  • The input image field is image_input
  • The current public contract is limited to URL references in image_input; image and data: inputs are not exposed publicly
  • Gemini / Vertex and other providers may sit behind this route, but those provider details are not part of the customer contract

Capability Status

Capability / SpecStatusNotes
T2IBetaHistorical coverage exists, but the current public artifact bundle is still centered on edit/reference
I2I + 1KVerifiedThe single-image edit live path is closed
I2I + 2K + 16:9Verified2K + 16:9 has a live artifact
Reference + 1..14 refsVerified14 refs work and 15 refs are rejected by the current guard
Reference + 2KBeta14 refs and 2K are both validated independently, but the combined edge is not yet closed as one artifact
4K / JPEG / exact 30 MiB / official direct truthBetaStill not committed in the current public contract
The Pricing page and this doc use the same status language: Verified means there is a current minimal live artifact, while Beta means the official capability exists but the public validation set or edge coverage is still being completed.

Currently Validated Capabilities

The following results come from the local March 30, 2026 validation on localhost:4000 pinned to channel 315 (vetexjian):
  • single-reference editing works
  • 2 reference images work
  • 14 reference images work
  • 15 reference images are rejected
  • resolution: "1K" works
  • resolution: "2K" with aspect_ratio: "16:9" works
  • WEBP URL references were verified
  • PNG has at least one successful source, but source-to-source stability is still not fully closed
Do not present the following as fully promised customer-facing capability yet:
  • exact large-file URL limit
  • exact 30 MiB boundary
  • stable JPEG URL support
  • official direct Gemini truth
nano-banana-2 currently exposes only image_input URL input publicly. The image field is rejected by the service, and data: / Base64 is not part of the current public contract.

Request Parameters

ParameterTypeRequiredDescription
modelstringYesFixed as nano-banana-2
promptstringYesGeneration or edit instruction
image_inputstring or string[]NoReference image URL(s); currently 1 to 14
resolutionstringNo1K and 2K are live-validated; code also accepts 4K, but this pass does not promise it yet
aspect_ratiostringNo1:1 and 16:9 are live-validated; additional allowed values are listed below
nintegerNoNumber of images, default 1
response_formatstringNoRecommended to omit and consume data[].url directly

Currently Accepted aspect_ratio Values

1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9, auto

Multi-Image Limit

  • 1 to 14 references: current public range
  • 15+: rejected with at most 14 reference images are currently supported for nano-banana-2

Request Examples

Single-Image Edit

curl -X POST https://crazyrouter.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "nano-banana-2",
    "prompt": "Turn this product photo into a clean white-background ecommerce hero shot while preserving the subject",
    "image_input": [
      "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/fpakfo/image36.webp"
    ],
    "resolution": "1K",
    "aspect_ratio": "1:1"
  }'

Multi-Reference Input

{
  "model": "nano-banana-2",
  "prompt": "Blend the subject and composition from these references into one new poster image",
  "image_input": [
    "https://example.com/ref-1.webp",
    "https://example.com/ref-2.webp",
    "https://example.com/ref-3.webp"
  ],
  "resolution": "2K",
  "aspect_ratio": "16:9"
}

Response Example

The recommended automation path is to consume data[].url:
{
  "created": 1774885716,
  "data": [
    {
      "url": "https://media.crazyrouter.com/task-artifacts/2026/03/30/sync-image/20260330234836357407163eDKH9nsz-1.jpeg"
    }
  ]
}
To retrieve the generated image, read data[0].url. Crazyrouter currently archives upstream inline image output and returns a public URL to the client.

Validation Snapshot

ItemCurrent Status
single URL referenceverified
2 URL referencesverified
14 URL referencesverified
15 URL referencesverified as rejected
WEBP URLverified
PNG URLBeta
JPEG URLBeta
1Kverified
2K + 16:9verified
exact 30 MiB URL boundaryBeta

Current Known Limits

  • image is not accepted
  • data: / Base64 is not part of the public input contract
  • the docs do not promise stable JPEG URL behavior yet
  • the docs do not promise the exact 30 MiB URL boundary yet
If you need Gemini native generateContent image endpoints, see Gemini Image Generation and Gemini Image Editing. For stable customer-facing integration, prefer the /v1/images/generations contract documented on this page.