APIMPAPIMP
User GuideAI APIImage APIVideo APIPublic API

gpt-image-2.5

Call gpt-image-2.5-flare and gpt-image-2.5-sunburst through the unified async task API

GPT-Image-2.5 uses the unified asynchronous task API. Submit a task to /api/generate/submit, save the returned platform task_id, then poll /api/generate/status/:task_id for the result.

  • gpt-image-2.5-flare prioritizes speed for everyday generation, batches, and rapid prototyping.
  • gpt-image-2.5-sunburst prioritizes editing precision for product imagery and production-ready creative work.
  • Put every request parameter at the top level of the JSON body. Reference images must be public HTTP(S) URLs.
  • n accepts 1–4. When multiple images are generated, data.files contains every result.

Both models support localized editing with mask_url, accepting a public HTTP(S) URL or PNG Data URL. The mask must have an alpha channel and match the first reference image; fully transparent areas mark edits. image and images together accept up to 16 references. Masks have no effect without a reference image.

POST
/api/generate/submit

Authorization

BearerAuth

AuthorizationBearer <token>

使用用户令牌认证:Authorization: Bearer sk-xxxxxx

In: header

Request Body

application/json

model*string

Flare 速度优先;Sunburst 编辑精度优先。

Value in"gpt-image-2.5-flare" | "gpt-image-2.5-sunburst"
prompt*string

生成或编辑指令,必填。

size?string

输出比例或精确像素尺寸。支持 auto、1:1、3:2、2:3、4:3、3:4、5:4、4:5、16:9、9:16、2:1、1:2、21:9、9:21、3:1、1:3,或如 1600x1200。

Default"auto"
resolution?string

比例尺寸的分辨率档位;精确像素尺寸下会被上游忽略。

Default"1k"
Value in"1k" | "2k" | "4k"
quality?string
Default"auto"
Value in"auto" | "low" | "medium" | "high" | "xhigh" | "max"
n?integer

生成图片数量。

Default1
Range1 <= value <= 4
output_format?string
Default"png"
Value in"png" | "jpeg" | "webp"
output_compression?integer

仅对 jpeg 或 webp 生效,其他格式忽略;0 会被正常透传。

Range0 <= value <= 100
background?string

transparent 仅可搭配 png 或 webp。

Value in"transparent" | "opaque" | "auto"
moderation?string
Default"low"
Value in"auto" | "low"
image?string

单张公网 HTTP(S) 参考图 URL。

Formaturi
images?array<string>

多张公网 HTTP(S) 参考图 URL;与 image 合计最多 16 张,image 排在最前。

Itemsitems <= 16
mask_url?string

Flare 和 Sunburst 均支持。接受公网 HTTP(S) URL 或 data:image/png;base64,...,仅提供参考图时生效。须为带 Alpha 通道的 PNG,尺寸与第一张参考图一致,alpha=0 区域用于修改;多参考图时仅作用于第一张,不保证蒙版外像素完全不变。调用方保证格式、尺寸与可访问性。建议小于 4 MB,非已验证硬上限。

callback_url?string

可选。任务终态时由平台 POST 的回调地址。

Formaturi
[key: string]?never

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.apimp.ai/api/generate/submit" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-image-2.5-sunburst",    "prompt": "仅将蒙版透明区域替换为金色丝带",    "images": [      "https://example.com/product.png"    ],    "mask_url": "https://example.com/mask.png",    "quality": "xhigh"  }'
{
  "code": 200,
  "data": {
    "task_id": "task_01KXXXXXXXXXXXXXXX",
    "status": "not_started",
    "created_time": "2026-09-09T10:30:00",
    "error_message": null
  }
}
{
  "code": 400,
  "error": {
    "message": "string",
    "type": "invalid_request_error"
  }
}
{
  "code": 400,
  "error": {
    "message": "string",
    "type": "invalid_request_error"
  }
}
{
  "code": 400,
  "error": {
    "message": "string",
    "type": "invalid_request_error"
  }
}
{
  "code": 400,
  "error": {
    "message": "string",
    "type": "invalid_request_error"
  }
}
{
  "code": 400,
  "error": {
    "message": "string",
    "type": "invalid_request_error"
  }
}

How is this guide?

Last updated on