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

# GPT Image 2.5

> OpenAI 新一代生图模型。

Flare 与 Sunburst 同代同价、能力相同，任选其一即可。1024 尺寸约 25–40 秒出图，4K 最高画质约 2 分钟。

* 模型 ID：`gpt-image-2.5-flare`、`gpt-image-2.5-sunburst`（参数与用法相同）
* 接口：`POST https://token.poryf.com/v1/images/generations`（文生图）、`POST https://token.poryf.com/v1/images/edits`（图片编辑），同步返回
* [查看价格](https://token.poryf.com/pricing/gpt-image-2.5-flare) · [在线试用](https://token.poryf.com/model-guide/gpt-image-2.5-flare)（登录后，按自己的余额扣费）

## 请求参数

<ParamField header="Authorization" type="string" required>
  `Bearer YOUR_API_KEY`，在 [控制台的 API 密钥页](https://token.poryf.com/keys) 创建。
</ParamField>

<ParamField body="model" type="string" required>
  `gpt-image-2.5-flare`、`gpt-image-2.5-sunburst`
</ParamField>

<ParamField body="prompt" type="string" required>
  画面描述。
</ParamField>

<ParamField body="size" type="string">
  输出尺寸，格式为 `宽x高`，如 `1024x1024`、`1536x1024`、`1024x1536`，最大边长 3840 px（4K）。尺寸越大，消耗的 token 越多。
</ParamField>

<ParamField body="quality" type="string">
  画质：`low`、`medium`、`high`、`xhigh`、`max`。画质越高越贵、越慢。
</ParamField>

<ParamField body="output_format" type="string">
  `png` 或 `jpeg`。
</ParamField>

<ParamField body="image" type="file">
  仅图片编辑（`/v1/images/edits`）使用。multipart 方式上传本地图片文件；也可以用 JSON 方式传 `images: [{"image_url": "图片 URL"}]`。
</ParamField>

## 示例：文生图

```bash theme={null}
curl https://token.poryf.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.5-flare",
    "prompt": "秋日咖啡店的拿铁海报，暖色调，留出标题位置",
    "size": "1024x1024",
    "quality": "low"
  }'
```

## 示例：图片编辑

图片编辑走 `/v1/images/edits`，有两种传图方式。

<CodeGroup>
  ```bash 上传文件（multipart） theme={null}
  curl https://token.poryf.com/v1/images/edits \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F model=gpt-image-2.5-flare \
    -F 'prompt=给这只柴犬戴上一条红色围巾，其余保持不变' \
    -F image=@shiba.png \
    -F quality=low \
    -F size=1024x1024
  ```

  ```bash 传图片 URL（JSON） theme={null}
  curl https://token.poryf.com/v1/images/edits \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-image-2.5-flare",
      "prompt": "给这只柴犬戴上一条红色围巾，其余保持不变",
      "images": [{ "image_url": "https://example.com/shiba.png" }],
      "quality": "low",
      "size": "1024x1024"
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(api_key="YOUR_API_KEY", base_url="https://token.poryf.com/v1", timeout=300)

  result = client.images.edit(
      model="gpt-image-2.5-flare",
      image=open("shiba.png", "rb"),
      prompt="给这只柴犬戴上一条红色围巾，其余保持不变",
      quality="low",
      size="1024x1024",
  )
  print(result.data[0].url)
  ```
</CodeGroup>

<Note>JSON 方式必须用 `images` 数组，写成 `"image": "URL"` 会被拒绝（400）。</Note>

## 响应

示例结构：

```json theme={null}
{
  "data": [
    { "url": "https://example.com/generated/xxxx.png" }
  ]
}
```

GPT Image 实测返回 `url`，同时带一个空的 `b64_json` 字段；读取时取非空的那个。响应里还有 `usage`，列出本次输入、输出的 token 数。

## 计费

按 token 计费，包括输入文本、输入图片和输出图片的 token；尺寸越大、画质越高越贵。参考：1024 低画质约 ¥0.03 / 张，中画质约 ¥0.06 / 张，4K 最高画质约 ¥1.9 / 张。图片编辑还要计输入图片的 token，带一张 1024 参考图、低画质约 ¥0.07 / 张。

<Warning>
  * Nano Banana 与可灵的参考图只接受公网可访问的 `http(s)` URL，不支持上传文件或 Base64。
  * 生成结果是临时链接：GPT Image 约 24 小时失效，Nano Banana 与可灵约 7 天失效。请及时下载转存。
  * 接口同步返回，出图可能需要 1–2 分钟，请把客户端超时设为 5 分钟以上，避免重复提交导致重复扣费。
</Warning>

实时单价见 [模型广场](https://token.poryf.com/pricing)。通用字段、响应格式和常见错误见 [图片通用说明](/api/images/overview)。


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