Image / Nano Banana

Nano Banana Pro Image Generation

Overview

The Nano Banana Pro image generation endpoint supports text-to-image and image-to-image editing, multi-resolution output (1K/2K/4K), and up to 8 reference images for image-to-image editing.

Base URL: https://mm-internal-cn.leonecloud.com


Authentication

All endpoints require a token in the request header for authentication:

Authorization: Bearer {YOUR_AUTH_TOKEN}

Quick Start

cURL Example

Create Text-to-Image Task

curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/nano-banana-pro" \
 -H "Authorization: Bearer your_auth_token_here" \
 -H "Content-Type: application/json" \
 -d '{
 "prompt": "A surreal painting of a giant banana floating in space",
 "aspectRatio": "16:9",
 "resolution": "2K",
 "outputFormat": "png"
 }'

Create Image-to-Image Editing Task

curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/nano-banana-pro" \
 -H "Authorization: Bearer your_auth_token_here" \
 -H "Content-Type: application/json" \
 -d '{
 "prompt": "will image as",
 "imageUrls": ["https://example.com/input.jpg"],
 "aspectRatio": "1:1",
 "resolution": "2K"
 }'

Query Task Status

curl -X GET "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/task_abc123" \
 -H "Authorization: Bearer your_auth_token_here"

Endpoints

1. Create Nano Banana Pro Image Generation Task

POST /api/v2/open/aigc/nano-banana-pro

Create a Nano Banana Pro image generation task.

Content-Type: application/json

Request Parameters

ParameterTypeRequiredDescription
promptstringYesImage prompt, up to 10,000 characters
imageUrlsstring[]NoReference image URLs (up to 8 images; JPEG/PNG/WebP; maximum 30 MB each)
aspectRatiostringNoAspect ratio:1:1(default) / 2:3 / 3:2 / 3:4 / 4:3 / 4:5 / 5:4 / 9:16 / 16:9 / 21:9 / auto
resolutionstringNoOutput resolution:1K(default) / 2K / 4K
outputFormatstringNoOutput format:png(default) / jpg
callbackUrlstringNoCallback notification URL after the task is complete
Description:
- When imageUrls is provided, the endpoint automatically uses image-to-image editing mode and generates from the reference images
- Supports up to 8 reference images. Each image can be up to 30 MB and must be JPEG, PNG, or WebP.

Request Example

Basic Text-to-Image:

{
 "prompt": "A surreal painting of a giant banana floating in space"
}

Specify Resolution and Size:

{
 "prompt": "can in,,",
 "aspectRatio": "16:9",
 "resolution": "4K",
 "outputFormat": "jpg"
}

Image-to-Image Editing (Single Reference):

{
 "prompt": "will image as, image",
 "imageUrls": ["https://example.com/input.jpg"],
 "aspectRatio": "1:1",
 "resolution": "2K"
}

Image-to-Image Editing (Multiple References):

{
 "prompt": "image, images",
 "imageUrls": [
 "https://example.com/ref1.jpg",
 "https://example.com/ref2.jpg",
 "https://example.com/ref3.jpg"
 ],
 "aspectRatio": "3:2",
 "resolution": "2K"
}

With Callback URL:

{
 "prompt": ",",
 "aspectRatio": "21:9",
 "resolution": "4K",
 "callbackUrl": "https://your-server.com/callback"
}

Response Parameters

ParameterTypeDescription
codeintStatus Code, 0 indicates success
msgstringMessage
data.taskIdstringTask ID, used to query task status
data.statusstringTask Status, fixed to processing
data.createdAtstringCreated Time

Response Example

Success

{
 "code": 0,
 "msg": "success",
 "data": {
 "taskId": "task_20260509150000_abc12345",
 "status": "processing",
 "createdAt": "2026-05-09 15:00:00"
 }
}

2. Query Task Status

GET /api/v2/open/aigc/{taskId}

query task execute Status.

Response Example

Success

{
 "code": 0,
 "msg": "success",
 "data": {
 "taskId": "task_20260509150000_abc12345",
 "status": "success",
 "result": [
 "https://fc-gw-sh.oss-accelerate.aliyuncs.com/images/2026/05/09/output_001.png"
 ],
 "createdAt": "2026-05-09 15:00:00",
 "updatedAt": "2026-05-09 15:00:25"
 }
}

3. Batch Query Task Status

POST /api/v2/open/aigc/batch

query task execute Status (up to 100 ).


Callback Notification

task complete (Success or Failure) when, if Create Task when providecallbackUrl, was provided when creating the task, the system sends a POST request to that URL.

Callback Request

Headers

Content-Type: application/json
X-Funcloud-Event: task.completed
X-Funcloud-Signature: {localized example text}

Body

{
 "event": "task.completed",
 "taskId": "task_20260509150000_abc12345",
 "status": "success",
 "result": ["https://fc-gw-sh.oss-accelerate.aliyuncs.com/images/output_001.png"],
 "errorMsg": "",
 "timestamp": "2026-05-09T15:00:25+08:00",
 "signature": "a1b2c3d4e5f6..."
}

Error Codes

codeDescription
0Success
10002Parametermissing or malformed
10005API Key invalid or missing
10010Insufficient balance
30003Task not found
90003Internal server error

Best Practices

1. Polling Strategy

recommendedPolling:
- First 30 seconds:query every 3 seconds
- After 30 seconds:query every 5 seconds### 2. Use Callback

recommended use Callback NotificationPolling.

3. Processing Time Reference

  • Text-to-Image (1K):Usually 5 ~ 20 seconds
  • Text-to-Image (2K/4K):Usually 10 ~ 30 seconds
  • Image-to-Image editing:Usually 10 ~ 30 seconds

4. Resolution Selection

ResolutionScenario
1K,
2Kheight quality, asset
4K, dimensions
Updated 2026-09-02