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

# Create a z-image task

> Create an asynchronous z-image text-to-image task.



## OpenAPI

````yaml openapi/wan-z-image.yaml POST /z-images/generations
openapi: 3.1.0
info:
  title: Wan z-image API
  version: 1.0.0
  description: Provider-specific GENGEN reference for asynchronous z-image generation.
servers:
  - url: https://gengen.farm/api/gengen/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /z-images/generations:
    post:
      summary: Create a z-image task
      description: Create an asynchronous text-to-image task with `z-image-spicy`.
      operationId: createZImageTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateZImageTaskRequest'
            example:
              model: z-image-spicy
              prompt: A watercolor painting of a serene mountain lake
              controls:
                width: 1536
                height: 1024
                seed: 42
                promptExtend: false
      responses:
        '200':
          description: The task was accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageTask'
              example:
                id: zimage:550e8400-e29b-41d4-a716-446655440000
                model: z-image-spicy
                status: pending
                outputs:
                  images: []
                createdAt: '2026-06-18T08:00:00.000Z'
                updatedAt: '2026-06-18T08:00:00.000Z'
                statusUpdateTime: '2026-06-18T08:00:00.000Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        default:
          $ref: '#/components/responses/UnexpectedError'
      x-codeSamples:
        - lang: bash
          label: Create task
          source: |
            curl --request POST \
              --url https://gengen.farm/api/gengen/v1/z-images/generations \
              --header 'Authorization: Bearer gengen_live_xxxxxxxxxxxxxxxx' \
              --header 'Content-Type: application/json' \
              --data '{
                "model": "z-image-spicy",
                "prompt": "A watercolor painting of a serene mountain lake",
                "controls": {
                  "width": 1536,
                  "height": 1024,
                  "seed": 42,
                  "promptExtend": false
                }
              }'
components:
  schemas:
    CreateZImageTaskRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          const: z-image-spicy
          description: Use the `z-image-spicy` model.
        prompt:
          type: string
          minLength: 1
          description: Describe the image to generate.
        controls:
          $ref: '#/components/schemas/ZImageControls'
      additionalProperties: false
    ImageTask:
      type: object
      required:
        - id
        - model
        - status
        - outputs
      properties:
        id:
          type: string
        model:
          type: string
        status:
          type: string
        outputs:
          $ref: '#/components/schemas/ImageOutputs'
        failureReason:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        statusUpdateTime:
          type: string
          format: date-time
      additionalProperties: true
    ZImageControls:
      type: object
      properties:
        width:
          type: integer
          minimum: 256
          maximum: 1536
          default: 1024
        height:
          type: integer
          minimum: 256
          maximum: 1536
          default: 1536
        seed:
          description: Pass `null`, `0`, or omit for provider-selected randomness.
          oneOf:
            - type: integer
            - type: 'null'
        promptExtend:
          type: boolean
          default: true
          description: Allow the provider to rewrite and expand the prompt.
      additionalProperties: false
    ImageOutputs:
      type: object
      required:
        - images
      properties:
        images:
          type: array
          items:
            type: string
            format: uri
      additionalProperties: true
    Error:
      type: object
      properties:
        error_code:
          type: string
        error:
          type: string
        error_params:
          type: object
          additionalProperties: true
      additionalProperties: true
  responses:
    BadRequest:
      description: The request is invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: The bearer token is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PaymentRequired:
      description: The workspace does not have enough available balance.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The API key is not authorized for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnexpectedError:
      description: GENGEN or the Wan provider could not complete the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: GENGEN API key
      description: A workspace API key beginning with `gengen_live_`.

````