> ## 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.

# Grok Imagine Image 2.0 Edit

> [Core Function] Grok Imagine Image 2.0 Edit edits one to three source images from a text prompt. [Strengths] It supports quality (low or medium), 1k or 2k resolution, and the same aspect ratios as Grok Imagine Image 2.0. [Best For] Highly recommended for: restyling, combining up to 3 references, and iterative refinement. [Limitations] Requires at least one source image; at most 3 images per request. This model does not generate from text alone. [Routing] For text-to-image generation, use Grok Imagine Image 2.0.



## OpenAPI

````yaml /media-model-api/xai/xai-i2i.json post /xai/grok-imagine-image-2.0-edit
openapi: 3.1.0
info:
  description: >-
    The image-to-image (image editing) models API from xAI Grok Imagine. Edits
    one to three source images according to a text prompt and returns the result
    synchronously via the async task interface.
  version: 1.0.0
  contact:
    name: Modellix Support
    email: support@modellix.ai
  title: xAI Grok Imagine Image-to-Image Models API
servers:
  - url: https://api.modellix.ai/api/v1
    description: The image-to-image models API from xAI Grok Imagine.
security:
  - bearerAuth: []
paths:
  /xai/grok-imagine-image-2.0-edit:
    post:
      summary: Grok Imagine Image 2.0 Edit
      description: >-
        [Core Function] Grok Imagine Image 2.0 Edit edits one to three source
        images from a text prompt. [Strengths] It supports quality (low or
        medium), 1k or 2k resolution, and the same aspect ratios as Grok Imagine
        Image 2.0. [Best For] Highly recommended for: restyling, combining up to
        3 references, and iterative refinement. [Limitations] Requires at least
        one source image; at most 3 images per request. This model does not
        generate from text alone. [Routing] For text-to-image generation, use
        Grok Imagine Image 2.0.
      operationId: grokImagineImage20EditAsync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GrokImagineImage20EditRequest'
            examples:
              single_image:
                summary: Single source image
                value:
                  prompt: Render this as a pencil sketch with detailed shading
                  images:
                    - https://example.com/photo.png
              full_options:
                summary: Multiple images with options
                value:
                  prompt: >-
                    Blend these references into a single cohesive watercolor
                    scene
                  images:
                    - https://example.com/ref1.png
                    - https://example.com/ref2.png
                  aspect_ratio: '16:9'
                  resolution: 2k
                  quality: medium
                  response_format: url
      responses:
        '200':
          description: Task submitted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncTaskResponse'
              example:
                code: 0
                message: success
                data:
                  status: pending
                  task_id: task-xai-i2i-003
                  model_id: xai/grok-imagine-image-2.0-edit
                  get_result:
                    method: GET
                    url: https://api.modellix.ai/api/v1/tasks/task-xai-i2i-003
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    GrokImagineImage20EditRequest:
      type: object
      required:
        - prompt
        - images
      description: >-
        Edit one to three source images from a text prompt. Pass a single image
        as a one-element `images` array.
      properties:
        prompt:
          type: string
          minLength: 1
          description: Text description of the edit to apply.
          example: Render this as a pencil sketch with detailed shading
        images:
          type: array
          minItems: 1
          maxItems: 3
          description: >-
            Source image URLs to edit (1-3). Each item must be a publicly
            accessible HTTP(S) URL.
          items:
            type: string
            minLength: 1
          example:
            - https://example.com/photo.png
        'n':
          type: integer
          minimum: 1
          maximum: 10
          default: 1
          description: Number of edited images to generate.
          example: 1
        aspect_ratio:
          type: string
          enum:
            - '1:1'
            - '16:9'
            - '9:16'
            - '4:3'
            - '3:4'
            - '3:2'
            - '2:3'
            - '2:1'
            - '1:2'
            - 19.5:9
            - '9:19.5'
            - '20:9'
            - '9:20'
            - '21:9'
            - '5:2'
            - auto
          description: >-
            Aspect ratio of the output image. If omitted, the output follows the
            first input image.
          example: '16:9'
        resolution:
          type: string
          enum:
            - 1k
            - 2k
          default: 1k
          description: Output resolution.
          example: 1k
        quality:
          type: string
          enum:
            - low
            - medium
          default: medium
          description: Generation quality.
          example: medium
        response_format:
          type: string
          enum:
            - url
            - b64_json
          default: url
          description: >-
            How images are returned: a temporary URL, or base64 in the task
            result.
          example: url
    AsyncTaskResponse:
      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:
          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 for polling
              example: task-abc123
            model_id:
              type: string
              description: Model ID in `provider/model` format
              example: xai/grok-imagine-image-edit
            get_result:
              type: object
              description: API information to query the task result
              properties:
                method:
                  type: string
                  example: GET
                url:
                  type: string
                  example: https://api.modellix.ai/api/v1/tasks/task-abc123
          description: Detailed data about the submitted asynchronous task.
    ErrorResponse:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 400
        message:
          type: string
          example: 'Invalid parameters: parameter ''images'' is required'
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 400
            message: 'Invalid parameters: parameter ''images'' is required'
    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
      headers:
        X-RateLimit-Limit:
          description: Maximum requests per minute
          schema:
            type: integer
            example: 100
        X-RateLimit-Remaining:
          description: Remaining quota in current window
          schema:
            type: integer
            example: 0
        X-RateLimit-Reset:
          description: Rate limit window reset time (Unix timestamp)
          schema:
            type: integer
            example: 1704067260
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 429
            message: >-
              Rate limit exceeded: 100 requests per minute, retry after 60
              seconds
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 500
            message: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API Key authentication. Format: `Bearer YOUR_API_KEY`.'

````