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 的表現最佳。
- 讓長寬比符合發佈用途:為社群貼文、橫幅、產品頁面或編輯版面預先設定長寬比。
- 使用清晰的原始圖像進行編輯:清晰且光線良好的輸入圖像,有助於保留主體身分特徵並提升局部編輯品質。
- 多圖請求僅使用有幫助的參考圖:編輯請求只提供相關圖像,避免互相衝突的視覺引導。