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

# Create Image Task

> Creates an asynchronous text-to-image or image-to-image generation task.



## OpenAPI

````yaml POST /v1/images/generations
openapi: 3.1.0
info:
  title: Loova API
  description: Loova API lets developers generate AI images and videos programmatically.
  version: 1.0.0
servers:
  - url: https://api.loova.ai/api
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: Create Image Task
      description: Creates an asynchronous text-to-image or image-to-image generation task.
      operationId: createImageTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateImageTaskRequest'
            examples:
              textToImage:
                summary: Text-to-image
                value:
                  model: gpt_image_2
                  prompt: A small orange cat beside a green plant
                  aspect_ratio: '1:1'
                  resolution: 1K
                  quality: low
                  count: 1
              imageToImage:
                summary: Image-to-image using public URLs
                value:
                  model: nano_banana_2
                  prompt: Transform this image into a colorful illustration
                  image_urls:
                    - https://example.com/input.png
                  aspect_ratio: '1:1'
                  resolution: 1K
                  count: 1
      responses:
        '200':
          description: Task created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateImageTaskResponse'
              example:
                code: 200
                trace_id: 45c30d76f06549b199a3775544523689
                message: null
                data:
                  task_id: record_id
                  status: running
                  created_at: '2026-07-15T12:00:00Z'
                  credits_cost: 2
        '400':
          description: >-
            Invalid request, inaccessible image URL, or unsupported model
            parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Business-level rejection such as insufficient API credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateImageTaskRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          enum:
            - gpt_image_2
            - nano_banana_2_lite
            - nano_banana_2
            - nano_banana_pro
            - gemini_25_flash_image
          description: Image model to use.
        prompt:
          type: string
          minLength: 1
          description: Text instruction for image generation or editing.
        image_urls:
          type: array
          items:
            type: string
            format: uri
          default: []
          maxItems: 16
          description: >-
            Publicly accessible HTTP or HTTPS input image URLs. Omit or pass an
            empty array for text-to-image. `gpt_image_2` accepts up to 16
            images; the other models accept up to 14. Multipart file upload is
            not supported.
        aspect_ratio:
          type: string
          default: auto
          enum:
            - auto
            - '9:16'
            - '2:3'
            - '3:4'
            - '4:5'
            - '1:1'
            - '5:4'
            - '4:3'
            - '3:2'
            - '16:9'
            - '21:9'
            - '9:21'
            - '1:2'
            - '2:1'
            - '1:4'
            - '4:1'
            - '1:8'
            - '8:1'
          description: >-
            Output aspect ratio. Supported values vary by model; `auto` lets the
            model infer the ratio.
        resolution:
          type: string
          default: 1K
          enum:
            - 1K
            - 2K
            - 4K
          description: >-
            Output resolution. `nano_banana_2_lite` and `gemini_25_flash_image`
            support only `1K`; the other models support `1K`, `2K`, and `4K`.
        quality:
          type: string
          default: auto
          enum:
            - auto
            - low
            - medium
            - high
          description: Output quality for `gpt_image_2`. Other models ignore this field.
        count:
          type: integer
          minimum: 1
          maximum: 4
          default: 1
          description: 'Number of output images. '
      description: >-
        Validation rules:

        - Requests must use `application/json`; multipart file upload is not
        supported

        - `model` and a non-empty `prompt` are required

        - `image_urls` must contain publicly accessible HTTP or HTTPS image URLs

        - An empty `image_urls` array creates a text-to-image task; a non-empty
        array creates an image-to-image task
    CreateImageTaskResponse:
      type: object
      properties:
        code:
          type: integer
        trace_id:
          type: string
        message:
          type:
            - string
            - 'null'
        data:
          type: object
          properties:
            task_id:
              type: string
            status:
              type: string
              enum:
                - running
            created_at:
              type: string
              format: date-time
            credits_cost:
              type: number
    ErrorResponse:
      type: object
      properties:
        code:
          type: integer
        trace_id:
          type: string
        message:
          type:
            - string
            - 'null'
        data:
          type:
            - object
            - 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````