asOpenAI localized example text:Path, Request Bodyand OpenAIimages/generations,images/edits, can OpenAI SDK.in use v2 endpoint (POST /api/v2/open/aigc/gpt-image-2-5-official, camelCase Request Body)localized example textGPT Image v2 endpoint.task and, can.
Overview
GPT Image 2.5 Official with Sunburst and Flare, Request and exactly identical, Request Bodymodel: | model | localized example text | Scenario |
|---|---|---|---|
gpt-image-2-5-flare-official | , | , image,,, | |
gpt-image-2-5-sunburst-official | localized example text | , image, | , Parameter token, when inlocalized example textandqualitylocalized example text.Scenarioflare. |
andgpt-image-2-official, 2.5 localized example textxhigh andmax quality;medium andhigh output token as.
| Capability | localized example text | RequestFormat |
|---|---|---|
| Text-to-Image / Image-to-Image | POST /v1/images/generations | application/json |
| Image Editing (upload a file) | POST /v1/images/edits | multipart/form-data |
| Query Tasklocalized example text | GET /v1/images/generations/{taskId} | — |
- supported Text-to-Image, Image-to-Image and Mask repainting
- supported up to 16 images Reference image, 1–4 images image
- supported 15 and 1K / 2K / 4K Resolution
- -
qualityin 2.0 localized example textlow/medium/highlocalized example textxhigh/max- supported PNG / JPEG; PNG can - token, query results return
usage - query resultslocalized example text
outputafter; image Base64 will as URL - default:task booking after Usually 1 seconds return
taskId, query image;async=falsecan as, Request OpenAI imageBase URL:https://mm-internal-cn.leonecloud.com
localized example text```http Authorization: Bearer YOUR_API_KEY
## Create Task
**POST** `/v1/images/generations`
`Content-Type: application/json`.defaultlocalized example text——task bookingafter Usually 1 seconds return`taskId`, etc. image.Requestimage when`async=false`, see below[localized example text](#-async-false).
### Text-to-Imagelocalized example text```bash
curl -X POST "https://mm-internal-cn.leonecloud.com/v1/images/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2-5-sunburst-official",
"prompt": ",, and,",
"size": "16:9",
"resolution": "2k",
"quality": "xhigh",
"n": 1,
"output_format": "jpeg",
"output_compression": 90,
"callback_url": "https://example.com/webhooks/image",
"task_nickname": "autumn-fox"
}'localized example textmodel localized example textgpt-image-2-5-flare-official can, fieldexactly identical.xhigh / max image, token height, use.
Image-to-Imagelocalized example textimage Image-to-Image, no Generation type.
{
"model": "gpt-image-2-5-sunburst-official",
"prompt": "subject, will as, and output PNG",
"image": ["https://example.com/product.png"],
"size": "1:1",
"resolution": "1k",
"background": "transparent",
"output_format": "png"
}Maskrepainting
Mask as Alpha PNG, dimensions and images Reference image, must andimage use.
{
"model": "gpt-image-2-5-sunburst-official",
"prompt": "onlyMask as",
"image": ["https://example.com/room.png"],
"mask": "https://example.com/mask.png",
"size": "1:1",
"resolution": "1k",
"output_format": "png"
}Image Editinglocalized example text**POST** /v1/images/edits
Content-Type: multipart/form-data.and,fieldand Meaningexactly identical (localized example textbackground / moderation / output_format / output_compression / provider), in image and Mask file, no URL or Base64.task bookingand query Methodexactly identical.
curl -X POST "https://mm-internal-cn.leonecloud.com/v1/images/edits" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-2-5-sunburst-official" \
-F "prompt=, subject" \
-F "size=1:1" \
-F "resolution=2k" \
-F "background=transparent" \
-F "output_format=png" \
-F "image=@/path/to/product.png"Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | gpt-image-2-5-sunburst-official orgpt-image-2-5-flare-official |
prompt | string | Yes | — | image, maximum 32,000 characters |
n | integer | No | 1 | image, range 1–4, mustType |
size | string | No | auto | , dimensions, dimensions orauto (Text-to-Imageas1:1, Image-to-ImageReference image); see below |
resolution | string | No | 1k | 1k, 2k or4k; andsize use |
quality | string | No | auto | auto, low, medium, high, xhigh, max; auto Model when |
image | string[] | No | — | input imagelist (URL or Base64 data URI),Image-to-Image, up to 16 images |
mask | string | No | — | Mask PNG (URL or Base64 data URI), must andimage use, dimensions and images Reference image Alpha |
background | string | No | auto | auto, opaque ortransparent; supported PNG, andoutput_format=jpeg will |
moderation | string | No | auto | ,auto () orlow; andnsfw_check=true when asauto |
nsfw_check | boolean | No | false | Safety moderation toggle; astrue when usemoderation=auto |
output_format | string | No | png | png orjpeg; supported WebP, will |
output_compression | integer | No | — | output quality, range 0–100, onlylocalized example textjpeg;png 100 will, 100 will |
provider | string | No | localized example text | ,oai / az; If omittedas,.see below「localized example text」 |
async | boolean | No | true | ;false image and return OpenAI image |
response_format | string | No | url | only async=false when:url orb64_json |
extra_body | object | No | — | Modelwith Parameter,{"nsfw_checker": true} |
callback_url | string | No | — | taskcomplete after Callback URL |
task_nickname | string | No | — | Task label, localized example text |
user | string | No | — | (OpenAI field) |
qualitylocalized example text:xhigh,max2.5 2.0 height quality, image token height, use.will;gpt-image-2-officialwill.
/v1/images/edits field and Meaning and exactly identical, inimage andmask as file (multiple images whenimage field); can useimage_urls URL Reference image,mask_url URL provide Mask, and upload a file can.localized example textextra_body JSON characters,provider localized example text-F provider=az can.
Model in with, default can use and.with when can useprovider:| provider | Meaning |
| --- | --- |
| If omitted (default) |,|
| az | onlyuse Azure|
| oai | onlyuse OpenAI|
- after:localized example textproviderin, when can use when taskFailure and, will.image Success, no when field.
- image Parameter, and return exactly identical,providerlocalized example text.
- localized example textoai/azreturned when applicablecode=10002.
dimensions and Resolutionsize × resolution will in as dimensions:| size | 1k | 2k | 4k |
| --- | --- | --- | --- |
| 1:1 | 1024×1024 | 2048×2048 | 2880×2880 |
| 3:2 | 1536×1024 | 2048×1360 | 3520×2336 |
| 2:3 | 1024×1536 | 1360×2048 | 2336×3520 |
| 4:3 | 1024×768 | 2048×1536 | 3312×2480 |
| 3:4 | 768×1024 | 1536×2048 | 2480×3312 |
| 5:4 | 1280×1024 | 2560×2048 | 3216×2576 |
| 4:5 | 1024×1280 | 2048×2560 | 2576×3216 |
| 16:9 | 1536×864 | 2048×1152 | 3840×2160 |
| 9:16 | 864×1536 | 1152×2048 | 2160×3840 |
| 2:1 | 2048×1024 | 2688×1344 | 3840×1920 |
| 1:2 | 1024×2048 | 1344×2688 | 1920×3840 |
| 3:1 | 1536×512 | 3072×1024 | 3840×1280 |
| 1:3 | 512×1536 | 1024×3072 | 1280×3840 |
| 21:9 | 2016×864 | 2688×1152 | 3840×1648 |
| 9:21 | 864×2016 | 1152×2688 | 1648×3840 |, canin dimensionsassize ("size": "2048x1152"), whenresolution, no; not in whensize supported.
supporteddimensions (localized example text"size": "1088x1920"), when Condition, returned when applicableParameterError:
- width, height as 16;
- exceeds 3840;
- Aspect ratioin 1:3 3:1;
- in 655,360 8,294,400.
dimensionsresolution and; supported andprovider=az localized example text.:
-size orauto when:Text-to-Image1:1; Image-to-Image (Mask) images Reference image Aspect ratio, in,resolution localized example text.Reference imagedimensions Failure when as1:1.
- size localized example text1k / 2k / 4k notresolution when, will Resolution, as1:1.
- resolution localized example textsize;1k / 2k / 4k will.
- Resolutionasresolution > size localized example text> quality.
ParameterLimit
| Limit in when, will return ParameterError (): | Limitlocalized example text | localized example text |
|---|---|---|
prompt | Required, maximum 32,000 characters | |
n | 1–4, mustType | |
| Reference imagelocalized example text | up to 16 images | |
mask | mustandimage use, Mask will | |
quality | only auto / low / medium / high / xhigh / max; xhigh, max 2.5 with | |
size | in the 15,, dimensions orauto | |
output_format | only png / jpeg; supported WebP | |
output_compression | 0–100, only jpeg localized example text | |
provider | only oai / az, If omittedas | |
| localized example text | background=transparent onlysupportedpng output | |
| output | supported image (partial images), Polling |
task booking(default)task:```json { "code": 0, "msg": "success", "data": { "taskId": "task_xxx", "status": "processing", "createdAt": "2026-09-09 18:00:00" } }
localized example text`data.taskId` after Polling query, or`callback_url` complete.
## Query Task
**GET** `/v1/images/generations/{taskId}`
`/v1/images/generations` and`/v1/images/edits` create task query.
```bashcurl "https://mm-internal-cn.leonecloud.com/v1/images/generations/task_xxx" \
-H "Authorization: Bearer YOUR_API_KEY"
`status` can as`processing`, `success` or`failed`.recommended2–5 secondsquery,.
Successwhen,`result` image URL list,`output` after.localized example text`b64_json` will and URL, field and`usage` localized example text.
```json{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_xxx",
"status": "success",
"result": ["https://cdn.example.com/image.png"],
"output": {
"created": 1789012800,
"data": [{"url": "https://cdn.example.com/image.png"}],
"background": "opaque",
"output_format": "png",
"quality": "high",
"size": "1024x1024",
"usage": {
"input_tokens": 10,
"input_tokens_details": {
"cached_tokens": 0,
"text_tokens": 10,
"image_tokens": 0
},
"output_tokens": 7033,
"output_tokens_details": {
"text_tokens": 0,
"image_tokens": 7033
},
"total_tokens": 7043
}
}
}
}
### usage field
| field | Description |
| --- | --- |
| `input_tokens` | input token|
| `input_tokens_details.cached_tokens` | return input token|
| `input_tokens_details.text_tokens` | Prompt token |
| `input_tokens_details.image_tokens` | Reference image token; Text-to-ImageUsuallyas 0|
| `output_tokens` | output token|
| `output_tokens_details.image_tokens` | image token|
| `output_tokens_details.text_tokens` | output token, Image GenerationUsually as 0|
| `total_tokens` | token|
localized example text`data.completionTokens` token, etc.`output.usage.total_tokens`.
> localized example text`usage` return`input_tokens` / `output_tokens` / `total_tokens` localized example text`*_details`, when not input token image input, Optionalfield.
## (`async=false`)
as OpenAI image, can OpenAI SDK:```json
{
"created": 1778394000,
"data": [
{ "url": "https://.../output_001.png" }
]
}localized example textresponse_format=b64_json when,data as{"b64_json":"..."}.
4K image when: when width 10 minutes; Scenariorecommended use default, when.
andcallback_url after, tasksuccess orfailed when, will HTTP POST.
Create Task when Parameter, Success afteroutput.usage in the input, image input and image output token; Failuretask.:
-quality,xhigh / max height;quality=auto localized example texthigh localized example text.
- localized example textsize ( exceeds 1536×1024 dimensions ).
- localized example textn,n=4 asn=1 4.
- Reference imageeach input.
when,return token as, in task when.
Sunburst and Flare,, in asgpt-image-2-5-sunburst-official andgpt-image-2-5-flare-official.
Errorlocalized example text(default)Error, HTTP Status Code as 200,code:| code | Meaning | recommended|
| --- | --- | --- |
| 0 | Success | — |
| 10002 | Parametermissing or malformed / supported model| localized example textmsg Parameter, reference「ParameterLimit」 |
| 10005 | not, API Key invalid or missing| localized example textAuthorization: Bearer localized example text|
| 30003 | Task not found | localized example texttaskId |
| 40001 | Insufficient balance, no complete| after|
| 90003 | localized example text| after;|
taskSuccess after if Failure, query endpoint will returnstatus: "failed" and inmsg in Failure, first will.
(async=false)OpenAI Error, and use HTTP Status Code:400 ParameterError, 401 Failure,402 Insufficient balance, 500 taskexecute Failure,504 etc. exceeds 10 minutes not image (tasknot, error.code localized example texttaskId, can query ).
v2 endpoint| localized example text| v2 endpoint| (OpenAI )|
| --- | --- | --- |
| create Path| `POST /api/v2/open/aigc/gpt-image-2-5-official | POST /v1/images/generations |
| query Path| GET /api/v2/open/aigc/{taskId} | GET /v1/images/generations/{taskId} |
| localized example text| Request Body genType | model localized example text-sunburst-official / -flare-official |
| fieldlocalized example text| camelCase (when snake_case )| OpenAI field|
| Reference image | imageUrls / base64File / base64FileList | image (URL or Base64 data URI)|
| Mask | maskUrl / maskFile | mask |
| Image Editing | Reference imageURL or Base64| /v1/images/edits, image upload a file|
| image| supported| supported (async=false`) |
| OpenAI SDK localized example text| No | Yes |
v2 endpoint can use, task and.v2 fieldDescriptionGPT Image v2 endpoint.