Image / Flux

Flux 2 Max Image Generation

Overview

Flux 2 Max Image Generationendpoint.create endpoint supported2 localized example text, localized example textimage:localized example textConditionDescription
Text-to-ImageIf omitted imageImage
Image-to-Imagelocalized example textimage (1~8 images )Reference image+ Prompt, repainting,

astask:create endpoint returntaskId, query endpointPolling.

Flux 2 Max Flux 2 in image quality height,, and,, height, image etc. Requirements height Scenario.image, as, Optional Flux 2 Pro or Flux 2 Flex.

Flux 2 Model:Flux 2 Pro (flux-2-pro), Flux 2 Flex (flux-2-flex), Flux 2 Max (flux-2-max).Request Parameters and Capabilityexactly identical, in image quality and with, Modelmodel field.

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 Task (Text-to-Image)

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": "flux-2-max",
 "prompt": "A beautiful sunset over the ocean, oil painting style",
 "size": "16:9",
 "resolution": "2MP"
 }'

Create Task (Image-to-Image, Reference image)

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": "flux-2-max",
 "prompt": "Transform the image into watercolor style",
 "image": ["https://example.com/reference.jpg"],
 "size": "auto",
 "resolution": "1MP"
 }'

Query Task Status

curl -X GET "https://mm-internal-cn.leonecloud.com/v1/images/generations/task_abc123" \
 -H "Authorization: Bearer your_auth_token_here"

Endpoints

1. create Flux 2 Max task**POST** /v1/images/generations

Create a Flux 2 Max Image Generationtask.

Content-Type: application/json

Request Parameters

ParameterTypeRequiredDescription
modelstringYeslocalized example textflux-2-max
promptstringYesPrompt, 3~5000 characters
imagestring[]NoReference imagelist (URL or base64 data URI),up to 8 images; Image-to-Image, exceeds 8 images return ParameterError
sizestringNoAspect ratio, default 1:1, Optional 1:1 / 4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:9 / 9:21; Image-to-Imagesupportedauto (number images Reference image)
resolutionstringNoResolution(), Optional1MP / 2MP / 3MP / 4MP, default 1MP (1MP = 1,048,576 ).localized example text1K (etc.1MP), 2K (etc.2MP).heightsize andquality
qualitystringNoquality(field),high etc.2MP, localized example text1MP localized example text.localized example textresolution whenresolution as, useresolution
nsfw_checkbooleanNo, defaultfalse.andextra_body.nsfw_checker when field as
extra_body.nsfw_checkerbooleanNonsfw_check etc.
callback_urlstringNoCallback notification URL after the task is complete
task_nicknamestringNoTask label, query / when
Description:
- localized example textimage localized example text:If omittedText-to-Image, Image-to-Image, no field.
- size;resolution.insize localized example text2MP, will Resolution, default1:1.
- Resolution tier priority:resolution > size localized example text> quality.localized example textsize=16:9 + resolution=2MP 16:9 2MP image (1920×1072).
- size will1:1, localized example text.auto onlyImage-to-Imagevalid, Text-to-Imagelocalized example textauto localized example text1:1 image.
- resolution localized example text1MP / 2MP / 3MP / 4MP (and1K / 2K)will return ParameterError.
- image supported URL or base64 data URI (data:image/jpeg;base64,...).
- Request output 1 images,n no.
- image Resolution, Reference image when Reference image, see below「Billing」.

ResolutionAspect ratio in Resolution output dimensions ( width× height, ):| size | 1MP | 2MP | 3MP | 4MP | |---|---|---|---|---| | 1:1 | 1024×1024 | 1440×1440 | 1536×1536 | 2048×2048 | | 4:3 | 1152×864 | 1664×1248 | 1824×1360 | 2336×1760 | | 3:4 | 864×1152 | 1248×1664 | 1360×1824 | 1760×2336 | | 16:9 | 1344×752 | 1920×1072 | 2048×1152 | 2720×1536 | | 9:16 | 752×1344 | 1072×1920 | 1152×2048 | 1536×2720 | | 3:2 | 1248×832 | 1728×1152 | 1872×1248 | 2496×1664 | | 2:3 | 832×1248 | 1152×1728 | 1248×1872 | 1664×2496 | | 21:9 | 1504×640 | 2176×928 | 2304×992 | 3072×1312 | | 9:21 | 640×1504 | 928×2176 | 992×2304 | 1312×3072 |

size asauto when output number images Reference image, dimensions in.

Request Example

① Text-to-Image

{
 "model": "flux-2-max",
 "prompt": "A futuristic city at night, neon lights, cyberpunk",
 "size": "16:9",
 "resolution": "2MP"
}

② Image-to-Image (single imageReference image, image )

{
 "model": "flux-2-max",
 "prompt": "Transform this image into watercolor style",
 "image": ["https://example.com/ref1.jpg"],
 "size": "auto",
 "resolution": "1MP"
}

③ Image-to-Image (multiple imagesReference image)

{
 "model": "flux-2-max",
 "prompt": "Combine the subject from the first image with the background of the second",
 "image": [
 "https://example.com/ref1.jpg",
 "https://example.com/ref2.jpg"
 ],
 "size": "3:2",
 "resolution": "4MP",
 "nsfw_check": true
}

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_20260810103000_abc12345",
 "status": "processing",
 "createdAt": "2026-08-10 10:30:00"
 }
}

2. Query Task Status

GET /v1/images/generations/{taskId}

query task execute Status.

Path Parameters

ParameterTypeRequiredDescription
taskIdstringYesTask ID

Response Parameters

ParameterTypeDescription
codeintStatus Code, 0 indicates success
msgstringMessage
data.taskIdstringTask ID
data.statusstringTask Status:processing / success / failed
data.resultstring[]image URL list (Successreturned when applicable)
data.errorCodestringError Codes (Failurereturned when applicable)
data.errorMsgstringError Message (Failurereturned when applicable)
data.progressint, 0-100
data.pointConsumestring(decimal characters)
data.taskNicknamestringTask label (create when return )
data.createdAtstringCreated Time (characters)
data.updatedAtstringUpdated Time (characters)

Response Example

Success

{
 "code": 0,
 "msg": "success",
 "data": {
 "taskId": "task_20260810103000_abc12345",
 "status": "success",
 "result": [
 "https://fc-gw-sh.oss-accelerate.aliyuncs.com/images/2026/08/10/output_001.png"
 ],
 "progress": 100,
 "createdAt": "2026-08-10 10:30:00",
 "updatedAt": "2026-08-10 10:31:30"
 }
}

Failure

{
 "code": 0,
 "msg": "success",
 "data": {
 "taskId": "task_20260810103000_abc12345",
 "status": "failed",
 "errorMsg": "Failure:",
 "createdAt": "2026-08-10 10:30:00",
 "updatedAt": "2026-08-10 10:30:45"
 }
}

Callback Notification

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

Headers

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

Body (taskindata fieldin, and「Query Task Status」endpointlocalized example textdata ):```json
{
"event": "task.completed",
"timestamp": "2026-08-10T10:31:30+08:00",
"signature": "a1b2c3d4e5f6...",
"data": {
"taskId": "task_20260810103000_abc12345",
"status": "success",
"result": ["https://fc-gw-sh.oss-accelerate.aliyuncs.com/images/output_001.png"],
"createdAt": "2026-08-10 10:30:00",
"updatedAt": "2026-08-10 10:31:30"
}
}


---

## Billing

**image**:image Resolution (`1MP` / `2MP` / `3MP` / `4MP`), height height; Text-to-Image and Image-to-Image image.localized example text`1K` / `2K` localized example text`1MP` / `2MP` localized example text.

**Reference imagelocalized example text**:Reference image (Image-to-Image) when, Reference image:| Reference imageimages| Reference imageBilling Method |
|---|---|
| 1 images| Reference image ( MP, height`4MP` ).1024×1024 localized example text`1MP`, 1920×1080 (1.98MP)localized example text`2MP`, 4000×3000 localized example text`4MP` |
| 2 images and| each Reference image`1MP` localized example text|

task= image+ Reference imagelocalized example text.Create Taskwhen, taskSuccess after; taskFailure.

localized example text「localized example text」as.

---

## Error Codes

| code | Description |
|------|------|
| 0 | Success |
| 10002 | Parametermissing or malformed |
| 10005 | API Key invalid or missing |
| 30003 | Task not found, taskId|
| 90003 | Internal server error |

---

## Best Practices

### -→ If omitted `image`
- with Reference image repainting,,→ localized example text`image` (1 images can )
- image (「A subject+ B localized example text」)→ multiple images`image`, and in prompt Description each image character### Resolution Selection

| resolution | Scenario|
|---|---|
| `1MP` | default, image,,|
| `2MP` | image, image, image|
| `3MP` |,, image asset|
| `4MP` |, image, image|

Flux 2 Max in height, recommended Flux 2 Pro or`1MP` image and, after prompt Flux 2 Max height.

### Reference imagerecommended

- single imageReference imagelocalized example text.Reference image provide or subject reference, first can exceeds 1MP ( 1024×1024 and ),`1MP` localized example text.
- images and Reference image each`1MP`, and Reference image dimensions no.
- Reference imageup to 8 images, exceeds will return ParameterError, will.

### Polling Strategy

- First 30 seconds:query every 3 seconds
- 30 seconds ~ 2 minutes:query every 5 seconds
- After 2 minutes:query every 10 seconds

localized example text`callback_url`, taskcomplete after, no Polling.

### Processing Time Reference

- Text-to-Image / Image-to-Image:Usually 10 ~ 60 seconds
- Resolutionheight, Reference image, when### Prompt recommended

- use,, can ( oil painting, watercolor, digital art etc. )
- Image-to-Image when,prompt localized example text**localized example text**, image 
- multiple imagesReference image when,「the first image」「the second image」refer to each image 
- supported, Usually
Updated 2026-10-15