# ChatGPT Images 2.6 API ChatGPT Images 2.6 Flare 和 Sunburst 模型的完整 API 参考文档。 ## 模型版本 此 API 支持四种模型版本: | 模型 | ID | 说明 | |-------|-----|-------------| | **ChatGPT Images 2.6 Flare** | `gpt-image-2.6-flare` | 支持分辨率和质量控制的文生图 | | **ChatGPT Images 2.6 Flare Edit** | `gpt-image-2.6-flare-edit` | 图像编辑与多图合成 | | **ChatGPT Images 2.6 Sunburst** | `gpt-image-2.6-sunburst` | 支持分辨率和质量控制的文生图 | | **ChatGPT Images 2.6 Sunburst Edit** | `gpt-image-2.6-sunburst-edit` | 图像编辑与多图合成 | ## 快速对比 Flare 和 Sunburst 具有以下相同的请求选项。 | 功能 | Flare / Sunburst | Flare Edit / Sunburst Edit | |---------|-----------------|---------------------------| | 输入 | 文本提示词 | 图像 + 文本提示词 | | 分辨率选项 | `1k`, `2k`, `4k` | `1k`, `2k`, `4k` | | 质量选项 | `low`, `medium`, `high`, `xhigh`, `max` | `low`, `medium`, `high`, `xhigh`, `max` | | 默认质量 | `medium` | `medium` | | 宽高比 | 10 种选项 | 10 种选项 | | 图像输入 | 无 | 必填(1–16 张图像) | | 输出格式 | `png`, `jpeg`, `webp`, `gif`, `svg` | `png`, `jpeg`, `webp` | | 默认输出格式 | `png` | `png` | ### 支持的宽高比 `16:9`, `9:16`, `1:1`, `3:2`, `2:3`, `3:4`, `4:3`, `5:4`, `4:5`, `21:9` ## ChatGPT Images 2.6 Flare (文生图) ### 端点 ``` POST /api/v1/image/task ``` ### 身份验证 ``` Authorization: Bearer YOUR_API_KEY ``` ### 请求参数 #### 必填 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `model_name` | string | 必须为 `"gpt-image-2.6-flare"` | | `prompt` | string | 图像生成提示词 | | `width` | integer | 宽度比例值,例如 `16:9` 中的 `16`;不是像素尺寸 | | `height` | integer | 高度比例值,例如 `16:9` 中的 `9`;不是像素尺寸 | | `resolution` | string | `"1k"`, `"2k"`、或 `"4k"` | width:height 比例必须与上方列出的某个支持的宽高比一致。 #### 可选 | 参数 | 类型 | 默认值 | 说明 | |-----------|------|---------|-------------| | `quality` | string | `"medium"` | `"low"`, `"medium"`, `"high"`, `"xhigh"`、或 `"max"` | | `output_format` | string | `"png"` | 输出格式: `"png"`, `"jpeg"`, `"webp"`, `"gif"`、或 `"svg"`。GIF 动画使用 `"gif"`,SVG 矢量输出使用 `"svg"` | | `frame_count` | integer | `9` | GIF 帧数,范围为 `2` 到 `16`。仅在 `output_format` 为 `"gif"` 时适用 | | `frame_duration_ms` | integer | `200` | GIF 每帧时长,以毫秒为单位,范围为 `20` 到 `2000`。仅在 `output_format` 为 `"gif"` 时适用 | ### 请求示例 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/image/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'gpt-image-2.6-flare', prompt: 'A looping animation of steam rising from a ceramic mug on a pale stone table, warm studio lighting', width: 1, height: 1, resolution: '1k', quality: 'medium', output_format: 'gif', frame_count: 9, frame_duration_ms: 200 }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## ChatGPT Images 2.6 Flare Edit (图像编辑) ### 端点 ``` POST /api/v1/image/task ``` ### 请求参数 #### 必填 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `model_name` | string | 必须为 `"gpt-image-2.6-flare-edit"` | | `prompt` | string | 所需编辑的描述 | | `image_url_list` | string[] | 输入图像的 URL;至少 1 张、最多 16 张,每张小于 50 MB | | `width` | integer | 宽度比例值,例如 `16:9` 中的 `16`;不是像素尺寸 | | `height` | integer | 高度比例值,例如 `16:9` 中的 `9`;不是像素尺寸 | | `resolution` | string | `"1k"`, `"2k"`、或 `"4k"` | width:height 比例必须与上方列出的某个支持的宽高比一致。 #### 可选 | 参数 | 类型 | 默认值 | 说明 | |-----------|------|---------|-------------| | `quality` | string | `"medium"` | `"low"`, `"medium"`, `"high"`, `"xhigh"`、或 `"max"` | | `output_format` | string | `"png"` | 输出格式: `"png"`, `"jpeg"`、或 `"webp"` | ### 请求示例 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/image/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'gpt-image-2.6-flare-edit', prompt: 'Replace the background with a warm studio setting while keeping the product unchanged', image_url_list: ['https://example.com/product-photo.jpg'], width: 1, height: 1, resolution: '1k', quality: 'medium', output_format: 'png' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## ChatGPT Images 2.6 Sunburst (文生图) ### 端点 ``` POST /api/v1/image/task ``` ### 请求参数 #### 必填 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `model_name` | string | 必须为 `"gpt-image-2.6-sunburst"` | | `prompt` | string | 图像生成提示词 | | `width` | integer | 宽度比例值,例如 `16:9` 中的 `16`;不是像素尺寸 | | `height` | integer | 高度比例值,例如 `16:9` 中的 `9`;不是像素尺寸 | | `resolution` | string | `"1k"`, `"2k"`、或 `"4k"` | width:height 比例必须与上方列出的某个支持的宽高比一致。 #### 可选 | 参数 | 类型 | 默认值 | 说明 | |-----------|------|---------|-------------| | `quality` | string | `"medium"` | `"low"`, `"medium"`, `"high"`, `"xhigh"`、或 `"max"` | | `output_format` | string | `"png"` | 输出格式: `"png"`, `"jpeg"`, `"webp"`, `"gif"`、或 `"svg"`。GIF 动画使用 `"gif"`,SVG 矢量输出使用 `"svg"` | | `frame_count` | integer | `9` | GIF 帧数,范围为 `2` 到 `16`。仅在 `output_format` 为 `"gif"` 时适用 | | `frame_duration_ms` | integer | `200` | GIF 每帧时长,以毫秒为单位,范围为 `20` 到 `2000`。仅在 `output_format` 为 `"gif"` 时适用 | ### 请求示例 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/image/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'gpt-image-2.6-sunburst', prompt: 'A looping animation of steam rising from a ceramic mug on a pale stone table, warm studio lighting', width: 1, height: 1, resolution: '1k', quality: 'medium', output_format: 'gif', frame_count: 9, frame_duration_ms: 200 }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## ChatGPT Images 2.6 Sunburst Edit (图像编辑) ### 端点 ``` POST /api/v1/image/task ``` ### 请求参数 #### 必填 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `model_name` | string | 必须为 `"gpt-image-2.6-sunburst-edit"` | | `prompt` | string | 所需编辑的描述 | | `image_url_list` | string[] | 输入图像的 URL;至少 1 张、最多 16 张,每张小于 50 MB | | `width` | integer | 宽度比例值,例如 `16:9` 中的 `16`;不是像素尺寸 | | `height` | integer | 高度比例值,例如 `16:9` 中的 `9`;不是像素尺寸 | | `resolution` | string | `"1k"`, `"2k"`、或 `"4k"` | width:height 比例必须与上方列出的某个支持的宽高比一致。 #### 可选 | 参数 | 类型 | 默认值 | 说明 | |-----------|------|---------|-------------| | `quality` | string | `"medium"` | `"low"`, `"medium"`, `"high"`, `"xhigh"`、或 `"max"` | | `output_format` | string | `"png"` | 输出格式: `"png"`, `"jpeg"`、或 `"webp"` | ### 请求示例 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/image/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'gpt-image-2.6-sunburst-edit', prompt: 'Replace the background with a warm studio setting while keeping the product unchanged', image_url_list: ['https://example.com/product-photo.jpg'], width: 1, height: 1, resolution: '1k', quality: 'medium', output_format: 'png' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## 响应格式 ### 初始响应 ChatGPT Images 2.6 的四种版本均返回用于轮询的 `task_id`: ```json { "code": 0, "data": { "task_id": "{task_id}", "task_status": "submitted", "response_url": "https://api.flaq.ai/api/v1/image/{task_id}" }, "message": "success" } ``` ### 轮询响应 轮询 `GET /api/v1/image/{task_id}` 以检查状态: ```json { "code": 0, "data": { "task_id": "{task_id}", "task_status": "succeed", "task_status_msg": null, "response_url": "https://api.flaq.ai/api/v1/image/{task_id}", "task_result": { "credit": 0.0997, "images": [ { "url": "https://example.com/generated-image.jpeg" } ] } }, "message": "success" } ``` ### 状态值 - `submitted`: 任务已接受 - `processing`: 正在生成或编辑图像 - `succeed`: 任务成功完成 - `failed`: 任务失败 ## 处理时间 处理时间因模型、输出设置、提示词复杂程度和参考图像数量而异。请持续轮询,直到任务状态为 `succeed` 或 `failed`;已提交或处理中的任务可能尚未包含图像结果。 ## 最佳实践 1. **明确描述构图**:提示词清晰描述主体、取景、光线和预期风格时,ChatGPT Images 2.6 的效果最佳。 2. **根据发布场景选择宽高比**:为社交帖子、横幅、产品页面或编辑排版预先设置比例。 3. **使用清晰的原图进行编辑**:清晰、光线良好的输入图像有助于保持主体身份特征,并提高局部编辑质量。 4. **多图请求仅使用有效参考图**:对于编辑请求,仅提供相关图像,避免视觉指引相互冲突。