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

# GPT Image 2.5 Official

> 支持 Flare/Sunburst、透明背景与最高 4K 生成及编辑，按实际 Token 计费。

## 参数与输入模式

`model` 与 `input` 必填，省略可选字段时使用模型默认值；完整字段定义见下方 Body 参数列表。

| 请求场景 | input 必填字段 |
| - | - |
| 文生图 | `prompt` |
| 参考图编辑 | `prompt`、`image_urls`（最多 16 张） |
| 蒙版局部编辑 | `prompt`、`image_urls`、`mask_url` |

## 使用场景

将以下示例提交到 `POST /api/v1/tasks/create_task`，并将提示词与素材链接替换为你的内容。

```json 文生图 theme={null}
{
  "model": "gpt-image-2.5-official",
  "input": {
    "prompt": "Autumn ceramic exhibition poster with crisp serif typography reading \"AUTUMN ISSUE\", clean grid layout.",
    "version": "sunburst",
    "aspect_ratio": "3:4",
    "resolution": "2K",
    "quality": "high"
  }
}
```

```json 透明背景 theme={null}
{
  "model": "gpt-image-2.5-official",
  "input": {
    "prompt": "Isometric illustration of a glossy cobalt espresso cup, isolated object with no background.",
    "output_format": "png",
    "background": "transparent"
  }
}
```

```json 蒙版局部编辑 theme={null}
{
  "model": "gpt-image-2.5-official",
  "input": {
    "prompt": "Replace the transparent masked jacket area with olive waxed canvas, keeping lighting and folds natural.",
    "image_urls": [
      "https://cdn.example.com/portrait.png"
    ],
    "mask_url": "https://cdn.example.com/mask.png"
  }
}
```

```json 精确像素与 WebP theme={null}
{
  "model": "gpt-image-2.5-official",
  "input": {
    "prompt": "Overhead photograph of handcrafted matcha bowls on slate stone in soft morning light.",
    "size": "1600x1200",
    "output_format": "webp",
    "output_compression": 85
  }
}
```

> 通过 [查询任务](https://docs.apistable.ai/zh/query-task.md) 或 `callback_url`（[Webhook 安全与验签](https://docs.apistable.ai/zh/webhook-secret.md)）获取结果，提交错误见 [创建任务](https://docs.apistable.ai/zh/create-task.md)。结果链接保留 14 天；超过 24 小时未完成的任务将标记失败且不扣费。

## 试用与价格

单次请求最多生成 `n` 张图片，整笔任务按实际 Token 用量结算一次，向上取整至 0.1 积分（实扣不超过提交预留，未用部分退还）。部分成功仅按实际返回的结果计费，失败不扣费。余额查询见 [查询积分余额](https://docs.apistable.ai/zh/credits.md)。

| Token 类型 | 积分 / 百万 Token | USD / 百万 Token |
| - | - | - |
| 文本输入 | 950.0 | \$4.750 |
| 缓存文本输入 | 237.5 | \$1.188 |
| 图像输入 | 1520.0 | \$7.600 |
| 缓存图像输入 | 380.0 | \$1.900 |
| 图像输出 | 5700.0 | \$28.500 |

> [card] [在线试用](https://apistable.ai/zh/models/gpt-image-2.5-official#try)
>
> 设置参数并在线生成图片。

> [card] [查看价格](https://apistable.ai/zh/models/gpt-image-2.5-official#pricing)
>
> 查看 Token 费率、请求估价与预留上限。


## OpenAPI

````yaml openapi-gpt-image-2.5-official-zh.json POST /api/v1/tasks/create_task
openapi: 3.1.0
info:
  title: APIstable API
  version: 1.0.0-preview
  description: >-
    Public /api/v1 protocol. Valid API keys have the same account-scoped access.
    Read the selected model documentation for its ID, supported inputs, result
    format and availability before submitting. No client submission idempotency
    or max_credits. Availability, pricing, file retention and callback formats
    follow the selected model contract. Unconfigured operations return 503.
servers:
  - url: https://apistable.ai
    description: API Stable API
security: []
paths:
  /api/v1/tasks/create_task:
    post:
      summary: GPT Image 2.5 Official
      description: 支持 Flare/Sunburst、透明背景与最高 4K 生成及编辑，按实际 Token 计费。
      operationId: gpt-image-2.5-official
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              additionalProperties: false
              properties:
                model:
                  type: string
                  enum:
                    - gpt-image-2.5-official
                  example: gpt-image-2.5-official
                  description: 本页对应的 APIstable 模型 ID。
                input:
                  $schema: https://json-schema.org/draft/2020-12/schema
                  type: object
                  properties:
                    prompt:
                      type: string
                      description: 图像生成或编辑提示词。
                    aspect_ratio:
                      description: 输出宽高比，默认 auto。编辑时省略将匹配参考图比例；传入 size 时忽略。
                      type: string
                      enum:
                        - auto
                        - '1:1'
                        - '3:2'
                        - '2:3'
                        - '4:3'
                        - '3:4'
                        - '5:4'
                        - '4:5'
                        - '16:9'
                        - '9:16'
                        - '2:1'
                        - '1:2'
                        - '3:1'
                        - '1:3'
                        - '21:9'
                        - '9:21'
                      default: auto
                    size:
                      description: >-
                        精确像素尺寸（WxH），覆盖 aspect_ratio 与 resolution。宽高须为 16 的倍数、单边
                        ≤ 3840、长短边比 ≤ 3:1、面积 655,360–8,294,400。
                      type: string
                      pattern: ^([1-9][0-9]*)x([1-9][0-9]*)$
                    resolution:
                      description: 输出分辨率档位：1K（默认）、2K、4K；传入 size 时忽略。
                      type: string
                      enum:
                        - 1K
                        - 2K
                        - 4K
                      default: 1K
                    quality:
                      description: 生成质量：auto（默认）、low、medium、high、xhigh、max；档位越高 Token 消耗越多。
                      type: string
                      enum:
                        - auto
                        - low
                        - medium
                        - high
                        - xhigh
                        - max
                      default: auto
                    'n':
                      description: 单次任务生成的图片数量（1–4，默认 1）。
                      type: integer
                      minimum: 1
                      maximum: 4
                      default: 1
                    image_urls:
                      description: 最多 16 张参考图的公网 HTTP(S) 链接；任务完成前须保持可访问。
                      maxItems: 16
                      type: array
                      items:
                        type: string
                        pattern: ^[hH][tT][tT][pP][sS]?:\/\/
                    mask_url:
                      description: >-
                        与首张参考图同尺寸的透明通道 PNG 蒙版（公网 HTTP(S) 链接或 PNG Data URL）；须配合
                        image_urls，任务完成前须保持可访问。
                      anyOf:
                        - type: string
                          pattern: ^[hH][tT][tT][pP][sS]?:\/\/
                        - type: string
                          pattern: ^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$
                    output_format:
                      description: 输出格式：png（默认）、jpeg、webp。
                      type: string
                      enum:
                        - png
                        - jpeg
                        - webp
                      default: png
                    output_compression:
                      description: 压缩质量（0–100 整数），仅支持 jpeg 和 webp。
                      type: integer
                      minimum: 0
                      maximum: 100
                    nsfw_check:
                      description: >-
                        是否在生成前启用 APIstable 提示词与参考图安全筛查（默认 false）。不接受
                        `moderation` 字段。
                      type: boolean
                      default: false
                    version:
                      description: 模型版本：flare（默认，更快）或 sunburst（构图、文字与精细编辑效果更好）。
                      type: string
                      enum:
                        - flare
                        - sunburst
                      default: flare
                    background:
                      description: 背景模式：auto、opaque 或 transparent（透明仅支持 png/webp）。
                      type: string
                      enum:
                        - transparent
                        - opaque
                        - auto
                  required:
                    - prompt
                  additionalProperties: false
                  allOf:
                    - if:
                        required:
                          - output_compression
                      then:
                        required:
                          - output_format
                        properties:
                          output_format:
                            enum:
                              - jpeg
                              - webp
                    - if:
                        properties:
                          background:
                            const: transparent
                        required:
                          - background
                      then:
                        properties:
                          output_format:
                            enum:
                              - png
                              - webp
                    - if:
                        required:
                          - mask_url
                      then:
                        required:
                          - image_urls
                        properties:
                          image_urls:
                            minItems: 1
                  description: 模型输入参数；省略可选字段时使用模型默认值。
                callback_url:
                  type: string
                  format: uri
                  description: 任务完成时接收签名回调的公网 HTTPS 地址。须为可直接访问的地址，不能跳转到其他地址。省略时可轮询查询任务接口。
            example:
              model: gpt-image-2.5-official
              input:
                prompt: >-
                  Studio photograph of a cobalt blue ceramic teapot, soft
                  daylight, neutral background.
                aspect_ratio: '1:1'
                resolution: 1K
                version: flare
      responses:
        '200':
          description: Accepted task. Poll the common task endpoint or use callback_url.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - msg
                  - data
                additionalProperties: false
                properties:
                  code:
                    const: 200
                  msg:
                    const: success
                  data:
                    type: object
                    required:
                      - task_id
                    additionalProperties: false
                    properties:
                      task_id:
                        type: string
        '400':
          description: >-
            40001 invalid JSON, 40002 invalid input/callback or input rejected
            by screening, 40003 unsupported parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: '40201: Insufficient credits (live acceptance).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: '40301: Website session requests require the APIstable site origin.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: '40401: Unknown model or resource not found in this account.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: '40901: Resource incompatible with this operation.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: '41001: Source audio or temporary resource has expired.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: '41301: Request too large.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: '42201: Requested capability combination is not enabled.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: '42901: Rate/concurrency limit (live acceptance).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: '50301: Service unavailable. No live submission or charge.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      callbacks:
        Webhook:
          '{$request.body#/callback_url}':
            post:
              requestBody:
                required: true
                description: >-
                  任务成功或失败后，APIstable 向创建任务时传入的 `callback_url` 发送 JSON POST。验签后返回
                  HTTP 2xx 确认接收。


                  请求生成的全部结果返回在 `result.urls`（可能少于 `n`），整笔任务总费用记录在
                  `charged_credits`。任务失败时返回 `status: "failed"`、`result: null`
                  且不扣费。


                  签名和去重使用 `X-APIstable-Signature`、`X-APIstable-Timestamp` 和
                  `X-APIstable-Event-Id`。详见 [Webhook 安全与验签](/zh/webhook-secret)。


                  **Webhook 请求体示例**


                  ```json

                  {
                    "code": 200,
                    "msg": "success",
                    "data": {
                      "task_id": "c6adbc82-8b9a-4d6f-8b60-1114c8c4aafb",
                      "model": "gpt-image-2.5-official",
                      "status": "succeeded",
                      "created_at": "2026-11-23T08:30:00.000Z",
                      "completed_at": "2026-11-23T08:30:18.000Z",
                      "duration": 18000,
                      "charged_credits": 2.1,
                      "message": "",
                      "input": "{\"prompt\":\"Studio photograph of a cobalt blue ceramic teapot, soft daylight, neutral background.\",\"resolution\":\"1K\",\"aspect_ratio\":\"1:1\"}",
                      "result": {
                        "urls": [
                          "https://cdn.example.com/generated/image.png"
                        ],
                        "items": [
                          {
                            "id": "e7aacd19-819a-4747-bbbf-46fb6f2995a5",
                            "status": "succeeded",
                            "charged_credits": 2.1,
                            "urls": [
                              "https://cdn.example.com/generated/image.png"
                            ]
                          }
                        ]
                      }
                    }
                  }

                  ```
                content:
                  application/json:
                    schema:
                      type: object
                      required:
                        - code
                        - msg
                        - data
                      properties:
                        code:
                          type: integer
                          const: 200
                        msg:
                          type: string
                          const: success
                        data:
                          type: object
                          additionalProperties: false
                          required:
                            - task_id
                            - model
                            - status
                            - created_at
                            - completed_at
                            - duration
                            - charged_credits
                            - message
                            - input
                            - result
                          properties:
                            task_id:
                              type: string
                            model:
                              type: string
                              const: gpt-image-2.5-official
                            status:
                              type: string
                              enum:
                                - succeeded
                                - failed
                            created_at:
                              type: string
                              format: date-time
                            completed_at:
                              type:
                                - string
                                - 'null'
                              format: date-time
                            duration:
                              type:
                                - integer
                                - 'null'
                              minimum: 0
                              description: 任务总耗时（毫秒）；处理中为 null。
                            charged_credits:
                              type:
                                - number
                                - 'null'
                              minimum: 0
                              description: 最终实扣积分；完成前为 null。
                            message:
                              type: string
                              description: 失败时的原因说明；成功时为空字符串。
                            input:
                              type: string
                              contentMediaType: application/json
                              description: 已受理模型参数的 JSON 字符串。
                            result:
                              type:
                                - object
                                - 'null'
                              required:
                                - urls
                                - items
                              properties:
                                urls:
                                  type: array
                                  items:
                                    type: string
                                    format: uri
                                items:
                                  type: array
                                  items:
                                    type: object
                                    required:
                                      - id
                                      - status
                                      - charged_credits
                                      - urls
                                    properties:
                                      id:
                                        type: string
                                        format: uuid
                                      status:
                                        type: string
                                      charged_credits:
                                        type: number
                                        minimum: 0
                                      urls:
                                        type: array
                                        items:
                                          type: string
                                          format: uri
                    example:
                      code: 200
                      msg: success
                      data:
                        task_id: c6adbc82-8b9a-4d6f-8b60-1114c8c4aafb
                        model: gpt-image-2.5-official
                        status: succeeded
                        created_at: '2026-11-23T08:30:00.000Z'
                        completed_at: '2026-11-23T08:30:18.000Z'
                        duration: 18000
                        charged_credits: 2.1
                        message: ''
                        input: >-
                          {"prompt":"Studio photograph of a cobalt blue ceramic
                          teapot, soft daylight, neutral
                          background.","resolution":"1K","aspect_ratio":"1:1"}
                        result:
                          urls:
                            - https://cdn.example.com/generated/image.png
                          items:
                            - id: e7aacd19-819a-4747-bbbf-46fb6f2995a5
                              status: succeeded
                              charged_credits: 2.1
                              urls:
                                - https://cdn.example.com/generated/image.png
              responses:
                2XX:
                  description: 已接收 Webhook。
              method: post
              type: path
            path: '{$request.body#/callback_url}'
      security:
        - bearerAuth: []
components:
  schemas:
    Error:
      type: object
      required:
        - code
        - msg
        - data
      properties:
        code:
          type: integer
        msg:
          type: string
        data:
          type: 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        登录 APIstable 后，在 [API Key 管理](https://apistable.ai/zh/console/keys)
        创建并复制密钥。


        每次调用都要在 HTTP 请求头传入：


        ```http

        Authorization: Bearer YOUR_API_KEY

        ```


        将 YOUR_API_KEY 替换为你创建的 API Key。

````

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