openapi: 3.1.0
info:
  title: GPT Image 2
  version: '1.0'
  description: OpenAI gpt-image-2 image generation model. 1K / 2K / 4K resolutions with three quality tiers (low / medium / high) .
servers:
- url: https://openapi.imini.ai/imini/router
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Pass `Authorization: Bearer <YOUR_API_KEY>` in the request header. Go to the [API Keys management page](https://imini.ai/api-keys) to create and manage API Keys.
security:
- ApiKeyAuth: []
paths:
  /v1/images/generate:
    post:
      summary: GPT Image 2
      operationId: generateGptImage2
      security:
      - ApiKeyAuth: []
      description: 'Submit an asynchronous image generation task. You will need to poll the query endpoint to retrieve the result.

        > Model ID: `openai/gpt-image-2` · Underlying: OpenAI gpt-image-2

        '
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - model
              - prompt
              - resolution
              - aspect_ratio
              - quality
              properties:
                model:
                  type: string
                  description: Fixed value `openai/gpt-image-2`.
                prompt:
                  type: string
                  description: The prompt. Up to **32000** characters. Supports English and Chinese; detail-rich descriptions yield better results.
                  example: A majestic snow-capped mountain at golden hour, ultra-realistic
                    photography
                images:
                  type: array
                  description: Reference image list. **Omitting or passing an empty array** means text-to-image mode; passing images switches to image-to-image / style reference mode. Up to **3** images.
                  items:
                    type: object
                    properties:
                      url:
                        type: string
                        description: 'Reference image address, in one of two forms:
                          **1)** A publicly accessible URL (starting with `http://` or `https://`);
                          **2)** A Data URI base64 encoding (starting with `data:image/`, e.g., `data:image/png;base64,iVBORw0KGgo...`). Supported formats: `png`
                          / `jpg` / `webp`, decoded size up to **10MB**.'
                      reference_type:
                        type: string
                        description: 'Reference type. Optional — defaults to `asset`.

                          - `asset` — content reference'
                        default: asset
                        enum:
                        - asset
                  maxItems: 3
                resolution:
                  type: string
                  description: 'Output resolution tier (required): `1K` / `2K` / `4K`.'
                  enum:
                  - 1K
                  - 2K
                  - 4K
                aspect_ratio:
                  type: string
                  description: 'Output aspect ratio (required). Allowed values:


                    `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: 'Rendering quality (required):


                    - `low` — fastest and cheapest, for drafts and batch generation

                    - `medium` — balanced


                    - `high` — most detailed, for finals and cover art


                    Quality is orthogonal to resolution: within a given `resolution`, `quality` only changes visual detail and cost, not the output dimensions.'
                  enum:
                  - low
                  - medium
                  - high
                num:
                  type: integer
                  description: Number of images to generate per call, 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: Submitted successfully
          content:
            application/json:
              schema:
                oneOf:
                - title: Submit Success (Pending)
                  type: object
                  properties:
                    task_id:
                      type: string
                      description: Unique task ID, used for subsequent polling
                      example: task_2041350318103396352
                    model:
                      type: string
                      description: The model ID used for this task
                      example: openai/gpt-image-2
                    created_at:
                      type: string
                      description: Task creation time
                      example: 2026-04-23T03:00:17.062Z
                    request_id:
                      type: string
                      description: Unique request 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
