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

# GPT Image 2

> [Core Function] GPT Image 2 is a state-of-the-art text-to-image generation model. [Strengths] It excels at generating highly detailed, photorealistic images from text descriptions, with native support for ultra-high resolutions including 2K and 4K (up to 3840x2160). [Best For] Highly recommended for: cinematic landscapes, detailed character portraits, high-end commercial concept art, and any scenario requiring maximum resolution and visual fidelity. [Limitations] Do NOT use this model if you need a transparent background (e.g., for icons or UI assets), as it does not support the `background: transparent` parameter. [Routing] Use this model by default for all high-quality image generation requests. If the user explicitly asks for an image with a transparent background, route to GPT Image 1.5 instead.



## OpenAPI

````yaml /model-api/openai/openai-t2i.json post /openai/gpt-image-2
openapi: 3.1.0
info:
  description: The text-to-image models API from OpenAI.
  version: 1.0.0
  contact:
    name: Modellix Support
    email: support@modellix.ai
  title: OpenAI Text-to-Image Models API
servers:
  - url: https://api.modellix.ai/api/v1
    description: The text-to-image models API from OpenAI.
security:
  - bearerAuth: []
paths:
  /openai/gpt-image-2:
    post:
      tags:
        - GPT Image
      summary: GPT Image 2
      description: >-
        [Core Function] GPT Image 2 is a state-of-the-art text-to-image
        generation model. [Strengths] It excels at generating highly detailed,
        photorealistic images from text descriptions, with native support for
        ultra-high resolutions including 2K and 4K (up to 3840x2160). [Best For]
        Highly recommended for: cinematic landscapes, detailed character
        portraits, high-end commercial concept art, and any scenario requiring
        maximum resolution and visual fidelity. [Limitations] Do NOT use this
        model if you need a transparent background (e.g., for icons or UI
        assets), as it does not support the `background: transparent` parameter.
        [Routing] Use this model by default for all high-quality image
        generation requests. If the user explicitly asks for an image with a
        transparent background, route to GPT Image 1.5 instead.
      operationId: gptImage2Async
      requestBody:
        description: Request payload for GPT Image 2 generation model.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GPTImage2Request'
            examples:
              basic:
                summary: Basic image generation
                value:
                  prompt: >-
                    A children's book drawing of a veterinarian using a
                    stethoscope to listen to the heartbeat of a baby otter
              advanced_4k:
                summary: 4K high-resolution generation
                value:
                  prompt: >-
                    Cinematic landscape of a misty mountain range at golden
                    hour, ultra detailed, photorealistic
                  size: 3840x2160
                  quality: high
      responses:
        '200':
          description: Task submitted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncTaskResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    GPTImage2Request:
      description: Request payload for GPT Image 2 generation model.
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          description: Image description text, supports up to 32,000 characters
          minLength: 1
          maxLength: 32000
          example: >-
            A children's book drawing of a veterinarian using a stethoscope to
            listen to the heartbeat of a baby otter
        size:
          type: string
          description: >-
            Output size as width x height, or 'auto' for model-selected size.
            Presets are valid under OpenAI constraints (total pixels
            655360-8294400, edges multiples of 16). Mapping: 1:1 1K/2K; 3:2
            1K/2K; 2:3 1K/2K; 4:3 1K/2K; 3:4 1K/2K; 16:9 2K/4K; 9:16 2K/4K. No
            1K for 16:9/9:16; no 4K for non-widescreen ratios.
          default: 1024x1024
          enum:
            - auto
            - 1024x1024
            - 2048x2048
            - 1536x1024
            - 3072x2048
            - 1024x1536
            - 2048x3072
            - 1024x768
            - 2048x1536
            - 768x1024
            - 1536x2048
            - 2048x1152
            - 3840x2160
            - 1152x2048
            - 2160x3840
          example: 1024x1024
        quality:
          type: string
          description: >-
            Image quality level. 'low': fast draft (default), 'medium':
            balanced, 'high': best quality
          default: low
          enum:
            - low
            - medium
            - high
          example: high
    AsyncTaskResponse:
      description: Response object for asynchronous task submission.
      type: object
      required:
        - code
        - message
        - data
      properties:
        code:
          type: integer
          description: Response code, 0 indicates success
          example: 0
        message:
          type: string
          description: Response message
          example: success
        data:
          description: Detailed data about the submitted asynchronous task.
          type: object
          required:
            - status
            - task_id
            - model_id
          properties:
            status:
              type: string
              enum:
                - pending
                - processing
              description: Task status
              example: pending
            task_id:
              type: string
              description: Unique task identifier
              example: task-openai-abc123
            model_id:
              type: string
              description: Model ID
              example: gpt-image-2
            get_result:
              type: object
              description: API information to query the task result
              properties:
                method:
                  type: string
                  description: HTTP method
                  example: GET
                url:
                  type: string
                  description: Full URL to query the task result
                  example: https://api.modellix.ai/api/v1/tasks/task-openai-abc123
    ErrorResponse:
      description: Standard error response object.
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          description: Error code (equals HTTP status code)
          example: 400
        message:
          type: string
          description: 'Error message in format ''Category: detail'''
          example: 'Invalid parameters: parameter ''prompt'' is required'
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing_prompt:
              summary: Missing required parameter
              value:
                code: 400
                message: 'Invalid parameters: parameter ''prompt'' is required'
            invalid_size:
              summary: Invalid size parameter
              value:
                code: 400
                message: 'Invalid parameters: size must be one of the supported values'
            content_violation:
              summary: Content policy violation
              value:
                code: 400
                message: 'Content policy violation: prompt contains prohibited content'
    Unauthorized:
      description: Unauthorized - Invalid or missing API Key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 401
            message: 'Authentication failed: invalid API key'
    TooManyRequests:
      description: Too many requests - Rate limit exceeded or insufficient quota
      headers:
        Retry-After:
          description: Seconds to wait before retrying (optional)
          schema:
            type: integer
            example: 20
        X-RateLimit-Limit-Requests:
          description: Maximum requests per minute
          schema:
            type: integer
            example: 5
        X-RateLimit-Limit-Tokens:
          description: Maximum tokens per minute
          schema:
            type: integer
            example: 100000
        X-RateLimit-Remaining-Requests:
          description: Remaining requests in current window
          schema:
            type: integer
            example: 0
        X-RateLimit-Remaining-Tokens:
          description: Remaining tokens in current window
          schema:
            type: integer
            example: 0
        X-RateLimit-Reset-Requests:
          description: Time when request limit resets (RFC3339 format)
          schema:
            type: string
            example: '2024-04-23T12:00:00Z'
        X-RateLimit-Reset-Tokens:
          description: Time when token limit resets (RFC3339 format)
          schema:
            type: string
            example: '2024-04-23T12:00:00Z'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rate_limit:
              summary: Rate limit exceeded
              value:
                code: 429
                message: 'Rate limit exceeded: too many requests, retry after 20 seconds'
            insufficient_quota:
              summary: Insufficient quota
              value:
                code: 429
                message: >-
                  Quota exceeded: insufficient quota, please check your plan and
                  billing
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            server_error:
              summary: Server error
              value:
                code: 500
                message: 'Internal server error: please try again later'
            service_unavailable:
              summary: Service unavailable
              value:
                code: 503
                message: 'Service unavailable: OpenAI service is temporarily unavailable'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API Key authentication. Format: `Bearer YOUR_API_KEY`.'

````