> ## 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.5 Flare API：图像生成与编辑

> 通过 APIXO 使用 GPT Image 2.5 Flare API 实现图像生成与编辑，支持多层级质量选项、自定义尺寸及 Webhook 通知。

## 概览

GPT Image 2.5 Flare 是一个异步图像生成 API，用于文生图和参考引导图像编辑。

| 功能 | 值 |
| - | - |
| 模型 ID | `gpt-image-2.5-flare` |
| 模式 | `text-to-image`, `image-to-image` |
| 提示词长度 | 1-32,000 个字符 |
| 参考图片 | 1-16 个 `image-to-image` 的 URL |
| 蒙版编辑 | 可选的 `mask_url` 用于 `image-to-image` |
| 纵横比 | `auto`, `1:1`, `1:2`, `2:1`, `2:3`, `3:2`, `4:3`, `3:4`, `4:5`, `5:4`, `16:9`, `9:16`, `21:9` |
| 输出控制 | `aspect_ratio` 或 `size`（支持的比率或自定义 `WIDTHxHEIGHT`） |
| 背景 | `auto`, `transparent`, `opaque` |
| 输出格式 | `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.5-flare` | 提交生成任务 |
| `GET` | `/statusTask/gpt-image-2.5-flare?taskId={taskId}` | 查询任务状态并获取结果 |

```http theme={null}
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## 快速入门

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/gpt-image-2.5-flare" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-image",
      "prompt": "A premium minimalist perfume bottle on dark green marble, soft studio lighting, luxury commercial photography, no text",
      "aspect_ratio": "1:1",
      "background": "transparent",
      "output_format": "webp",
      "resolution": "1k",
      "quality": "medium"
    }
  }'
```

接受的响应包含 `data.taskId`。保存该值，并轮询，直到 `state` 状态变为 `success` 或 `failed`。

## 请求体

### 文生图

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "text-to-image",
    "prompt": "A cinematic aerial view of a coastal city at sunrise, warm golden light, realistic clouds and ocean, no text",
    "aspect_ratio": "16:9",
    "resolution": "2k",
    "quality": "high"
  }
}
```

### 图生图

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-image",
    "prompt": "Transform the supplied product photo into a clean premium e-commerce hero image with a white studio background. Preserve the product shape and logo.",
    "image_urls": [
      "https://your-domain.com/images/product-source.png"
    ],
    "mask_url": "https://your-domain.com/images/product-mask.png",
    "size": "1536x1024",
    "background": "opaque",
    "output_format": "png",
    "resolution": "2k",
    "quality": "xhigh"
  }
}
```

## 参数

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

结果获取方式。选择 `async` 时，通过 `statusTask` 轮询结果；选择 `callback` 时，通过 Webhook 接收结果。

**callback\_url** `string`

当 `request_type` 为 `callback` 时必需。它必须是可接收最终任务负载的公共 HTTPS URL。详情请参见 [Webhooks](https://apixo.ai/docs/zh/api-reference/webhooks.md)。

**input** `object` *required*

GPT Image 2.5 Flare 的输入参数。

**属性**

**mode** `string` *required*

生成模式。可选值为 `text-to-image`、`image-to-image`。

**prompt** `string` *required*

描述所请求图像或编辑的文本提示。支持 1-32,000 个字符。

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

可公开访问的参考图 URL。`image-to-image` 模式必填，可提供 1 至 16 个。

**aspect\_ratio** `string` (default: auto)

输出纵横比。支持的值：`auto`、`1:1`、`1:2`、`2:1`、`2:3`、`3:2`、`4:3`、`3:4`、`4:5`、`5:4`、`16:9`、`9:16`、`21:9`。其中 `1:2` 和 `2:1` 模式要求 `resolution` 为 `2k` 或 `4k`。当提供 `size` 参数时将被忽略。

**size** `string`

可选输出尺寸。使用支持的宽高比或自定义 `WIDTHxHEIGHT`，例如 `1536x1024`。它优先于 `aspect_ratio`。自定义 `WIDTHxHEIGHT`、`1:2` 和 `2:1` 要求 `resolution` 为 `2k` 或 `4k`。

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

输出分辨率档位。可选值为 `1k`、`2k`、`4k`。

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

质量与计费等级。支持的值：`low`、`medium`、`high`、`xhigh`、`max`。每个等级有对应的定价。

**background** `string` (default: auto)

输出背景。支持的值：`auto`、`transparent`、`opaque`。使用 `transparent` 时，需将 `output_format` 设置为 `png` 或 `webp`。

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

输出图像格式。支持的值：`png`、`jpeg`、`webp`。`jpeg` 不支持与 `background=transparent` 一起使用。

**mask\_url** `string`

可选的公开 HTTP(S) 掩模图像 URL。仅适用于 `image-to-image` 任务，且需提供 `image_urls`。

## 轮询结果

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

当请求成功时，`data.resultJson` 为包含 `resultUrls` 的 JSON 字符串：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/xxx.png\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
```

对于失败的任务，`state` 为 `failed`，响应中包含 `failCode` 和 `failMsg`。

## 计费

新提交的非 LLM 请求按 **1 积分 = `$0.001`** 计费。先按用量和附加项目计算总额，再应用账号折扣，最后将请求总额向上取整到整数积分。如果约定了固定单价，则按该单价的原始精度计算，不再使用标准价或另行打折；最终积分仍向上取整。详见[积分换算与取整](https://apixo.ai/docs/zh/pricing.md#credit-conversion-and-rounding)。

按成功生成的图像计费。以下标准单价以 USD 为单位，保留小数点后三位。文生图和图生图使用相同的输出层价格；参考图像不收取额外费用。

| 质量 | `1k` | `2k` | `4k` |
| - | -: | -: | -: |
| `low` | `$0.010` | `$0.020` | `$0.030` |
| `medium` | `$0.024` | `$0.040` | `$0.070` |
| `high` | `$0.090` | `$0.150` | `$0.270` |
| `xhigh` | `$0.160` | `$0.270` | `$0.480` |
| `max` | `$0.360` | `$0.600` | `$1.000` |

有关实时价格目录，请参阅 [API 定价](https://apixo.ai/pricing/api)。

## 延迟与轮询

生成时间取决于提示复杂性、参考图像、所选分辨率和当前队列负载。在 30-60 秒后开始轮询，然后每 10 秒轮询一次。对于生产工作负载，更喜欢回调模式。

## MCP 集成

[完整模型 Schema](https://apixo.ai/docs/models/schemas/image/gpt-image-2-5-flare.json) 中的 `mcp.result` 指定了结果的解析方式，`mcp.attachments` 列出支持绑定文件的字段。这些元数据供客户端集成使用，无需作为生成参数提交。附件字段为 `image_urls`, `mask_url`。请保留用户指定的文件顺序。API 负责校验模型参数。

## 相关链接

* [图像模型](https://apixo.ai/docs/zh/models/image)
* [生成 API 概览](https://apixo.ai/docs/zh/models.md)
* [提交生成任务](https://apixo.ai/docs/zh/api-reference/generate-task.md)
* [查询任务状态](https://apixo.ai/docs/zh/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)
* [API定价](https://apixo.ai/pricing/api)


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