> ## 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.