apimaxDocs
DocsPricingConsole
API ReferenceIntegration GuideUser GuideChangelog

Music Series

Image Series

POSTNano Banana 2.1 Image GenerationPOSTNano Banana 2 Lite Image GenerationPOSTNano Banana Pro Image GenerationPOSTNano Banana 2 Image Generation

Video series

Task Management

Error Code ReferenceQuery Task StatusGET

Account Management

Query Quota UsageGET

Docs / Image Series / Nano Banana / Async

AsyncPOSTImageGenerationNano-BananaGeminiAsyncgemini-3-pro-image

Nano Banana Pro Image Generation

Asynchronous image generation with Google Nano Banana 2 (Gemini), excelling at multi-image fusion, real-person references, and text rendering, with support for reasoning levels.

POSThttps://api.apimax.ai/v1/images/async-generations
Try it
Bearer API KeyJSONServer-side call

Nano Banana Pro (nano-banana-pro) is a new-generation image generation model built on Google Gemini. It excels at text-to-image, image-to-image, and image editing, with outstanding multi-image fusion, real-person reference, and text rendering. This endpoint is compatible with the OpenAI Images API format and uses an asynchronous task mode: submitting a request returns a task ID, which you then poll for the result.

- Asynchronous mode uses a dedicated endpoint, POST /v1/images/async-generations, which returns a task_id on submission. Use the task query endpoint to fetch the result. - model accepts nano-banana-pro or gemini-3-pro-image; the two names are equivalent. - Generated image links are pre-signed URLs valid for about 24 hours; save them promptly. - This model generates only 1 image per request (n is fixed at 1).

Authentication#

All endpoints require Bearer token authentication. Create your key on the API Key management page and add it to the request header:

text
Authorization: Bearer YOUR_API_KEY

Create a task#

POST /v1/images/async-generations

Request parameters#

ParameterTypeRequiredDefaultDescription
modelstringYesnano-banana-proModel name; use nano-banana-pro or gemini-3-pro-image — both equivalent
promptstringYes—The prompt describing the image to generate or edit. Up to about 2000 tokens
sizestringNoautoAspect ratio of the generated image; see the enumeration below
resolutionstringNo2KClarity tier 1K/2K/4K; pricing differs by tier
image_urlsarrayNo—List of reference image URLs for image-to-image/image editing. Up to 14 images, each < 20MB
model_paramsobjectNo—Model extension parameters; see below
callback_urlstringNo—HTTPS callback URL invoked when the task completes

size aspect ratio#

Defaults to auto (decided automatically by the model). Supported values:

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

resolution#

ValueDescription
1K~1MP, fastest speed, lowest cost
2K~4MP (default), balanced quality and cost
4K~8MP, richest detail, highest cost

image_urls reference images#

  • A single request accepts up to 14 images, each < 20MB
  • Supported formats: .jpeg, .jpg, .png, .webp
  • Image URLs must be directly accessible to the server, or downloaded directly when accessed (usually ending in an extension such as .png or .jpg)
  • At most 4 images of real people may be included

model_params extension parameters#

FieldTypeDefaultDescription
thinking_levelstringautoThinking/reasoning level: auto (automatic) / min (minimal reasoning, fastest) / high (deep reasoning, best quality)

Request examples#

The request body has the same structure as the synchronous OpenAI Images API. Minimal text-to-image:

json
{
  "model": "nano-banana-pro",
  "prompt": "A cat playing on the grass"
}

Specifying the aspect ratio and resolution:

json
{
  "model": "nano-banana-pro",
  "prompt": "A cinematic wide shot of a futuristic city skyline at dusk",
  "size": "16:9",
  "resolution": "4K"
}

Image-to-image / multi-image fusion (with reference images) + deep reasoning:

json
{
  "model": "nano-banana-pro",
  "prompt": "Combine these two people into the same poster, cyberpunk style",
  "size": "3:4",
  "resolution": "2K",
  "image_urls": [
    "https://example.com/person1.png",
    "https://example.com/person2.png"
  ],
  "model_params": {
    "thinking_level": "high"
  },
  "callback_url": "https://your-domain.com/webhook/image-done"
}

Create task response#

On successful submission, task information is returned immediately (HTTP 200):

json
{
  "id": "task_V1StGXR8_Z5jdHi6B",
  "object": "image.generation.task",
  "type": "image",
  "status": "queued",
  "progress": 0,
  "created": 1757165031,
  "model": "nano-banana-pro",
  "task_info": {
    "can_cancel": true,
    "estimated_time": 45
  }
}

id is the task identifier (task_ prefix), used for subsequent queries.

Query a task#

GET /v1/tasks/{id}

bash
curl 'https://api.apimax.ai/v1/tasks/task_V1StGXR8_Z5jdHi6B' \
  --header 'Authorization: Bearer <token>'

Poll every 2-5 seconds until status becomes completed or failed.

Completed (`completed`):

json
{
  "id": "task_V1StGXR8_Z5jdHi6B",
  "object": "image.generation.task",
  "type": "image",
  "status": "completed",
  "progress": 100,
  "created": 1757165031,
  "completed_at": 1757165076,
  "model": "nano-banana-pro",
  "data": [
    {
      "url": "https://cdn.example.com/img/.../0.png?X-Amz-Signature=...",
      "url_expires_at": 1757168676
    }
  ],
  "usage": {
    "input_tokens": 18,
    "output_tokens": 1290,
    "total_tokens": 1308
  }
}

The pre-signed URL is re-signed on every query, so polling effectively "refreshes" expired links.

Failed (`failed`):

json
{
  "id": "task_V1StGXR8_Z5jdHi6B",
  "object": "image.generation.task",
  "type": "image",
  "status": "failed",
  "failed_at": 1757165076,
  "model": "nano-banana-pro",
  "error": {
    "code": "upstream_error",
    "message": "gemini blocked: SAFETY"
  }
}

status#

StatusMeaning
queuedQueued, waiting to execute
in_progressGenerating
completedGeneration completed; data contains the image links
failedGeneration failed; see error

error.code error codes#

CodeMeaning
upstream_errorUpstream returned 4xx (content safety block / invalid prompt)
upstream_unavailableUpstream still returned 5xx after multiple retries
storage_errorFailed to upload the result to cloud storage
internal_errorInternal gateway exception

If a task fails, the pre-deducted quota is automatically refunded.

Error codes (HTTP)#

Status codecodeMeaning
400invalid_requestMissing prompt/model or otherwise invalid parameters
400model_not_supportedModel is not in the asynchronous support list
401unauthorizedToken is invalid or expired
403insufficient_user_quotaInsufficient quota; please top up
403(empty string)Token does not have access to this model
429rate_limit_exceededToo many requests
500internal_errorInternal server error

Callback (callback_url)#

When callback_url is set, the gateway POSTs a callback whenever the task completes / fails / is canceled. The callback body has the same format as the task query endpoint.

  • Only HTTPS is supported, callbacks to internal IPs are blocked, and the URL must be no more than 2048 characters
  • 10-second timeout; failed deliveries are retried up to 3 times (after 1s / 2s / 4s)
  • A 2xx callback response counts as success; any other status code triggers a retry

Next steps

All docs
Midjourney API OverviewMidjourney MJ Proxy-compatible API: endpoints, actions, per-call pricing, task states and error codes.Nano Banana 2.1 Image GenerationGoogle Nano Banana 2.1 (Gemini) async image generation. Excels at multi-image blending, real-person references, and text rendering, with a thinking level option.Nano Banana 2 Lite Image GenerationAsynchronous image generation with Google Nano Banana 2 (Gemini), excelling at multi-image fusion, real-person references, and text rendering, with support for reasoning levels.GPT Image 2 Image Generation/v1/images/async-generationsNano Banana 2 Image GenerationGoogle Nano Banana 2 (Gemini) async image generation. Excels at multi-image blending, real-person references, and text rendering, with support for thinking levels.Nano Banana Synchronous Image GenerationGemini image models (the nano-banana series) support OpenAI-compatible synchronous image generation and multipart image editing, return base64 by default, and work with the OpenAI SDK.
On this page
OverviewAuthenticationCreate a taskRequest parameterssize aspect ratioresolutionimageurls reference imagesmodelparams extension parametersRequest examplesCreate task responseQuery a taskstatuserror.code error codesError codes (HTTP)Callback (callbackurl)Next steps
API

POST /v1/images/async-generations