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

# gpt-image-2.5-flare 生成图像 API

> 使用 `POST /v1/images/generations` 调用 `gpt-image-2.5-flare` 生成图像，支持全部尺寸档位。

# gpt-image-2.5-flare 生成图像 API

`gpt-image-2.5-flare` 使用与 `gpt-image-2` 和 `gpt-image-2-pro` 一致的 JSON 请求格式提交图像生成请求，支持全部基础、`2K` 和 `4K` 尺寸档位。

* 请求路径为 `POST /v1/images/generations`。
* 通过 `model = "gpt-image-2.5-flare"` 选择目标模型。
* `prompt` 描述要生成的图像内容。
* `size` 支持 `gpt-image-2` 与 `gpt-image-2-pro` 的全部尺寸；请求时传实际 `WxH` 尺寸。
* `quality` 支持 `low`、`medium`、`high`、`xhigh`、`max` 和 `auto`。
* 支持 `url` 和 `b64_json` 两种返回格式。
* 可在 JSON 中附带 `image` 作为参考图。
* `n` 不传或显式传 `0` 时会按 `1` 处理。

## 方法与路径

```http theme={null}
POST /v1/images/generations
```

## 请求示例

<CodeGroup>
  ```bash theme={null}
  curl -X POST https://magic666.top/v1/images/generations \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-image-2.5-flare",
      "prompt": "一张充满光晕效果的未来城市海报，清晰细节，平衡留白",
      "n": 1,
      "size": "3840x2160",
      "quality": "xhigh",
      "response_format": "url"
    }'
  ```

  ```python theme={null}
  import requests

  resp = requests.post(
      "https://magic666.top/v1/images/generations",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json",
      },
      json={
          "model": "gpt-image-2.5-flare",
          "prompt": "一张充满光晕效果的未来城市海报，清晰细节，平衡留白",
          "n": 1,
          "size": "3840x2160",
          "quality": "xhigh",
          "response_format": "url",
      },
      timeout=60,
  )
  print(resp.json())
  ```

  ```javascript theme={null}
  const response = await fetch("https://magic666.top/v1/images/generations", {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "gpt-image-2.5-flare",
      prompt: "一张充满光晕效果的未来城市海报，清晰细节，平衡留白",
      n: 1,
      size: "3840x2160",
      quality: "xhigh",
      response_format: "url",
    }),
  });

  console.log(await response.json());
  ```
</CodeGroup>

## 响应示例

<ResponseExample>
  ```json 200 - URL theme={null}
  {
    "created": 1735689600,
    "data": [
      {
        "url": "https://.../images/img-flare-abc123.png",
        "revised_prompt": "一张充满光晕效果的未来城市海报，清晰细节，平衡留白"
      }
    ]
  }
  ```

  ```json 200 - Base64 theme={null}
  {
    "created": 1735689600,
    "data": [
      {
        "b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
        "revised_prompt": "一张充满光晕效果的未来城市海报，清晰细节，平衡留白"
      }
    ]
  }
  ```
</ResponseExample>

## 认证

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Body

<ParamField body="model" type="string" required>
  固定传 `gpt-image-2.5-flare`。
</ParamField>

<ParamField body="prompt" type="string" required>
  生成提示词，用于描述想要生成的图片。
</ParamField>

<ParamField body="n" type="integer">
  生成数量。若不传或显式传 `0`，按 `1` 处理。
</ParamField>

<ParamField body="size" type="string">
  输出尺寸。支持全部尺寸档位：基础尺寸 `1024x1024`、`1536x1152`、`1536x1024`、`1024x1536`、`1920x1080`、`1080x1920`，以及 `2K` / `4K` 尺寸表中的全部实际 `WxH` 值。
</ParamField>

<ParamField body="image" type="string | array<string> | object">
  可选参考图输入。常见写法是 Base64 字符串或 Base64 数组。
</ParamField>

<ParamField body="response_format" type="string">
  返回格式，常见值为 `url`、`b64_json`。
</ParamField>

<ParamField body="quality" type="string">
  质量等级。支持 `low`、`medium`、`high`、`xhigh`、`max` 和 `auto`；是否真正生效取决于最终命中的渠道。
</ParamField>

<ParamField body="style" type="string | object">
  风格字段，原样透传给支持的上游。
</ParamField>

<ParamField body="background" type="string | object">
  背景控制字段，原样透传给支持的上游。
</ParamField>

<ParamField body="watermark" type="boolean">
  显式水印开关。`false` 与不传语义不同。
</ParamField>

## 尺寸表

`gpt-image-2.5-flare` 与 `gpt-image-2.5-sunburst` 均支持以下全部尺寸。请求体中的 `size` 传“实际目标尺寸”一列。

### 基础尺寸

| 预设     | 实际目标尺寸      |
| ------ | ----------- |
| `1:1`  | `1024x1024` |
| `4:3`  | `1536x1152` |
| `3:2`  | `1536x1024` |
| `2:3`  | `1024x1536` |
| `16:9` | `1920x1080` |
| `9:16` | `1080x1920` |

### `2K` 档位

| 预设         | 实际目标尺寸      |
| ---------- | ----------- |
| `1:1(2K)`  | `2048x2048` |
| `4:3(2K)`  | `2048x1536` |
| `3:2(2K)`  | `2560x1712` |
| `2:3(2K)`  | `1712x2560` |
| `16:9(2K)` | `2048x1152` |
| `9:16(2K)` | `1152x2048` |

### `4K` 档位

| 预设         | 实际目标尺寸      |
| ---------- | ----------- |
| `1:1(4K)`  | `2880x2880` |
| `4:3(4K)`  | `3840x2880` |
| `3:2(4K)`  | `3840x2560` |
| `2:3(4K)`  | `2560x3840` |
| `16:9(4K)` | `3840x2160` |
| `9:16(4K)` | `2160x3840` |

## Response

<ResponseField name="created" type="integer">
  生成时间戳。
</ResponseField>

<ResponseField name="data[].url" type="string">
  `response_format = url` 时返回的图片 URL。
</ResponseField>

<ResponseField name="data[].b64_json" type="string">
  `response_format = b64_json` 时返回的图片 Base64 数据。
</ResponseField>

<ResponseField name="data[].revised_prompt" type="string">
  部分上游会改写提示词并返回在这个字段里。
</ResponseField>

## 异步调用

如需提交后异步查询结果，可以使用图像异步生成入口：

```http theme={null}
POST /v1/images/generations/async
```

异步请求仍传 `model = "gpt-image-2.5-flare"`，`size` 可使用本页列出的全部尺寸。提交成功后读取返回的 `id` / `task_id`，再通过 `GET /v1/images/generations/async/{taskId}` 查询状态和结果。

## 相关页面

* [图像模型支持矩阵](/api-reference/images/model-matrix)
* [gpt-image-2.5-sunburst 生成图像 API](/api-reference/images/gpt-image-2.5-sunburst/generation)
* [图像异步生成 API](/api-reference/images/gpt-image-async/generation)
* [图像异步任务查询](/api-reference/images/gpt-image-async/query)
* [OpenAI Images 兼容概览](/api-reference/images/gpt-image-1/overview)
