modelsell.app 文档
图片系列OpenAI Images

OpenAI GPT Image 2.5

GPT Image 2.5 Sunburst 与 Flare 的生成、编辑、透明背景、涂鸦、请求参数与流式输出说明,并链接独立的 2.6 对接文档。

GPT Image 2.5 包含 gpt-image-2.5-sunburst 和 gpt-image-2.5-flare。Sunburst 适合注重细节和编辑精度的任务,Flare 适合快速迭代。本文按 2026-11-06 的 OpenAI 官方说明整理。

接入 2.6 请阅读独立的 GPT Image 2.6 对接说明,其中包含 complexity、GIF 帧参数、SVG 作者配置和完整示例。两代模型 ID 分开使用,不能只根据共用接口的字段枚举推断所有能力相同。

模型与接口

模型固定快照
gpt-image-2.5-sunburstgpt-image-2.5-sunburst-2026-09-08
gpt-image-2.5-flaregpt-image-2.5-flare-2026-09-08
操作地址与请求格式
生成图片POST https://api.modelsell.com/v1/images/generations,JSON
编辑图片POST https://api.modelsell.com/v1/images/edits,multipart 或 JSON

使用 Authorization: Bearer $MODELSELL_API_KEY。显式传入模型名称,普通请求返回 data[].b64_json,不传旧版 response_format。

参数

参数类型默认值说明
modelstring显式指定上表中的模型或固定快照。
promptstring必填生成或编辑要求,最多 32,000 个字符。
ninteger1生成数量,1–10。
sizestringautoauto 或符合下述约束的 宽x高。
qualitystringautolow、medium、high、xhigh、max、auto。
backgroundstringautoauto、opaque、transparent;透明背景使用 PNG/WebP。
output_formatstringpng静态输出使用 png、jpeg 或 webp。
output_compressioninteger100JPEG/WebP 专用,0–100。
moderationstringautoauto 或 low。
streambooleanfalse开启 SSE 流式输出。
partial_imagesinteger0流式预览数量,0–3;0 只返回最终图片,实际预览数可能少于请求数。
safety_identifierstring省略最多 128 个字符的稳定用户标识,建议使用哈希值。
userstring省略已弃用;仅在 safety_identifier 省略、为 null 或空字符串时作为回退值。
image文件 / 文件数组编辑必填multipart 底图字段;多图使用 image[]。
images引用对象数组编辑必填JSON 底图字段,每个对象使用 image_url 或 file_id。与 multipart 的 image 选择对应请求格式使用。
mask文件 / 引用对象省略带透明通道的 PNG 遮罩,匹配第一张底图尺寸;透明区域用于指定编辑区域。
markup文件 / 引用对象省略在第一张底图上叠加的独立透明 PNG 涂鸦层;与 mask 互斥。

2.6 的 complexity、frame_count、frame_duration_ms、svg 等字段和格式约束在 2.6 参数表 中单独说明。

尺寸与透明背景

常用尺寸为 1024x1024、1536x1024、1024x1536。2.5 自定义尺寸满足:两边均为 16 的倍数、宽高比在 1:3 到 3:1 之间、任一边不超过 3840 像素、总像素在 655,360 到 8,294,400 之间。高于 2560x1440 像素量的分辨率属于实验性范围。

background: "transparent" 搭配 output_format: "png" 或 "webp",保存结果时保留 Alpha 通道。JPEG 不支持透明背景;PNG 请求省略 output_compression。

生成示例

curl --fail-with-body -sS https://api.modelsell.com/v1/images/generations \
  -H "Authorization: Bearer $MODELSELL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.5-flare",
    "prompt": "一个深蓝色陶瓷杯,独立主体,完全透明背景,没有阴影",
    "size": "1024x1024",
    "quality": "high",
    "background": "transparent",
    "output_format": "png",
    "n": 1
  }' > result.json

编辑与涂鸦示例

底图支持 PNG、JPEG/JPG、WebP,每张小于 50 MB,最多 16 张。底图无需全部转换为 PNG。使用 markup 时,覆盖层必须含透明像素,且与第一张底图方向校正后的宽高一致;第一张底图和涂鸦层各不超过 16,777,216 像素,涂鸦层文件不超过 50 MB。不要同时发送 mask 或 prompt_rewriter。

curl --fail-with-body -sS https://api.modelsell.com/v1/images/edits \
  -H "Authorization: Bearer $MODELSELL_API_KEY" \
  -F 'model=gpt-image-2.5-sunburst' \
  -F '[email protected];type=image/webp' \
  -F '[email protected];type=image/png' \
  -F 'prompt=把红圈中的椅子改为绿色,移除标记,保持其他内容不变' \
  -F 'quality=high' \
  -F 'output_format=png' > result.json

不需要涂鸦引导时省略 markup。JSON 编辑使用下面的对象结构,发送到 /v1/images/edits:

{
  "model": "gpt-image-2.5-flare",
  "prompt": "保留产品外观,将背景换成柔和的浅灰色",
  "images": [
    { "image_url": "https://example.com/product.jpg" }
  ],
  "output_format": "png"
}

引用对象支持 HTTPS URL、Base64 data URL 或 Files API 的 file_id。每个对象仅提供 image_url 和 file_id 中的一个;mask、markup 的 JSON 形式也各使用一个引用对象。

结果与流式输出

import base64
import json
from pathlib import Path

result = json.loads(Path("result.json").read_text())
Path("result.png").write_bytes(base64.b64decode(result["data"][0]["b64_json"]))

非流式响应还可包含 created、size、quality、background、output_format、usage 和有效的 safety_identifier。

设置 stream: true 后按 SSE 读取:生成事件为 image_generation.partial_image / image_generation.completed,编辑事件为 image_edit.partial_image / image_edit.completed。每个事件直接携带 b64_json;最终结果以 completed 事件为准。partial_images: 0–3 控制预览数量,记录最终返回的 usage。

官方参考

On this page