> ## 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.6 Official

> 支持静态图、GIF 动图、SVG 矢量图生成及标注/蒙版编辑，按实际 Token 计费。

## 参数与输入模式

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

| 请求场景 | input 必填字段 |
| - | - |
| 文生图 | `prompt` |
| 参考图编辑 | `prompt`、`image_urls`（最多 16 张） |
| 蒙版局部编辑 | `prompt`、`image_urls`、`mask_url` |
| 标注引导编辑 | `prompt`、`image_urls`、`markup_url` |
| GIF 动图 | `prompt`、`output_format: "gif"` |
| SVG 矢量图 | `prompt`、`output_format: "svg"`、`svg.model` |

## 特殊输出说明

* **GIF**（`output_format: "gif"`）：`size` 表示单帧像素，忽略 `resolution`，未传 `size` 时 `aspect_ratio` 只能省略或为 `auto`。帧拼成一张网格图（规格见 `frame_count`），按整张图计费，空白格也计入。
* **SVG**（`output_format: "svg"`）：须指定 `svg.model` 且 `n` 为 `1`（或省略）；不可与 `mask_url`、`markup_url`、`output_compression` 同用。生成最长可能耗时 22 分钟，请持续轮询原 `task_id`。

## 使用场景

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

```json 文生图 theme={null}
{
  "model": "gpt-image-2.6-official",
  "input": {
    "prompt": "Architectural photograph of a timber pavilion beside a misty pine pond at dawn.",
    "version": "flare",
    "aspect_ratio": "16:9",
    "resolution": "2K",
    "quality": "high",
    "complexity": "medium"
  }
}
```

```json 标注引导编辑 theme={null}
{
  "model": "gpt-image-2.6-official",
  "input": {
    "prompt": "Follow the arrows and notes on the annotation layer: move the brass lamp left and replace the ceramic mug with a glass carafe.",
    "image_urls": [
      "https://cdn.example.com/desk.png"
    ],
    "markup_url": "https://cdn.example.com/annotation.png"
  }
}
```

```json 蒙版局部编辑 theme={null}
{
  "model": "gpt-image-2.6-official",
  "input": {
    "prompt": "Replace the transparent masked background with warm limestone in soft daylight, keeping the product unchanged.",
    "image_urls": [
      "https://cdn.example.com/product.png"
    ],
    "mask_url": "https://cdn.example.com/mask.png"
  }
}
```

```json GIF 动图 theme={null}
{
  "model": "gpt-image-2.6-official",
  "input": {
    "prompt": "A small red fox gently wags its tail as snow falls, fixed camera, seamless loop.",
    "output_format": "gif",
    "size": "512x512",
    "frame_count": 8,
    "frame_duration_ms": 200
  }
}
```

```json SVG 矢量图 theme={null}
{
  "model": "gpt-image-2.6-official",
  "input": {
    "prompt": "Minimalist bakery emblem featuring a stylized wheat stalk in warm ochre and charcoal, flat vector shapes.",
    "output_format": "svg",
    "background": "transparent",
    "svg": {
      "model": "gpt-5.4-mini",
      "reasoning": {
        "effort": "low"
      }
    }
  }
}
```

> 通过 [查询任务](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 积分（实扣不超过提交预留，未用部分退还）。部分成功仅按实际返回的结果计费，失败不扣费。SVG 另按实时报价计入写入模型 Token（思考过程计入输出 Token）。余额查询见 [查询积分余额](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.6-official#try)
>
> 设置参数并在线生成图片。

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


## OpenAPI

````yaml openapi-gpt-image-2.6-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.6 Official
      description: 支持静态图、GIF 动图、SVG 矢量图生成及标注/蒙版编辑，按实际 Token 计费。
      operationId: gpt-image-2.6-official
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              additionalProperties: false
              properties:
                model:
                  type: string
                  enum:
                    - gpt-image-2.6-official
                  example: gpt-image-2.6-official
                  description: 本页对应的 APIstable 模型 ID。
                input:
                  $schema: https://json-schema.org/draft/2020-12/schema
                  type: object
                  properties:
                    prompt:
                      type: string
                      description: 图像生成或编辑提示词（最多 32,000 字符）。
                      maxLength: 32000
                    aspect_ratio:
                      description: >-
                        输出宽高比，默认 auto。编辑时省略将匹配参考图比例；传入 size 时忽略；GIF 未传 size
                        时仅支持省略或 auto。
                      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。静态图/SVG：宽高为 16
                        的倍数、单边 ≤ 3840、长短边比 ≤ 3:1、面积 655,360–8,294,400。GIF
                        下为单帧像素（默认 512x512，16 的倍数），按拼图上限校验。
                      type: string
                      pattern: ^([1-9][0-9]*)x([1-9][0-9]*)$
                    resolution:
                      description: 输出分辨率档位：1K（默认）、2K、4K；传入 size 或生成 GIF 时忽略。
                      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: 单次任务生成的图片或 GIF 数量（1–4，默认 1）；SVG 必须为 1。
                      type: integer
                      minimum: 1
                      maximum: 4
                      default: 1
                    image_urls:
                      description: >-
                        最多 16 张参考图的公网 HTTP(S) 链接或图片 Data URL（支持静态图、GIF 与
                        SVG）；任务完成前须保持 URL 可访问。
                      maxItems: 16
                      type: array
                      items:
                        anyOf:
                          - type: string
                            pattern: ^[hH][tT][tT][pP][sS]?:\/\/
                          - type: string
                            pattern: >-
                              ^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/]+={0,2}$
                    mask_url:
                      description: >-
                        与首张参考图同尺寸的透明通道 PNG 蒙版（公网 HTTP(S) 链接或 PNG Data URL）；须配合
                        image_urls，不可与 markup_url、GIF 或 SVG 同用；任务完成前须保持可访问。
                      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、gif、svg。
                      type: string
                      enum:
                        - png
                        - jpeg
                        - webp
                        - gif
                        - svg
                      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、svg）。文生
                        SVG 默认透明，参考图转 SVG 默认不透明。
                      type: string
                      enum:
                        - transparent
                        - opaque
                        - auto
                    complexity:
                      description: 规划复杂度：low、medium、high（默认），不单独收费。
                      type: string
                      enum:
                        - low
                        - medium
                        - high
                      default: high
                    safety_identifier:
                      description: 可选的终端用户标识，用于滥用监控（最多 128 字符）。
                      type: string
                      maxLength: 128
                    markup_url:
                      description: >-
                        与首张参考图同尺寸的透明 PNG 标注层（HTTPS 链接或 PNG Data URL；首图与标注层均 ≤
                        16,777,216 像素，标注层 ≤ 50 MB）。须配合 image_urls，不可与
                        mask_url、GIF 或 SVG 同用；任务完成前须保持可访问。
                      anyOf:
                        - type: string
                          pattern: ^[hH][tT][tT][pP][sS]:\/\/
                        - type: string
                          pattern: ^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$
                    frame_count:
                      description: >-
                        GIF 帧数（2–16，默认 9），仅 output_format 为 gif 时可用。拼图网格：2–8 帧
                        4×2、9 帧 3×3、10–12 帧 4×3、13–16 帧 4×4（行列可互换；整图单边 ≤ 3840、面积
                        ≤ 8,294,400、比例 ≤ 3:1）。
                      type: integer
                      minimum: 2
                      maximum: 16
                      default: 9
                    frame_duration_ms:
                      description: >-
                        GIF 单帧时长（毫秒，最小 20，默认 200，按 10 ms 取整），仅 output_format 为
                        gif 时可用。
                      type: integer
                      minimum: 20
                      maximum: 9007199254740991
                      default: 200
                    svg:
                      description: >-
                        output_format 为 svg 时必填。指定支持的写入模型 model；可选
                        reasoning.effort 接受
                        none/minimal/low/medium/high/xhigh/max（不区分大小写，省略或 null
                        使用写入模型默认档位，各模型支持档位不同）。写入模型报价暂不可用时返回 503
                        svg_pricing_unavailable，请稍后重试。
                      type: object
                      properties:
                        model:
                          type: string
                          enum:
                            - gpt-5.4-mini
                            - gpt-5.4
                            - gpt-5.5
                            - gpt-5.6-sol
                            - gpt-6-luna
                            - gpt-6.1-sol
                            - gpt-6-astra
                        reasoning:
                          anyOf:
                            - type: object
                              properties:
                                effort:
                                  anyOf:
                                    - type: string
                                      pattern: >-
                                        ^([nN][oO][nN][eE]|[mM][iI][nN][iI][mM][aA][lL]|[lL][oO][wW]|[mM][eE][dD][iI][uU][mM]|[hH][iI][gG][hH]|[xX][hH][iI][gG][hH]|[mM][aA][xX])$
                                    - type: 'null'
                              additionalProperties: false
                            - type: 'null'
                      required:
                        - model
                      additionalProperties: false
                  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
                              - svg
                    - if:
                        required:
                          - mask_url
                      then:
                        required:
                          - image_urls
                        properties:
                          image_urls:
                            minItems: 1
                    - if:
                        required:
                          - markup_url
                      then:
                        required:
                          - image_urls
                        properties:
                          image_urls:
                            minItems: 1
                    - not:
                        required:
                          - mask_url
                          - markup_url
                    - if:
                        properties:
                          output_format:
                            enum:
                              - gif
                              - svg
                        required:
                          - output_format
                      then:
                        not:
                          anyOf:
                            - required:
                                - mask_url
                            - required:
                                - markup_url
                            - required:
                                - output_compression
                    - if:
                        properties:
                          output_format:
                            enum:
                              - gif
                        required:
                          - output_format
                      then:
                        if:
                          not:
                            required:
                              - size
                        then:
                          properties:
                            aspect_ratio:
                              const: auto
                    - if:
                        properties:
                          output_format:
                            enum:
                              - svg
                        required:
                          - output_format
                      then:
                        required:
                          - svg
                        properties:
                          'n':
                            const: 1
                    - if:
                        required:
                          - frame_count
                      then:
                        required:
                          - output_format
                        properties:
                          output_format:
                            const: gif
                    - if:
                        required:
                          - frame_duration_ms
                      then:
                        required:
                          - output_format
                        properties:
                          output_format:
                            const: gif
                    - if:
                        required:
                          - svg
                      then:
                        required:
                          - output_format
                        properties:
                          output_format:
                            const: svg
                  description: 模型输入参数；省略可选字段时使用模型默认值。
                callback_url:
                  type: string
                  format: uri
                  description: 任务完成时接收签名回调的公网 HTTPS 地址。须为可直接访问的地址，不能跳转到其他地址。省略时可轮询查询任务接口。
            example:
              model: gpt-image-2.6-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.6-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.6-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.6-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.