OpenAI 11 月 4 日发布 GPT-Image-2.6 Sunburst 与 Flare 之后,Image API 里 GIF、SVG 和 markup 编辑的请求 JSON 该怎么写?

截至 2026 年 11 月 5 日:generations 用 output_format gif/svg 与 frame_*;edits 用 markup 对象。GPT 图像模型只返回 b64_json,勿传 response_format url。

先给结论:2026 年 11 月 4 日 OpenAI 在 Image API 上线 gpt-image-2.6-sunburst 与 gpt-image-2.6-flare。生成仍走 POST /v1/images/generations,编辑走 POST /v1/images/edits。2.6 在 2.5 之上新增可调 complexity、output_format: svg|gif,以及 2.5/2.6 都支持的 markup 标注层编辑。GPT 图像模型响应始终是 data[].b64_json,不要传已退役的 response_format: url。

这篇按 2026 年 11 月 5 日写,依据 11 月 4 日 changelog 与 Image generation / Image prompting 指南。两天前本站写过《Anthropic message threads》——那边是 Messages 增量 JSON;这边是图像端点里新增输出格式与编辑字段。若你仍在 2.5 快照上跑通流程,把 model 换成 2.6 并单独为 GIF/SVG/markup 建 JSON Schema 即可。

Sunburst 与 Flare 及共用字段

gpt-image-2.6-flare 偏延迟;gpt-image-2.6-sunburst 偏细节与编辑精度。两者都支持 complexity(low / medium / high,省略时文档默认 high)、quality(至 max)、透明 background,以及 raster 的 png / jpeg / webp。

{
  "model": "gpt-image-2.6-flare",
  "prompt": "Flat vector icon of a lantern, centered",
  "size": "1024x1024",
  "quality": "high",
  "complexity": "medium",
  "output_format": "png",
  "n": 1
}

仅 Image API 直接设 model;Responses 里图像工具仍用 2.5/2.6 模型 id 写在 tool 的 model 字段。Chat Completions 不支持这两个 2.6 快照。

GIF 生成请求 JSON

只在 /v1/images/generations 设 output_format: "gif";编辑端点不支持 GIF。用 frame_count(2–64,默认 9)与 frame_duration_ms(20–2000,默认 200,编码时四舍五入到 10 ms)控制动画。GIF 不支持 streaming、partial images、output_compression 或 prompt_rewriter。

{
  "model": "gpt-image-2.6-sunburst",
  "prompt": "Paper lantern swaying in a loop, same start and end pose",
  "output_format": "gif",
  "frame_count": 9,
  "frame_duration_ms": 200,
  "size": "1024x1024",
  "n": 1
}

size 描述每一帧的像素;帧数 × 单帧尺寸 × n 不能超过模型总像素预算。超限时优先减 frame_count 或尺寸,或用 auto 让 API 选合法帧大小。账户需具备所选模型的 GIF 预览权限。

SVG 生成请求 JSON

同样在 generations 上设 output_format: "svg"。n 必须为 1。SVG 不支持 streaming、partial、output_compression、prompt_rewriter,且不能作为 raster 编辑输入。解码 data[0].b64_json 得到 UTF-8 XML;返回的是静态矢量,不含脚本或外链资源。

{
  "model": "gpt-image-2.6-sunburst",
  "prompt": "Minimal bakery logo, wheat and rolling pin, single color",
  "output_format": "svg",
  "quality": "high",
  "complexity": "high",
  "size": "1024x1024"
}

响应可能带 svg_usage(SVG 作者模型的 token),与 raster 的 usage 分开;对账时不要把两类 usage 混进同一 JSON Schema。

markup 引导编辑 JSON

2.5 与 2.6 Sunburst/Flare 在 /v1/images/edits 支持 markup:与第一张输入图等大的透明 PNG 标注层。JSON 请求用 images 数组放底图;markup 为对象,且恰好包含 image_url 或 file_id 之一(可 HTTPS 或 base64 data URL)。

{
  "model": "gpt-image-2.6-flare",
  "prompt": "Replace the circled vase with blue ceramic, keep kitchen lighting",
  "images": [
    {"image_url": "https://cdn.example/kitchen.webp"}
  ],
  "markup": {
    "image_url": "data:image/png;base64,iVBORw0KGgo..."
  },
  "size": "1536x1024"
}

markup 不能与 mask 或 prompt_rewriter 同请求。标注只作用于第一张输入图;额外 images 条目作参考。Multipart 上传时 markup 是文件字段——那种形态没有 JSON 体,别和上面的 JSON 示例混在一个 Schema 里。

响应 JSON 与 usage

成功响应顶层有 created(Unix 秒)与 data 数组。每项至少含 b64_json;GIF/SVG 同样走 base64,客户端解码后写 .gif 或 .svg。GPT 图像模型不返回 revised_prompt 或 url。

用户可修正错误可能带 error.type: image_generation_user_error 与稳定 error.code(如 moderation_blocked,可选 moderation_details)。这类错误不要原样重试——改 prompt 或输入后再发。

本地校验请求体

建议至少四套 Schema:generations/raster、generations/gif、generations/svg、edits/markup-json。用 JSON 校验 抓 frame_count 出现在非 GIF 请求、或 markup 对象同时含 image_url 与 file_id 等组合错误。

常见问题 FAQ

2.6 能在 Responses API 里直接当顶层 model 吗?

不能。2.6 只挂在 Image API 的 generations/edits;Responses 仍在 tool 里指定 gpt-image-2.6-*。

编辑端点能输出 GIF 或 SVG 吗?

不能。GIF 与 SVG 仅 generations;编辑只出 raster。

还能用 response_format url 吗?

GPT 图像模型不支持;传了也会被忽略或报错。只用 b64_json。

markup 和 mask 能一起传吗?

不能。二选一;markup 是透明 PNG 标注,mask 是另一套编辑语义。

frame_count 在编辑 JSON 里合法吗?

不合法。仅 output_format 为 gif 的 generations 请求可用。

和 ChatGPT 里一键 GIF 是同一 JSON 吗?

产品 UI 封装了 prompt;API 仍需显式 output_format 与帧参数,并受组织权限约束。

总结

11 月 4 日的 2.6 把「模型 id + complexity」与「output_format / frame_* / markup」拆清楚:Sunburst/Flare 选延迟还是精度,JSON Schema 按 generations 与 edits 分表校验。