> ## Documentation Index
> Fetch the complete documentation index at: https://docs.acedata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# GPT Image 2.6 API

> OpenAI generation 整合指南 - Ace Data Cloud

使用 GPT Image 2.6 從文字產生圖片，或根據參考圖片進行編輯。先選擇公開型號，再使用同一套圖像 API 串接。

## 選擇型號

| 型號 | 選擇與呼叫入口 |
| - | - |
| `gpt-image-2.6-flare` | Flare 型號，查看對應模型頁面的能力、價格和最小請求 |
| `gpt-image-2.6-sunburst` | Sunburst 型號，查看對應模型頁面的能力、價格和最小請求 |
| `:official` 與 `:reverse` 變體 | 模型 ID 後綴屬於公開呼叫名稱，各變體的費用與支援參數以該型號頁面為準 |

* [Flare](https://platform.acedata.cloud/models/gpt-image-2.6-flare?m=image) · [Flare official](https://platform.acedata.cloud/models/gpt-image-2.6-flare%3Aofficial?m=image) · [Flare reverse](https://platform.acedata.cloud/models/gpt-image-2.6-flare%3Areverse?m=image)
* [Sunburst](https://platform.acedata.cloud/models/gpt-image-2.6-sunburst?m=image) · [Sunburst official](https://platform.acedata.cloud/models/gpt-image-2.6-sunburst%3Aofficial?m=image) · [Sunburst reverse](https://platform.acedata.cloud/models/gpt-image-2.6-sunburst%3Areverse?m=image)

## 準備圖像生成請求

在[應用程式列表](https://platform.acedata.cloud/console/applications)開啟通用應用程式，點擊 **API KEY** 右側的複製按鈕。接下來用這個 Key 產生一張圖片。使用受限金鑰時，請確認它允許圖像生成；編輯參考圖片還需要圖像編輯權限。

## 產生第一張圖片

```bash theme={null}
export ACEDATACLOUD_API_KEY="YOUR_API_KEY"
curl --fail-with-body 'https://api.acedata.cloud/openai/images/generations' \
  --header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-image-2.6-flare",
    "prompt": "A white ceramic coffee mug on a blue table, soft morning light, no text.",
    "size": "1024x1024",
    "n": 1,
    "response_format": "url"
  }'
```

### 回應 JSON

以下節錄既有的 Images 回應，展示任務識別碼、模型和圖片 URL 的位置。你選擇的模型和圖片網址以本次請求的回傳值為準。

```json theme={null}
{
  "success": true,
  "task_id": "49848451-c624-4df9-9dc2-494018daaf4c",
  "trace_id": "5ac021c2-2891-4eed-bfcf-4c6668ac1be1",
  "created": 1788831893,
  "data": [
    {
      "url": "https://cdn.acedata.cloud/assets/examples/gpt-image/49848451-c624-4df9-9dc2-494018daaf4c_0-b6d780a732ca.png"
    }
  ]
}
```

同步回傳後從 `data[].url` 讀取產生的圖片。需要調整畫幅、品質或輸出格式時，查看[圖像生成指南](https://platform.acedata.cloud/documents/openai-images-generations-integration)。選擇 `b64_json` 回傳格式時，依照指南解碼對應結果。

## 編輯參考圖片

把 `YOUR_IMAGE_URL` 替換為可存取的參考圖片網址，再描述要修改的內容。

```bash theme={null}
curl --fail-with-body 'https://api.acedata.cloud/openai/images/edits' \
  --header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-image-2.6-flare",
    "image": "YOUR_IMAGE_URL",
    "prompt": "Change the mug to dark green and keep the composition.",
    "n": 1,
    "response_format": "url"
  }'
```

### 回應 JSON

以下節錄既有的 Images 回應，展示任務識別碼、模型和圖片 URL 的位置。你選擇的模型和圖片網址以本次請求的回傳值為準。

```json theme={null}
{
  "success": true,
  "task_id": "49848451-c624-4df9-9dc2-494018daaf4c",
  "trace_id": "5ac021c2-2891-4eed-bfcf-4c6668ac1be1",
  "created": 1788831893,
  "data": [
    {
      "url": "https://cdn.acedata.cloud/assets/examples/gpt-image/49848451-c624-4df9-9dc2-494018daaf4c_0-b6d780a732ca.png"
    }
  ]
}
```

編輯結果同樣從 `data[].url` 讀取。多圖、遮罩、尺寸和格式的輸入要求請參閱[圖像編輯指南](https://platform.acedata.cloud/documents/openai-images-edits-integration)。

## 長時間任務與錯誤復原

需要非同步方式時，依照圖像介面文件設定 `async=true` 並儲存回傳的任務識別碼。使用 [OpenAI 任務查詢](https://platform.acedata.cloud/documents/openai-tasks-integration)取得原任務的最終結果，避免等待時重複提交。驗證、餘額和參數錯誤依照回應中的 `error` 處理，保留 `trace_id` 以便排查。

完整呼叫範例和更多能力入口請參閱 [OpenAIAPI](https://github.com/AceDataCloud/OpenAIAPI)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.