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

# GPT Image 2

> OpenAI gpt-image-2 图像生成模型，1K / 2K / 4K 分辨率 × 3 档画质，最多 6 张参考图



## OpenAPI

````yaml /zh/openapi/images/gpt-image-2.yaml POST /v1/images/generate
openapi: 3.1.0
info:
  title: GPT Image 2
  version: '1.0'
  description: OpenAI gpt-image-2 图像生成模型，支持 1K / 2K / 4K 与 3 档画质 (low / medium / high)。
servers:
  - url: https://openapi.imini.ai/imini/router
security:
  - ApiKeyAuth: []
paths:
  /v1/images/generate:
    post:
      summary: GPT Image 2
      description: |
        提交异步的图像生成任务，后续需通过轮询接口查询结果。
        > 模型 ID：`openai/gpt-image-2` · 底层：OpenAI gpt-image-2
      operationId: generateGptImage2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
                - resolution
                - aspect_ratio
                - quality
              properties:
                model:
                  type: string
                  description: 固定值 `openai/gpt-image-2`
                prompt:
                  type: string
                  description: 提示词，不超过 **32000** 字符。支持中英文，推荐使用细节丰富的描述以获得更好的生成效果。
                  example: >-
                    A majestic snow-capped mountain at golden hour,
                    ultra-realistic photography
                images:
                  type: array
                  description: 参考图列表。**不传或传空数组**则为文生图模式；传入图像则进入图生图 / 风格参考模式。最多 **3** 张。
                  items:
                    type: object
                    properties:
                      url:
                        type: string
                        description: >-
                          参考图地址，支持两种形式： **1)** 公网可访问的 URL（以 `http://` 或
                          `https://` 开头）； **2)** Data URI 格式的 base64 编码（以
                          `data:image/` 开头，例如
                          `data:image/png;base64,iVBORw0KGgo...`），支持的格式：`png` /
                          `jpg` / `webp`，解码后大小不超过 **10MB**。
                      reference_type:
                        type: string
                        description: |-
                          参考类型，可不传（默认 `asset`）。
                          - `asset` — 内容参考
                        default: asset
                        enum:
                          - asset
                  maxItems: 3
                resolution:
                  type: string
                  description: 输出清晰度档位（必填）：`1K` / `2K` / `4K`
                  enum:
                    - 1K
                    - 2K
                    - 4K
                aspect_ratio:
                  type: string
                  description: >-
                    输出宽高比（必填），可选值：


                    `1:1` `2:3` `3:2` `3:4` `4:3` `4:5` `5:4` `9:16` `16:9`
                    `21:9` `9:21`
                  enum:
                    - '1:1'
                    - '2:3'
                    - '3:2'
                    - '3:4'
                    - '4:3'
                    - '4:5'
                    - '5:4'
                    - '9:16'
                    - '16:9'
                    - '21:9'
                    - '9:21'
                quality:
                  type: string
                  description: |-
                    生成画质（必填）：

                    - `low` — 最快、最便宜，适合草稿 / 批量生成
                    - `medium` — 均衡

                    - `high` — 最细致，适合终稿 / 封面图

                    画质与清晰度正交：同一 `resolution` 下 `quality` 仅影响细节表现与成本，不影响输出尺寸。
                  enum:
                    - low
                    - medium
                    - high
                num:
                  type: integer
                  description: 一次生成的图片数量，1-10。
                  default: 1
                  minimum: 1
                  maximum: 10
            examples:
              Text to Image:
                summary: Text to Image
                value:
                  model: openai/gpt-image-2
                  prompt: >-
                    A cute shiba inu in a spacesuit standing on the moon, 3D
                    cartoon style
                  aspect_ratio: '1:1'
                  resolution: 1K
                  quality: medium
              Image Edit:
                summary: Image Edit
                value:
                  model: openai/gpt-image-2
                  prompt: Blend these two images into one coherent scene
                  images:
                    - url: https://example.com/input-1.png
                      reference_type: asset
                    - url: https://example.com/input-2.png
                      reference_type: asset
                  aspect_ratio: '16:9'
                  resolution: 2K
                  quality: high
              Image Edit (base64):
                summary: Image Edit (base64)
                value:
                  model: openai/gpt-image-2
                  prompt: Add a hot-air balloon in the sky
                  images:
                    - url: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
                      reference_type: asset
                  aspect_ratio: '4:3'
                  resolution: 1K
                  quality: medium
      responses:
        '200':
          description: 提交成功
          content:
            application/json:
              schema:
                oneOf:
                  - title: Submit Success (Pending)
                    type: object
                    properties:
                      task_id:
                        type: string
                        description: 任务唯一 ID，用于后续轮询查询
                        example: task_2041350318103396352
                      model:
                        type: string
                        description: 本次任务使用的模型 ID
                        example: openai/gpt-image-2
                      created_at:
                        type: string
                        description: 任务创建时间
                        example: '2026-04-23T03:00:17.062Z'
                      request_id:
                        type: string
                        description: 请求唯一 ID
                        example: 285f20ce-8158-401b-945c-7bc6a7ef6ead
        '400':
          description: Validation Error (e.g. invalid parameter, invalid prompt)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        description: Error code, e.g., INVALID_PROMPT
                        example: INVALID_PROMPT
                      message:
                        type: string
                        description: Error message details
                        example: Prompt contains disallowed content
                      status:
                        type: integer
                        description: HTTP status code
                        example: 400
                      request_id:
                        type: string
                        description: Unique request identifier
                        example: req_abc123
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >
        在请求 Header 中传入 `Authorization: Bearer <YOUR_API_KEY>`。前往 [API Keys
        管理页](https://imini.ai/zh/api-keys) 创建和管理 API Key。

````