asOpenAI localized example text:, field and and OpenAI Images API (images/generations,images/edits), can OpenAI SDK.can use v2 endpoint (POST /api/v2/open/aigc/gpt-image-2-6-official, camelCase Request Body), localized example text「v2 endpoint」andGPT Image v2 endpoint.task and.
Overview
GPT Image 2.6 Official with Sunburst and Flare, Request and exactly identical, Request Bodymodel: | model | localized example text | Scenario |
|---|---|---|---|
gpt-image-2-6-flare-official | , | , image,, | |
gpt-image-2-6-sunburst-official | and | , image, | , Parameter token. |
| 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} | — |
- Text-to-Image, Image-to-Image, Maskrepainting, (
markup) - output PNG / JPEG / WebP, and GIF image, SVG image
- any
WIDTHxHEIGHTdimensions ( height 3840, 8,294,400 ), can use「localized example text+ localized example text」-qualitysupportedauto/low/medium/high/xhigh/max;complexitysupportedlow/medium/high - up to 16 images Reference image, 1–4 images
- token, query results return and OpenAI
usage - default:task booking after Usually 1 seconds return
taskId, query image;async=falsecan as### and OpenAI
| field and OpenAI as, Limit or: | localized example text | OpenAI localized example text | localized example text |
|---|---|---|---|
n | 1–10 | 1–4 | |
stream / partial_images | supported image | supported, | |
| return Image | data[].b64_json | defaultreturn image URL; can useresponse_format=b64_json Base64 | |
| GIF output | and can use | supported Text-to-Image and Image-to-Image, supportedmask / markup | |
| SVG output | and can use | supported Text-to-Image and Image-to-Image, supportedmask / markup | |
size | auto orWIDTHxHEIGHT | supported「localized example text+ resolution localized example text」() | |
| field | — | resolution, provider, nsfw_check, async, response_format, callback_url, task_nickname, extra_body |
supported OpenAI field:stream, partial_images, input_fidelity (Requirements GPT Image 2 If omitted),prompt_rewriter, and Modelvalidstyle.
Base 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`.default, task booking after return`taskId`; 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-6-sunburst-official",
"prompt": ",, and,",
"size": "1536x864",
"quality": "high",
"complexity": "medium",
"n": 1,
"output_format": "webp",
"output_compression": 90,
"safety_identifier": "user-7f3a9c",
"callback_url": "https://example.com/webhooks/image",
"task_nickname": "blue-vase"
}'localized example textmodel localized example textgpt-image-2-6-flare-official can, fieldexactly identical.
can「localized example text+ localized example text」, dimensions:```json
{
"model": "gpt-image-2-6-flare-official",
"prompt": "after,",
"size": "16:9",
"resolution": "2k"
}
### Image-to-Imagelocalized example text`image` Image-to-Image, no Generation type.
```json{
"model": "gpt-image-2-6-sunburst-official",
"prompt": "subject, will as, and output PNG",
"image": ["https://example.com/product.png"],
"size": "1024x1024",
"background": "transparent",
"output_format": "png"
}
### Maskrepainting
Mask as Alpha PNG,, dimensions and images Reference image, must and`image` use.
```json{
"model": "gpt-image-2-6-sunburst-official",
"prompt": "onlyMask as",
"image": ["https://example.com/room.png"],
"mask": "https://example.com/mask.png",
"size": "1024x1024",
"output_format": "png"
}
### localized example text`markup` in images Reference image PNG (,, etc. ),,.dimensions and images Reference image, must and`image` use, and`mask` when.
```json{
"model": "gpt-image-2-6-sunburst-official",
"prompt": ", and",
"image": ["https://example.com/desk.png"],
"markup": "https://example.com/desk-markup.png",
"output_format": "png"
}
### GIF image`size` dimensions.GIF supported Text-to-Image, supported`image` Reference imageImage-to-Image ( supported`mask`, `markup`).
```json{
"model": "gpt-image-2-6-flare-official",
"prompt": ",,",
"output_format": "gif",
"size": "512x512",
"frame_count": 8,
"frame_duration_ms": 120
}
### SVG image
images Reference image,`svg.model` Model SVG.`n` mustas 1.
```json{
"model": "gpt-image-2-6-sunburst-official",
"prompt": "image,",
"output_format": "svg",
"quality": "medium",
"svg": {
"model": "gpt-5.4-mini",
"reasoning": { "effort": "low" }
}
}
SVG supported`image` Reference image, with image image ( supported`mask`, `markup`):
```json{
"model": "gpt-image-2-6-sunburst-official",
"prompt": "images image, subject",
"image": ["https://example.com/logo.png"],
"output_format": "svg",
"svg": { "model": "gpt-5.4-mini" }
}
### Image Editinglocalized example text**POST** `/v1/images/edits`
`Content-Type: multipart/form-data`.and,**fieldand Meaningexactly identical**, in image, Mask, File Upload, no URL or Base64.task bookingand query Methodexactly identical.
```bashcurl -X POST "https://mm-internal-cn.leonecloud.com/v1/images/edits" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-2-6-sunburst-official" \
-F "prompt=localized example text" \
-F "size=auto" \
-F "complexity=high" \
-F "output_format=png" \
-F "image=@/path/to/photo.png" \
-F "markup=@/path/to/markup.png"
## Request Parameters
### OpenAI Parameter| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `model` | string | Yes | — | `gpt-image-2-6-sunburst-official` or`gpt-image-2-6-flare-official` |
| `prompt` | string | Yes | — | image, maximum 32,000 characters|
| `n` | integer | No | `1` | Number of outputs, 1–4; `output_format=svg` when as 1|
| `size` | string | No | `auto` | `auto` or`WIDTHxHEIGHT` dimensions (`1536x864`), see below「dimensions」; `output_format=gif` when dimensions|
| `quality` | string | No | `auto` | `auto`, `low`, `medium`, `high`, `xhigh`, `max`; `auto` Model when|
| `complexity` | string | No | `high` | `low`, `medium`, `high`.when,`quality`, localized example text|
| `background` | string | No | `auto` | `auto`, `opaque`, `transparent`; `transparent` localized example text`png` or`webp` |
| `output_format` | string | No | `png` | `png`, `jpeg`, `webp`, `gif`, `svg` |
| `output_compression` | integer | No | `100` | quality 0–100, only `jpeg` / `webp`;`png` 100,`gif` / `svg` localized example text|
| `moderation` | string | No | `auto` |,`auto` () or`low` |
| `image` | string[] | No | — | Reference image (URL or Base64 data URI), up to 16 images,**Image-to-Image** |
| `mask` | string | No | — | Mask PNG (URL or Base64), must and`image` use, dimensions and images Reference image Alpha|
| `markup` | string | No | — | PNG (URL or Base64, can use`markup_url` URL), must and`image` use, and`mask` localized example text|
| `frame_count` | integer | No | `9` | only `output_format=gif`:2–16 |
| `frame_duration_ms` | integer | No | `200` | only `output_format=gif`:Duration 20–2000 seconds, 10 seconds|
| `svg` | object | SVG when Required| — | only `output_format=svg`:`svg.model` as Model (Required),`svg.reasoning.effort` Optional `none` / `minimal` / `low` / `medium` / `high` / `xhigh` / `max` |
| `safety_identifier` | string | No | — | (recommended or ), maximum 128 characters; when`user` |
| `user` | string | No | — |,`safety_identifier`; onlyin`safety_identifier` as when|
### Parameter| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `resolution` | string | `1k` | `1k`, `2k`, `4k`, and`size` (localized example text`16:9`)use;`size` as dimensions when|
| `provider` | string | localized example text| Model with`oai`,`oai` and If omitted;`az` return`code=10002` |
| `nsfw_check` | boolean | `false` | as`true` when`moderation=auto` |
| `async` | boolean | `true` | localized example text`false` image and return OpenAI image|
| `response_format` | string | `url` | **only `async=false` when**:`url` or`b64_json` |
| `callback_url` | string | — | taskcomplete after Callback URL|
| `task_nickname` | string | — | Task label, localized example text|
| `extra_body` | object | — | Modelwith Parameter; Model no with Parameter, will|
`/v1/images/edits` field and Meaning and exactly identical, in`image`, `mask`, `markup` can file (multiple imagesReference image when`image`); can use`image_urls`, `mask_url`, `markup_url` URL provide, and upload a file can.localized example text`extra_body` JSON characters.
### dimensions`size` dimensions`WIDTHxHEIGHT` when when ( and OpenAI ):
- width, height as 16;
- exceeds 3840;
- Aspect ratio in 1:3 3:1;
- in 655,360 8,294,400.exceeds`2560x1440` Resolution as.
`size` or`auto` when:Text-to-Image`1024x1024`; Image-to-Image (Mask, ) images Reference image Aspect ratio.GIF, see below.
localized example text「localized example text+ localized example text」:| `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 |
`size` localized example text`1k` / `2k` / `4k` not`resolution` when`1:1` localized example text.
**GIF localized example text`size`** dimensions:`auto` (512×512, Image-to-Imagewhen Reference image) or width and height as 16`WIDTHxHEIGHT`, localized example text.with image exceeds 3840, exceeds 8,294,400, short side exceeds 3:1, return ParameterError, when`frame_count` or dimensions.
## ParameterLimit
Limit in when, will return ParameterError ():| Limitlocalized example text| localized example text|
| --- | --- |
| `prompt` | Required, maximum 32,000 characters|
| `n` | 1–4, must; SVG as 1|
| Reference image | up to 16 images|
| `mask` / `markup` | must and`image` use,|
| `quality` | only `auto` / `low` / `medium` / `high` / `xhigh` / `max` |
| `complexity` | only `low` / `medium` / `high` |
| `output_format` | only `png` / `jpeg` / `webp` / `gif` / `svg` |
| `output_compression` | 0–100, only `jpeg` / `webp` localized example text|
| localized example text| `background=transparent` onlysupported`png`, `webp` (SVG default)|
| GIF | supported Text-to-Image and Image-to-Image;`mask`, `markup`, `output_compression` |
| SVG | supported Text-to-Image and Image-to-Image;`mask`, `markup`, `output_compression`; `n` as 1|
| `frame_count` / `frame_duration_ms` | only GIF; 2–16, 20–2000 seconds|
| `svg.model` | SVG Required, as Model, return`svg.model supported` |
| `safety_identifier` | maximum 128 characters|
| `provider` | only `oai`, If omittedas|
| output| supported;`stream=true` or`partial_images` greater than 0 returned when applicable`code=10002` |
## task booking(default)task:```json
{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_xxx",
"status": "processing",
"createdAt": "2026-11-06 18:00:00"
}
}localized example textdata.taskId after Polling query, orcallback_url complete.
Query Task
GET /v1/images/generations/{taskId}
/v1/images/generations and/v1/images/edits create task query.
curl "https://mm-internal-cn.leonecloud.com/v1/images/generations/task_xxx" \
-H "Authorization: Bearer YOUR_API_KEY"status can asprocessing, success orfailed.recommended2–5 secondsquery,.
Successwhen,result image URL list,output and OpenAIImagesResponse (image URL return ):```json
{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_xxx",
"status": "success",
"result": ["https://cdn.example.com/image.webp"],
"output": {
"created": 1793937144,
"data": [{"url": "https://cdn.example.com/image.webp"}],
"output_format": "webp",
"quality": "high",
"size": "1536x864",
"usage": {
"input_tokens": 23,
"input_tokens_details": {"image_tokens": 0, "text_tokens": 23},
"output_tokens": 824,
"output_tokens_details": {"image_tokens": 824, "text_tokens": 0},
"total_tokens": 847
}
},
"completionTokens": 847
}
}
`output` localized example text`background`, `quality` in Request (`auto`)returned when applicable; `size` as dimensions, GIF`size=auto` when return.
### usage field
| field | Description |
| --- | --- |
| `input_tokens` | input token (Prompt+ Reference image) |
| `input_tokens_details.text_tokens` | Prompt token |
| `input_tokens_details.image_tokens` | Reference image token; Text-to-Imageas 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, etc.`data.completionTokens` |
SVG taskin`output` with`svg_usage`, Model ( and OpenAI ):```json
"svg_usage": {
"model": "gpt-5.4-mini",
"input_tokens": 1180,
"output_tokens": 2350,
"reasoning_tokens": 512,
"total_tokens": 3530
}reasoning_tokens inoutput_tokens localized example text.
(async=false)
as OpenAI image, can OpenAI SDK:```json
{
"created": 1778394000,
"data": [
{ "url": "https://.../output_001.png" }
]
}
localized example text`response_format=b64_json` when,`data` as`{"b64_json":"..."}`.4K image, GIF, SVG when, when width 10 minutes.
## and`callback_url` after, task`success` or`failed` when, will HTTP POST.
token:
- input, image input, image output token,`usage`;
-`complexity`, `markup`;
- SVG:Reference image image, Model token (`svg_usage`)Model;
- GIF: return`usage`,, dimensions, output token.
Create Task when Parameter, Success after`usage`, Failuretask.localized example text`quality`, `size`,`n`, Reference image,**return token as**.
Sunburst and Flare, in as`gpt-image-2-6-sunburst-official` and`gpt-image-2-6-flare-official`.
## Errorlocalized example text**(default)**Error, HTTP Status Code as 200,`code`:| `code` | Meaning | recommended|
| --- | --- | --- |
| `0` | Success | — |
| `10002` | Parametermissing or malformed / supported model /`provider=az` / not`svg.model` | localized example text`msg` Parameter, reference「ParameterLimit」 |
| `10005` | not, API Key invalid or missing| localized example text`Authorization: Bearer` localized example text|
| `30003` | Task not found | localized example text`taskId` |
| `40001` | Insufficient balance, no complete| after|
| `40004` | localized example text| after, no|
| `90003` | localized example text| after;|
taskSuccess after if Failure, query endpoint will return`status: "failed"` and in`msg` in Failure, first will.
**(`async=false`)**OpenAI Error, and use HTTP Status Code:`400` ParameterError, `402` Insufficient balance, `500` taskexecute Failure,`504` etc. exceeds 10 minutes not image (**tasknot**, `error.code` localized example text`taskId`, can query ).API Key invalid or missingwhen in return, and:HTTP 200+ `code=10005`.
## v2 endpoint**POST** `/api/v2/open/aigc/gpt-image-2-6-official`
| localized example text| v2 endpoint| (OpenAI )|
| --- | --- | --- |
| create Path| `POST /api/v2/open/aigc/gpt-image-2-6-official` | `POST /v1/images/generations` |
| query Path| `GET /api/v2/open/aigc/{taskId}` | `GET /v1/images/generations/{taskId}` |
| localized example text| Request Body `genType` (`sunburst` / `flare`, default `sunburst`) | `model` |
| fieldlocalized example text| camelCase (when snake_case)| OpenAI field|
| Reference image | `imageUrls` / `base64File` / `base64FileList` | `image` |
| Mask / localized example text| `maskUrl` / `maskFile`; `markupUrl` / `markupFile` | `mask` / `markup` |
| Parameter| `complexity`, `safetyIdentifier`, `frameCount`, `frameDurationMs`, `svg` | snake_case|
| image| supported| supported (`async=false`) |
v2 Request Bodyfield and GPT Image 2.5 Official v2 endpoint, Description[GPT Image v2 endpoint](/docs/gpt-image-v2).