Overview
Image Generationendpoint:Request Body,model fieldcan imageModel, supported Text-to-Image (text-to-image) and Image-to-Image/Image Editing (image-to-image), supportedReference image, Aspect ratio and Resolution (1K/2K/4K) output.
endpointastask:Create Task after returntaskId, after query endpointPolling, orcallback_url in task complete when.
Base URL: https://mm-internal-cn.leonecloud.com
Description:endpoint and Image Generation/v1/images/generations Pathconsistent, when Usually Base URL and Token.Authentication
with endpoint in Request in Token:```
Authorization: Bearer {YOUR_AUTH_TOKEN}
---
## Quick Start
### Create Text-to-Image Task
```bashcurl -X POST "https://mm-internal-cn.leonecloud.com/v1/images/generations" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A surreal painting of a giant banana floating in space",
"size": "16:9",
"quality": "high"
}'
### Create Image-to-Image task (Reference image)```bash
curl -X POST "https://mm-internal-cn.leonecloud.com/v1/images/generations" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"prompt": "image, images",
"image": [
"https://example.com/ref1.jpg",
"https://example.com/ref2.jpg"
],
"size": "1:1",
"quality": "high"
}'Query Task Status
curl -X GET "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/task_20260509150000_abc12345" \
-H "Authorization: Bearer your_auth_token_here"Endpoints
1. create Image Generationtask**POST** /v1/images/generations
Content-Type: application/json
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model, use imageModel, see below「supported Model」 |
| prompt | string | Yes | imagePrompt |
| image | string[] | No | Reference imagelist (URL or base64 data URI); Image-to-Image/.Model supported maximum images, see below「supported Model」 |
| size | string | No | Aspect ratioor Resolution.when Aspect ratio (16:9, 1:1); as1K/2K/4K when Resolution; supported1792x1024 pixel string, will.DefaultModel |
| quality | string | No | quality,high height Resolution output; Model, see below「supported Model」.localized example textresolution whenresolution as |
| resolution | string | No | Resolutionlocalized example text1k / 2k / 4k, heightsize andquality.GPT Image 2 supported 1K/2K/4K,seedream-5.0-pro supported 1K/2K; Flux 2,1MP / 2MP / 3MP / 4MP; flux-3-image localized example text768SQ / 1K / 1.5K / 2K / 4K; mai-image-2.6 localized example text1K / 2K |
| nsfw_check | boolean | No | Safety moderation toggle.GPT Image 2, Flux 2 supported; andextra_body.nsfw_checker when in when field as |
| mask | string | No | Maskimage (URL or base64 data URI),.onlyModel supported (gpt-image-2) |
| n | integer | No | Number of outputs, default 1; Modelsingle image output, will |
| image_urls / mask_url | mixed | No | image / mask,, can and |
| background / moderation / output_format / output_compression / user | mixed | No | gpt-image-2-official andgpt-image-2-5-*-official imageParameter, Model |
| provider | string | No | only gpt-image-2-official andgpt-image-2-5-*-official supported:,oai / az, If omittedas ().after, can use when taskFailure and; Modelfield returncode=10002 |
| extra_body | object | No | Modelwith Parameter, Model, see below「Modelwith Parameter」 |
| callback_url | string | No | Callback notification URL after the task is complete |
| task_nickname | string | No | Task label for business tracking |
Description:
-sizefield「Aspect ratio」and「Resolutionlocalized example text」Meaning: when16:9aspect ratio string, when1K/2K/4K., GPT Image 2 can use aspect ratio stringsize+resolution(), Model can usehighlocalized example textquality, orextra_bodyModel with Resolutionfield ().
- Resolution tier priority:resolution>sizelocalized example text>quality.localized example textsize=16:9+resolution=4k16:9 4K image.
- localized example textimageafter as Image-to-Image/, Model will reference images to.
-imageandmasksupported URL or base64 data URI (data:image/jpeg;base64,...).
Request Example
Basic Text-to-Image:
{
"model": "gpt-image-2",
"prompt": "A surreal painting of a giant banana floating in space"
}Resolution and dimensions:
{
"model": "nano-banana-2",
"prompt": "can in,,",
"size": "16:9",
"quality": "high"
}Image-to-Image Editing (Single Reference):
{
"model": "gpt-image-2",
"prompt": "will image as, image",
"image": ["https://example.com/input.jpg"],
"size": "1:1"
}(Mask):
{
"model": "gpt-image-2",
"prompt": "Mask as",
"image": ["https://example.com/input.jpg"],
"mask": "https://example.com/mask.png"
}With Callback URL:
{
"model": "seedream-5.0-pro",
"prompt": ",",
"size": "21:9",
"quality": "high",
"callback_url": "https://your-server.com/callback"
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | int | Status Code, 0 indicates success |
| msg | string | Message |
| data.taskId | string | Task ID, used to query task status |
| data.status | string | Task Status, fixed to processing |
| data.createdAt | string | Created 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.tasklocalized example textprocessing when「Best Practices」in the Polling,success orfailed.
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | int | Status Code, 0 indicates success |
| msg | string | Message |
| data.taskId | string | Task ID |
| data.status | string | Task Status:processing / success / failed |
| data.result | string[] | generated resultimage URL list (Successreturned when applicable) |
| data.progress | int | 0-100 |
| data.pointConsume | string | localized example text |
| data.errorCode | string | Error Codes (Failurereturned when applicable) |
| data.errorMsg | string | Error Message (Failurereturned when applicable) |
| data.createdAt | string | Created Time |
| data.updatedAt | string | Updated Time |
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"
],
"progress": 100,
"createdAt": "2026-05-09 15:00:00",
"updatedAt": "2026-05-09 15:00:25"
}
}processing
{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20260509150000_abc12345",
"status": "processing",
"progress": 30,
"createdAt": "2026-05-09 15:00:00",
"updatedAt": "2026-05-09 15:00:08"
}
}supported Modelmodel fieldand Model Parameter.Model can.
| model Values () | Description | Reference imagemaximumimages | quality localized example text |
|---|---|---|---|
gpt-image-2 | GPT Image 2 | (Prompt and ) | high 2K, 1K; or useresolution to explicitly set 1K/2K/4K (higher priority than quality) |
gpt-image-2-official | OpenAI GPT Image 2, token, supported Text-to-Image, Image-to-Image, Mask and 1–4 images PNG/JPEG output.with Model EndpointPOST /api/v2/open/aigc/gpt-image-2-official | up to 16 images | auto / low / medium / high |
gpt-image-2-5-sunburst-official | GPT Image 2.5 Sunburst,,, image,.andgpt-image-2-official Parameter,quality localized example textxhigh / max localized example text.with 2.5 localized example textPOST /api/v2/open/aigc/gpt-image-2-5-official (localized example textgenType=sunburst ) | up to 16 images | auto / low / medium / high / xhigh / max |
gpt-image-2-5-flare-official | GPT Image 2.5 Flare,,, image,,.andgpt-image-2-5-sunburst-official Requestexactly identical, and token, onlyModel.with 2.5 localized example textPOST /api/v2/open/aigc/gpt-image-2-5-official (localized example textgenType=flare ) | up to 16 images | auto / low / medium / high / xhigh / max |
gpt-image-2-6-sunburst-official | GPT Image 2.6 Sunburst, and.OpenAI Parameter: supportedcomplexity, safety_identifier, markup,webp / gif / svg output and anyWIDTHxHEIGHT dimensions;provider onlysupportedoai.DescriptionGPT Image 2.6 Official.with 2.6 localized example textPOST /api/v2/open/aigc/gpt-image-2-6-official (localized example textgenType=sunburst ) | up to 16 images | auto / low / medium / high / xhigh / max |
gpt-image-2-6-flare-official | GPT Image 2.6 Flare, localized example text.andgpt-image-2-6-sunburst-official Requestexactly identical,, onlyModel.with 2.6 localized example textPOST /api/v2/open/aigc/gpt-image-2-6-official (localized example textgenType=flare ) | up to 16 images | auto / low / medium / high / xhigh / max |
gpt-image-2.6-sunburst | GPT Image 2.6 Sunburst, and, Resolution each ( token).1 images, supportedmask; size supported 15, in1:3 / 3:1 with 2K/4K.DescriptionGPT Image 2.6.withPOST /api/v2/open/aigc/gpt-image-2.6 (localized example textgenType=sunburst ) | localized example text | ( height quality);resolution 1K/2K/4K |
gpt-image-2.6-flare | GPT Image 2.6 Flare, localized example text.andgpt-image-2.6-sunburst Requestexactly identical,, onlyModel | localized example text | localized example text |
gpt-image-2.5-sunburst | GPT Image 2.5 Sunburst,, Resolution each ( token).1 images, supportedmask repainting;size supported 10.DescriptionGPT Image 2.5.withPOST /api/v2/open/aigc/gpt-image-2.5 (localized example textgenType=sunburst ) | up to 16 images | ( height quality);resolution 1K/2K/4K |
gpt-image-2.5-flare | GPT Image 2.5 Flare, localized example text.andgpt-image-2.5-sunburst Requestexactly identical,, onlyModel | up to 16 images | localized example text |
gpt-image-2-pro | GPT Image 2 Pro | localized example text | high 2K, 1K; or useresolution to explicitly set 1K/2K/4K (higher priority than quality) |
nano-banana-2 | Nano Banana 2 | 14 | high localized example text |
nano-banana-2-1 | Nano Banana 2.1 | 10 | high localized example text |
nano-banana-2-lite | Nano Banana 2 Lite | 10 | high localized example text |
nano-banana-pro | Nano Banana Pro | 8 | high localized example text |
seedream-4.5 | Seedream 4.5 | 14 | basic(2K) / high(4K) |
seedream-5.0-lite | Seedream 5.0 Lite | 14 | basic(3K) / high(4K) |
seedream-5.0-pro | Seedream 5.0 Pro | 10 | basic(1K) / high(2K) |
qwen-image-3 (qwen-image-3.0) | Qwen Image 3 | localized example text | high 2K, 1K ( no 4K) |
qwen-image-3-pro (qwen-image-3.0-pro) | Qwen Image 3 Pro | localized example text | ( no 4K) |
grok-imagine-1.5 | Grok Imagine 1.5 | 1 (only images ) | — |
flux-2-pro | Flux 2 Pro, image and | 8 | localized example textresolution localized example text1MP / 2MP / 3MP / 4MP (default 1MP); quality=high etc.2MP |
flux-2-flex | Flux 2 Flex, and | 8 | localized example text |
flux-2-max | Flux 2 Max, Flux 2 height | 8 | localized example text |
flux-3-image | FLUX-3-IMAGE, Flux 3 imageModel, Reference image | 10 | localized example textresolution localized example text768SQ / 1K / 1.5K / 2K / 4K (default 1K); quality=high etc.2K |
mai-image-2.6 | MAI-Image-2.6, height quality, token | 5 | supportedquality; localized example textresolution localized example text1K / 2K (default 1K) |
mai-image-2.6-flash | MAI-Image-2.6 Flash, andmai-image-2.6 Parameter,, Pricing | 5 | localized example text |
muse-image | Muse Image, images, Reference image | 9 (localized example text≤11MB) | no Resolution,quality / resolution localized example text |
Description:
- Seedream localized example textqualityonlylocalized example textbasic/high, will return ParameterError; Modelqualitylocalized example texthighlocalized example text.
-nano-banana-2/nano-banana-2-1/nano-banana-2-lite/qwen-image/ Seedream / Flux 2 /flux-3-imageRequest output 1 images,nno;mai-image-2.6localized example textnsupported1, greater than 1 return ParameterError.
- Flux 2 localized example textsizeAspect ratio1:1/4:3/3:4/16:9/9:16/3:2/2:3/21:9/9:21, Image-to-Imagesupportedauto(number images Reference image),1:1;resolutionlocalized example text1MP~4MPreturn ParameterError (1K/2K, etc.1MP/2MP).Reference image when Reference image, Flux 2.
-flux-3-imagelocalized example textsizelocalized example textautoand 15 Aspect ratio21:9/2:1/16:9/3:2/7:5/4:3/5:4/1:1/4:5/3:4/5:7/2:3/9:16/1:2/9:21, localized example text1:1;autoText-to-ImageModel prompt, Image-to-Image number images Reference image.resolutionlocalized example text768SQ/1K/1.5K/2K/4Kreturn ParameterError.Reference imageup to 10 images,; supportednsfw_check, FLUX-3-IMAGE.
-mai-image-2.6localized example textsizeAspect ratio (1:4localized example text4:1any ), dimensions (1536x1024, width and height≥768, localized example text≤1536×1536)orauto, return ParameterError;resolutionlocalized example text1K/2K.Reference image when output dimensions Model ( 100 ),size/resolutionlocalized example text.supportedmask, output PNG, MAI-Image-2.6 localized example text.
-muse-imagelocalized example textsizelocalized example text1:1/16:9/9:16/4:3/3:4/3:2/2:3orauto(If omittedorautowhen Text-to-Imagedefault1:1, Reference imageReference image image ), return ParameterError;nsupported1; supportedmask, output WebP, Muse Image.
-gpt-image-2.5-/gpt-image-2.6-(localized example text-officialafter )Resolution each, and*-officialtoken:Model, Pricing, Parameter supported,.output 1 images (nno ),quality, Resolutionresolutionandsize; 2.6 supportedmask.
- not imageModel ( Model)endpointmodelfield, as.
Modelwith Parameter (extra_body)
Model supportedextra_body with Parameter: | model | extra_body field | Description |
|---|---|---|---|
gpt-image-2 / gpt-image-2-pro | nsfw_checker(bool) | ; etc.nsfw_check, when as | |
grok-imagine-1.5 | nsfw_checker(bool) | localized example text | |
nano-banana-2 / nano-banana-2-1 | output_format(jpg/png) | Output format, default jpg | |
nano-banana-pro | output_format(png/jpg), aspect_ratio, resolution(1K/2K/4K) | heightsize/quality | |
seedream-4.5 / seedream-5.0-lite | nsfw_checker(bool) | localized example text | |
seedream-5.0-pro | nsfw_checker(bool), genType(t2i/i2i, can-layer after ),layerDecomposition(bool) | image provide images input image | |
qwen-image-3-pro | promptExtendMode(direct/agent) | agent onlysupported Text-to-Image | |
flux-2-pro / flux-2-flex / flux-2-max | nsfw_checker(bool) | ; etc.nsfw_check, when as | |
flux-3-image | safety_tolerance(0~4), grounding(bool) | safety_tolerance as, default2,, 0~4 return ParameterError;grounding default true, localized example text | |
mai-image-2.6 / mai-image-2.6-flash | web_grounding(bool), auto_aspect_ratio(bool), width / height(int) | web_grounding, defaultfalse; auto_aspect_ratio=true etc.size=auto; width / height provide, heightsize |
():```json
{
"model": "gpt-image-2",
"prompt": "a cat",
"extra_body": { "nsfw_checker": true }
}
---
## Callback Notification
task complete (Success or Failure) when, Create Task when provide`callback_url`, will URL POST Request.
### Callback Request
**Headers**Content-Type: application/json
X-Funcloud-Event: task.completed
X-Funcloud-Signature: {localized example text}
**Body**
```json{
"event": "task.completed",
"timestamp": "2026-05-09T15:00:25+08:00",
"signature": "a1b2c3d4e5f6...",
"data": {
"taskId": "task_20260509150000_abc12345",
"status": "success",
"result": ["https://fc-gw-sh.oss-accelerate.aliyuncs.com/images/output_001.png"],
"progress": 100,
"createdAt": "2026-05-09 15:00:00",
"updatedAt": "2026-05-09 15:00:25"
}
}
> - `data` fieldand query endpoint return`data` localized example text.
> - `X-Funcloud-Signature` as HMAC-SHA256, can use, when in Header and Body`signature` field.
> - Failure will 5s / 30s / 180s.
---
## Error Codes
| code | Description |
|------|------|
| 0 | Success |
| 10002 | Parametermissing or malformed |
| 10005 | API Key invalid or missing |
| 30003 | Task not found |
| 40001 | Insufficient balance |
| 90003 | Internal 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_url` Callback NotificationPolling, can query Request.
### 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
| Resolution | Scenario|
|--------|---------|
| 1K |,|
| 2K | height quality, asset|
| 4K |, dimensions|
### 5. when
image URL and when, when.