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

# GPT Image 2

> Generate an image from a text prompt using the GPT Image 2 model.



## OpenAPI

````yaml en/api-reference/model-api/openai/openapi/gpt-image-2/openapi.yaml POST /v1/images/generations
openapi: 3.1.0
info:
  title: GPT Image 2
  description: Use GPT Image 2 Generate an image
  version: 1.0.0
servers:
  - url: https://ai.cubeuaeai.com
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: Generate an image
      description: Generate an image from a text prompt using the GPT Image 2 model.
      operationId: createGptImage2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  enum:
                    - gpt-image-2
                  description: model ID
                  example: gpt-image-2
                prompt:
                  type: string
                  description: Image description text
                  example: A sunset skyline of a futuristic city with flying cars
                'n':
                  type: integer
                  minimum: 1
                  maximum: 10
                  default: 1
                  description: >-
                    Number of images to generate, `1–10`, default `1`. **Select
                    the Direct group in the console.**
                  example: 1
                size:
                  type: string
                  default: 1024x1024
                  description: >-
                    Output image size in `{width}x{height}` format. Flexible
                    resolution is supported — each side must be a multiple of
                    16, aspect ratio ≤ 3:1, total pixels 655,360–8,294,400, max
                    side 3,840px.
                  example: 1024x1024
                quality:
                  type: string
                  enum:
                    - low
                    - medium
                    - high
                  default: medium
                  description: Image quality
                  example: high
                output_format:
                  type: string
                  enum:
                    - png
                    - jpeg
                  default: png
                  description: Output image format
                  example: png
                moderation:
                  type: string
                  enum:
                    - auto
                    - low
                  default: auto
                  description: Content moderation level
                  example: auto
                output_compression:
                  type: integer
                  minimum: 0
                  maximum: 100
                  description: Compression level for jpeg (0-100%)
                  example: 80
      responses:
        '200':
          description: Image generated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: Array of generated images
                    items:
                      type: object
                      properties:
                        b64_json:
                          type: string
                          description: Base64-encoded image data
                        revised_prompt:
                          type: string
                          description: Prompt rewritten by the model
        '400':
          description: Request error. Invalid parameters.
        '401':
          description: Unauthorized. The API key is invalid or missing.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````