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

# GPT Image 2.6 Flare API：图像生成与编辑

> 通过 APIXO 使用 GPT Image 2.6 Flare 生成和编辑图像，支持 GIF 和 SVG 生成、有序参考图像以及蒙版或标记编辑。

## 概览

GPT Image 2.6 Flare 是一个异步 API，用于文生图生成和参考引导的图像编辑。每个成功任务将返回一个文件。

| 功能 | 值 |
| - | - |
| 模型 ID | `gpt-image-2.6-flare` |
| 模式 | `text-to-image`, `image-to-image` |
| 输出格式 | 两种模式下均支持 PNG、JPEG、WebP、GIF 和 SVG。 |
| 参考图片 | `image-to-image` 中支持 1–16 个排序的 URL。GIF 编辑使用单个 URL。 |
| 编辑指南 | PNG、JPEG 和 WebP 编辑时，可在第一个参考图像上添加一个可选的蒙版或标记。 |
| 分辨率档位 | `1k`, `2k`, `4k` |
| 质量等级 | `low`, `medium`, `high`, `xhigh`, `max` |

## 端点和身份验证

API 基础地址：

```text theme={null}
https://api.apixo.ai/api/v1
```

| 方法 | 端点 | 用途 |
| - | - | - |
| `POST` | `/generateTask/gpt-image-2.6-flare` | 创建图像任务 |
| `GET` | `/statusTask/gpt-image-2.6-flare?taskId={taskId}` | Read取任务状态和结果 |

使用`Authorization: Bearer YOUR_API_KEY`和`Content-Type: application/json`。

## 快速入门

生成具有自定义尺寸的图像。此示例请求 2304 × 1536 像素并使用 2K 计费层。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/gpt-image-2.6-flare" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mode":"text-to-image","prompt":"A botanical illustration of a fern","size":"2304x1536"}}'
```

生成GIF：

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/gpt-image-2.6-flare" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mode":"text-to-image","prompt":"A paper boat rocking gently in a seamless loop","output_format":"gif","frame_count":9}}'
```

对于SVG，将`output_format`设置为`svg`。要使用带注释的指南编辑参考图像，请提交以下请求体：

```json theme={null}
{
  "input": {
    "mode": "image-to-image",
    "prompt": "Replace the circled object with a blue vase.",
    "image_urls": ["https://example.com/room.png"],
    "markup_url": "https://example.com/markup.png"
  }
}
```

## 参数

**request\_type** `string` (default: async)

使用 `async` 轮询结果或使用 `callback` 进行 Webhook 传递。

**callback\_url** `string`

接收最终任务负载的公开 HTTPS URL。当`request_type`为`callback`时需要。请参阅 [Webhooks](https://apixo.ai/docs/zh/api-reference/webhooks.md)。

**input** `object` *required*

GPT Image 2.6 Flare 的输入参数。

**属性**

**mode** `string` *required*

生成模式。使用 `text-to-image` 或 `image-to-image`。

**prompt** `string` *required*

非空提示，用于描述图像或编辑内容。

**image\_urls** `string[]`

按参考顺序排列的、可公开访问的 HTTP(S) 图像 URL。`image-to-image` 模式必填。支持 PNG、JPEG、WebP 或 SVG，提供 1–16 个 URL，GIF 必须恰好提供一个 URL。

**mask\_url** `string`

可选的公开 HTTP(S) 掩模 URL，用于第一个参考图像。支持 PNG、JPEG 和 WebP 编辑。白色或透明区域表示编辑区域。提供 `mask_url` 或 `markup_url`。

**markup\_url** `string`

可选的公开 HTTP(S) URL，用于一个透明 PNG 标记第一张参考图像。支持 PNG、JPEG 和 WebP 编辑。可使用箭头、圆圈或文本引导编辑。提供 `markup_url` 或 `mask_url`。

**size** `string`

请求的宽高，以像素为单位，例如 `2304x1536`。宽和高分别取最接近的 16 的倍数，恰好在两个倍数之间时向上取整。取整后，最长边不得超过 3,840 像素，最长边与最短边的比值不得超过 3:1，总像素数须在 655,360–8,294,400 之间。传入 `size` 时，它优先于 `resolution` 和 `aspect_ratio`。实际输出尺寸可能不同。使用 `size` 编辑 GIF 时，1:1 限为 `832x832`，16:9 限为 `1280x720`，9:16 限为 `720x1280`。

**aspect\_ratio** `string`

输出纵横比。使用 `1:1`、`1:2`、`2:1`、`1:3`、`3:1`、`2:3`、`3:2`、`3:4`、`4:3`、`4:5`、`5:4`、`9:16`、`16:9`、`9:21` 或 `21:9`。省略时，`text-to-image` 使用 `1:1`，`image-to-image` 跟随第一个参考图像。

**resolution** `string` (default: 1k)

输出分辨率层。使用`1k`、`2k`或`4k`。省略 `size` 时会影响定价。

**quality** `string` (default: medium)

输出质量等级。使用`low`、`medium`、`high`、`xhigh`或`max`。影响定价。

**complexity** `string` (default: high)

规划强度，可选 `low`、`medium` 或 `high`。

**output\_format** `string` (default: png)

两种模式均支持 `png`、`jpeg`、`webp`、`gif` 和 `svg`。GIF 编辑需使用 `1k` 或 `medium` 模式，提供一张参考图像，且需设置 9 帧、每帧持续 200 毫秒，宽高比为 `1:1`、`16:9` 或 `9:16` 之一。

**frame\_count** `integer` (default: 9)

GIF 帧数。文生图支持 2 至 16 帧，图生图固定为 9 帧。

**frame\_duration\_ms** `integer` (default: 200)

每个 GIF 帧的持续时间（单位：毫秒）。文生图支持 20 至 2,000 毫秒，图生图固定为 200 毫秒。

## 轮询结果

创建响应返回 `data.taskId`。保存该值并用于查询任务：

```bash theme={null}
curl "https://api.apixo.ai/api/v1/statusTask/gpt-image-2.6-flare?taskId=YOUR_TASK_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

当 `data.state` 为 `success` 时，将 `data.resultJson` 解析为 JSON，读取 `resultUrls` 字段：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "YOUR_TASK_ID",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://example.com/result.gif\"]}"
  }
}
```

只要 `state` 仍是 `processing` 或 `processing_r2`，就应继续轮询。如果 `state` 变为 `failed`，请查看响应中是否有 `failCode` 和 `failMsg`。使用 `request_type: "callback"` 时，最终结果会发送到你提供的 Webhook URL。详见 [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)。

## 计费

当您提供 `size` 时，计费将基于四舍五入后的尺寸计算，匹配的第一行规则生效。

| 等级 | 最长边 | 总像素 |
| - | -: | -: |
| 1K | 最大 1,536 像素 | 最多 1,572,864 |
| 2K | 最大 3,072 像素 | 最多 4,194,304 |
| 4K | 所有其他有效尺寸 | |

文生图 GIF 使用相同质量和分辨率的静态基本价格。文生图 SVG 在该基本价格上增加 `$0.020`。GIF 和 SVG 编辑对每个参考图像（包括第一个图像）使用匹配的文生图格式价格加上 `$0.015`。PNG、JPEG 和 WebP 编辑包含在基本价格中的第一张参考图像。每增加一张参考图像需额外支付 `$0.015`，可选的蒙版或标记额外增加 `$0.015` 一次。复杂性和帧持续时间不会影响标准价格。

在 `medium` 和 `1k` 配置下，PNG 和 GIF 文生图各为 `$0.050`，SVG 为 `$0.070`。当使用一张参考图像时，GIF 编辑成本为 `$0.065`，SVG 编辑成本为 `$0.085`。包含三张参考图像和一张标记的静态编辑成本为 `$0.110`。以上为折扣前的标准价格。详情请参阅[完整定价表](https://apixo.ai/docs/zh/pricing.md#gpt-image-2-6-flare-and-sunburst)和[积分换算与取整](https://apixo.ai/docs/zh/pricing.md#credit-conversion-and-rounding)。

## 延迟与轮询

状态请求之间建议间隔 3–5 秒。对于生产环境工作负载，建议使用回调通知机制。

## MCP 集成

[完整模型 schema](https://apixo.ai/docs/models/schemas/image/gpt-image-2-6-flare.json) 在 `mcp.result` 字段中定义结果格式，在 `mcp.attachments` 字段中定义附件路径。将文件绑定至 `image_urls`、`mask_url` 或 `markup_url`，并保持参考图像的顺序。API 将验证模式要求及单个编辑引导的合法性。

## 相关链接

* [GPT Image 2.6 Sunburst](https://apixo.ai/docs/zh/models/image/gpt-image-2-6-sunburst.md)
* [图像模型](https://apixo.ai/docs/zh/models/image)
* [生成 API 概览](https://apixo.ai/docs/zh/models.md)
* [API定价](https://apixo.ai/pricing/api)


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