ChatGPT Images 2.5 API
ChatGPT Images 2.5 Client、Flare 和 Sunburst 模型的完整 API 参考文档。
模型版本
此 API 支持六个可用的模型版本:
快速对比
Flare 和 Sunburst 共用以下请求选项。Client 版本保留原有选项,详见第二张表。
支持的宽高比
16:9, 9:16, 1:1, 3:2, 2:3, 3:4, 4:3, 5:4, 4:5, 21:9
ChatGPT Images 2.5 Client(文生图)
接口地址
POST /api/v1/image/task
身份验证
Authorization: Bearer YOUR_API_KEY
请求参数
必填参数
注意: 宽高比必须为以下选项之一:16:9、9:16、1:1、3:2、2:3、3:4、4:3、5:4、4:5、21:9
请求示例
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: 'chatgpt-images-2.5-client',
prompt: 'A minimalist product shot of a ceramic mug on marble, soft studio light',
width: 1,
height: 1,
resolution: '1k'
})
});
const { data } = await response.json();
const taskId = data.task_id;
const pollResponse = await fetch(
`https://api.flaq.ai/api/v1/image/${taskId}`,
{
headers: { Authorization: 'Bearer YOUR_API_KEY' }
}
);
const result = await pollResponse.json();
console.log(result.data.task_result.images[0].url);
ChatGPT Images 2.5 Edit Client(图像编辑)
接口地址
POST /api/v1/image/task
请求参数
必填参数
注意: 宽高比必须为以下选项之一:16:9、9:16、1:1、3:2、2:3、3:4、4:3、5:4、4:5、21:9
单图编辑示例
{
model_name: 'chatgpt-images-2.5-edit-client',
prompt: 'Replace the background with a clean studio scene and brighten the product lighting',
image_url_list: ['https://example.com/product-photo.jpg'],
width: 16,
height: 9,
resolution: '1k'
}
多图合成示例
{
model_name: 'chatgpt-images-2.5-edit-client',
prompt: 'Blend these reference images into a polished campaign composition while keeping the main subject identity consistent',
image_url_list: [
'https://example.com/image1.jpg',
'https://example.com/image2.jpg',
'https://example.com/image3.jpg'
],
width: 16,
height: 9,
resolution: '1k'
}
ChatGPT Images 2.5 Flare(文生图)
接口地址
POST /api/v1/image/task
请求参数
必填参数
宽高比必须与上文列出的某个受支持宽高比一致。
可选参数
请求示例
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.5-flare',
prompt: 'A ceramic mug on a pale stone table, warm studio lighting, minimal composition',
width: 1,
height: 1,
resolution: '1k',
quality: 'medium'
})
});
const { data } = await response.json();
const taskId = data.task_id;
ChatGPT Images 2.5 Flare Edit(图像编辑)
接口地址
POST /api/v1/image/task
请求参数
必填参数
宽高比必须与上文列出的某个受支持宽高比一致。
可选参数
请求示例
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.5-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'
})
});
const { data } = await response.json();
const taskId = data.task_id;
ChatGPT Images 2.5 Sunburst(文生图)
接口地址
POST /api/v1/image/task
请求参数
必填参数
宽高比必须与上文列出的某个受支持宽高比一致。
可选参数
请求示例
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.5-sunburst',
prompt: 'A ceramic mug on a pale stone table, warm studio lighting, minimal composition',
width: 1,
height: 1,
resolution: '1k',
quality: 'medium'
})
});
const { data } = await response.json();
const taskId = data.task_id;
ChatGPT Images 2.5 Sunburst Edit(图像编辑)
接口地址
POST /api/v1/image/task
请求参数
必填参数
宽高比必须与上文列出的某个受支持宽高比一致。
可选参数
请求示例
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.5-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'
})
});
const { data } = await response.json();
const taskId = data.task_id;
响应格式
初始响应
ChatGPT Images 2.5 的全部六个版本都会返回用于轮询的 task_id:
{
"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} 检查状态:
{
"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;处于已提交或处理中状态的任务可能尚未包含图像结果。
最佳实践
- 明确描述构图:提示词清楚描述主体、取景、光照和预期风格时,ChatGPT Images 2.5 的表现最佳。
- 使宽高比匹配发布目标:为社交媒体帖子、横幅、产品页面或编辑版式预先设置宽高比。
- 使用清晰的源图进行编辑:清晰、光照良好的输入图像有助于保留主体身份特征并提升局部编辑质量。
- 多图请求只使用有帮助的参考图:编辑请求中仅提供相关图像,避免相互冲突的视觉引导。