# Generate image (Text2Image)

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/v1/universal/zimage:
    post:
      summary: Generate image (Text2Image)
      deprecated: false
      description: |-
        Creates a image generation without any limitation.

        - `steps` max: 30
        - `width`/`height` max: 1024, must be divisible by 8
        - `n` is effectively fixed to `1`

        Pricing:
        1 credit per image base on step 4 + 512/512
        3 credit per image base on step 8 + 768/768
        5 credit per image base on step 20 + 1024/1024
      operationId: zimageGenerate
      tags:
        - Text2Image model
        - Zimage
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ZimageGenerateRequest'
            examples:
              quickGeneration:
                value:
                  prompt: a serene mountain landscape at sunset, photorealistic
                  steps: 4
                  width: 512
                  height: 512
                summary: Quick Generation (1 credit)
              balancedQuality:
                value:
                  prompt: >-
                    futuristic cityscape at night, neon lights, cyberpunk style,
                    highly detailed
                  negative_prompt: blurry, low quality, distorted, ugly
                  steps: 8
                  width: 768
                  height: 768
                  cfg_scale: 0
                summary: Balanced Quality (3 credits)
              withPromptUpsampling:
                value:
                  prompt: sunset over ocean
                  prompt_upsampling: true
                  steps: 4
                  width: 512
                  height: 512
                summary: With AI Prompt Enhancement
              webhookNotification:
                value:
                  prompt: magical forest, glowing mushrooms, ethereal atmosphere
                  steps: 6
                  width: 768
                  height: 768
                  webhookOverride: https://your-domain.com/webhook/zimage
                summary: With Webhook Notification
      responses:
        '200':
          description: Generation task created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageCreateResponse'
              example:
                success: true
                messageId: 01JFBK2D4R3PZ8Z7R1V7K5P8ZQ
                createdAt: '2025-12-16 11:59:59'
          headers: {}
          x-apifox-name: ''
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema: &ref_0
                $ref: '#/components/schemas/NestError'
              example:
                statusCode: 400
                message: width must be divisible by 8
                error: Bad Request
          headers: {}
          x-apifox-name: ''
        '401':
          description: Authentication failed
          content:
            application/json:
              schema: *ref_0
              example:
                statusCode: 401
                message: Unauthorized
          headers: {}
          x-apifox-name: ''
        '403':
          description: Insufficient credits or quota
          content:
            application/json:
              schema: *ref_0
              example:
                statusCode: 403
                message: Insufficient credits to process request
          headers: {}
          x-apifox-name: ''
        '500':
          description: Service unavailable or internal error
          content:
            application/json:
              schema: *ref_0
              example:
                statusCode: 500
                message: Zimage service is not available. Please contact support.
          headers: {}
          x-apifox-name: ''
      security:
        - bearerAuth: []
          x-apifox:
            schemeGroups:
              - id: 8icru9gA5wHpLvl3-4_nV
                schemeIds:
                  - bearerAuth
            required: true
            use:
              id: 8icru9gA5wHpLvl3-4_nV
            scopes:
              8icru9gA5wHpLvl3-4_nV:
                bearerAuth: []
      x-apifox-folder: Text2Image model
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/5160896/apis/api-392314598-run
components:
  schemas:
    ZimageGenerateRequest:
      type: object
      additionalProperties: false
      required:
        - prompt
      properties:
        prompt:
          type: string
          description: Positive text prompt describing the desired image.
          minLength: 1
          maxLength: 2000
          examples:
            - >-
              a serene mountain landscape at sunset, photorealistic, 8k uhd,
              golden hour lighting
        negative_prompt:
          type: string
          description: Negative prompt describing what to avoid in the image.
          maxLength: 1000
          examples:
            - >-
              blurry, distorted, low quality, watermark, text, cropped, out of
              frame
        seed:
          type: integer
          description: Random seed for reproducible generation.
          minimum: 0
          maximum: 2147483647
          examples:
            - 42
        steps:
          type: integer
          description: Number of diffusion steps (max 30).
          minimum: 1
          maximum: 30
          default: 4
          examples:
            - 4
        cfg_scale:
          type: number
          description: Classifier-free guidance scale (recommended 0.0 for Z-Image Turbo).
          minimum: 0
          maximum: 20
          default: 0
          examples:
            - 0
        width:
          type: integer
          description: Output image width in pixels (divisible by 8, max 1024).
          minimum: 64
          maximum: 1024
          multipleOf: 8
          default: 512
          examples:
            - 512
        height:
          type: integer
          description: Output image height in pixels (divisible by 8, max 1024).
          minimum: 64
          maximum: 1024
          multipleOf: 8
          default: 512
          examples:
            - 512
        sampler:
          type: string
          description: Sampler algorithm name (if supported by backend).
          examples:
            - euler
        scheduler:
          type: string
          description: Scheduler name (if supported by backend).
          examples:
            - karras
        prompt_upsampling:
          type: boolean
          description: Enable AI-powered prompt enhancement (costs extra credits).
          default: false
          examples:
            - false
        webhookOverride:
          type: string
          format: uri
          description: Webhook URL to receive generation completion notifications.
          examples:
            - https://your-domain.com/webhook/zimage
        'n':
          type: integer
          description: Number of images to generate (currently fixed to 1).
          minimum: 1
          maximum: 1
          default: 1
          examples:
            - 1
        timeout:
          type: integer
          description: Maximum time (seconds) to wait for completion.
          minimum: 30
          maximum: 600
          default: 300
          examples:
            - 300
        ref:
          type: string
          description: Reference identifier for tracking.
          examples:
            - my-client-job-123
      x-apifox-orders:
        - prompt
        - negative_prompt
        - seed
        - steps
        - cfg_scale
        - width
        - height
        - sampler
        - scheduler
        - prompt_upsampling
        - webhookOverride
        - 'n'
        - timeout
        - ref
      x-apifox-ignore-properties: []
      x-apifox-folder: ''
    MessageCreateResponse:
      type: object
      additionalProperties: false
      required:
        - success
      properties:
        success:
          type: boolean
          examples:
            - true
        messageId:
          type: string
          description: >-
            Task/message identifier you can use to poll status elsewhere in the
            API.
          examples:
            - 01JFBK2D4R3PZ8Z7R1V7K5P8ZQ
        createdAt:
          type: string
          description: Creation timestamp (server formatted).
          examples:
            - '2025-12-16 11:59:59'
      x-apifox-orders:
        - success
        - messageId
        - createdAt
      x-apifox-ignore-properties: []
      x-apifox-folder: ''
    NestError:
      type: object
      additionalProperties: true
      required:
        - statusCode
        - message
      properties:
        statusCode:
          type: integer
          examples:
            - 400
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          examples:
            - Bad Request
        error:
          type: string
          examples:
            - Bad Request
      x-apifox-orders:
        - statusCode
        - message
        - error
      x-apifox-ignore-properties: []
      x-apifox-folder: ''
  securitySchemes:
    bearerAuth:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
servers:
  - url: https://api.imaginepro.ai
    description: Prod Env
security: []

```
