API docsAPI reference

Nano Banana 2 · OpenAI-compatible images

POST /images/generations accepts the OpenAI images API, so the OpenAI SDKs, LobeChat, Cherry Studio, Dify and n8n can use every image model here. size maps to the closest aspect_ratio, n to num_images, and any model parameter can be passed as an extra field. It waits up to ~110s; a slower task returns 504 with its id to poll.

POST/api/v1/images/generationsBearer API key
nano-banana-2Image · GoogleModel details & pricing

Endpoints for this model

Select a provider to see its effective parameter limits. Automatic routing chooses a provider that supports your input. Examples include defaults and required inputs; replace example media URLs with accessible files.

Request

cURL
curl 'https://01router.com/api/v1/images/generations' \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "nano-banana-2",
  "prompt": "A cinematic landscape at sunrise.",
  "aspect_ratio": "1:1",
  "resolution": "1K",
  "num_images": 1
}'

Input parameters

JSON body
model
stringRequired

Model slug from the catalog. Project keys may use a project-specific model slug.

Allowed values:"nano-banana-2"
prompt
stringRequired

Text describing the requested image. Required and non-empty.

provider
stringOptional

Optional provider slug. Omit for automatic routing; project settings may pin the provider.

project
stringOptional

Optional project ID. Use its published model catalog and routing configuration.

size
stringOptional

Width x height, such as 1024x1024, or auto. Maps to the nearest supported aspect ratio when needed.

n
integerOptional

Positive integer, default 1. Multiple images require the model to support num_images.

Default:1
Minimum:1
response_format
stringOptional

url (default) or b64_json. If base64 conversion fails or exceeds the size limit, that item falls back to a URL.

Default:"url"
Allowed values:"url""b64_json"
image_urls
string<uri>[]Optional

Optional — switches to image editing

Maximum items:14
aspect_ratio
enumOptional
Default:"1:1"
Allowed values:"1:1""16:9""9:16""4:3""3:4""3:2""2:3""4:5""5:4""21:9"
resolution
enumOptional
Default:"1K"
Allowed values:"1K""2K""4K"
num_images
integerOptional
Default:1
Minimum:1
Maximum:4

Response example

200 · application/json
{
  "created": 1792915200,
  "data": [
    {
      "url": "https://example.com/result.png"
    }
  ],
  "id": "gen_example",
  "model": "nano-banana-2",
  "credits": 10
}

Responses are illustrative. IDs, usage, prices and results depend on the actual request.

Response fields

created
integer

Unix timestamp in seconds.

data
array

Each item has url or b64_json depending on response_format and conversion availability.

id
string

Generation ID returned by the create request.

model
string

Model slug from the catalog. Project keys may use a project-specific model slug.

credits
number

Credits charged for this generation; zero after a refund.

Usage notes

  • Poll at intervals of at least 3 seconds. A 504 from the synchronous image endpoint means the task may still be running: poll its error.id instead of submitting it again.
  • For /generations and /quote, put these parameters inside input. For /images/generations, put them at the top level. Chat parameters go at the top level of /chat/completions.

Use with AI

Give your coding assistant the documentation index or the full API reference, including live model parameters.