# 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. **多圖請求僅使用有效參考圖**:對於編輯請求,僅提供相關影像,避免視覺指引相互衝突。