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

# GPT-Image

> Generate images based on text prompts and image resources 



## OpenAPI

````yaml POST /gpt/v1/generations
openapi: 3.1.0
info:
  title: OpenAPI Plant Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.aiairouter.com
security:
  - CustomApiKey: []
paths:
  /gpt/v1/generations:
    post:
      description: 'Generate images based on text prompts and image resources '
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GptCreate'
        required: true
      responses:
        '200':
          description: Request successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommonRes'
        '400':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - CustomApiKey: []
components:
  schemas:
    GptCreate:
      required:
        - prompt
      type: object
      properties:
        prompt:
          description: >-
            Text prompt for image generation.<br /><br />Since this is a
            reverse-engineered model, it's recommended to include keywords in
            your prompt such as:<br />- "draw a xxx"<br />- "generate a xxx"<br
            /><br />Language is not restricted; OpenAI itself supports
            multilingual models with excellent Chinese support.
          type: string
          example: draw a boy play with a girl
        model:
          type: string
          example: gpt-image-2
          description: 'Supported models: gpt-image-2'
          enum:
            - gpt-image-2
        referImages:
          type: array
          example:
            - https://example.com/image.png
            - https://example.com/image.png
          description: Reference image array
          items:
            type: string
        aspect_ratio:
          type: string
          example: '1:1'
          description: >-
            Support model: gpt-image-2<br /><br />Available options:<br />-
            1:1<br />- 1:2<br />- 2:1<br />- 3:4<br />- 4:3<br />- 16:9<br />-
            9:16
          enum:
            - '1:1'
            - '1:2'
            - '2:1'
            - '3:4'
            - '4:3'
            - '16:9'
            - '9:16'
        size:
          type: string
          example: 1K
          description: >-
            Support model: gpt-image-2<br /><br />Available options: 1K, 4K<br
            />Default: 1K<br /><br />4K is better at keeping other areas
            unchanged in image editing scenarios
          enum:
            - 1K
            - 4K
        output_size:
          type: string
          example: 1920x1080
          description: >-
            Support model: gpt-image-2. Custom output width and height in
            WIDTHxHEIGHT format, e.g. "1920x1080". Only takes effect when size
            is "4K"; ignored for 1K.<br /><br />A parsed value overrides
            aspect_ratio. Unparseable values are ignored and the request keeps
            aspect_ratio sizing.<br /><br />The server auto-corrects a parsed
            value:<br />- both sides snapped to multiples of 16<br />- longest
            edge ≤ 3840<br />- aspect ratio clamped to 1:3–3:1<br />- total
            pixels clamped to 655360–8294400<br /><br />Examples:<br />-
            "100x100" → 816x816<br />- "1920x1080" → 1920x1088<br />- "5000x100"
            → 3840x1280<br />- "10000x10000" → 2880x2880
        hookUrl:
          type: string
          example: https://api.example.com/webhook
          description: Callback notification URL
    CommonRes:
      required:
        - status
        - data
      type: object
      properties:
        status:
          description: >-
            Status code:<br />- 0: success<br />- 1001: quota not enough<br />-
            1002: concurrency limit, max 30
          type: integer
          example: 0
        message:
          description: Message
          type: string
          example: success
        data:
          type: object
          properties:
            taskId:
              type: string
              example: MtAd7mCuc4YqK_a1iAQSW
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
          example: 1001
        message:
          type: string
          example: quota not enough
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: API-KEY
      description: >-
        You can obtain your API key from the <a
        href='https://aiairouter.com/dashboard' target='_blank'>Midjourney-api
        Dashboard</a>.

````

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