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

# Text to Image



## OpenAPI

````yaml api-reference/en/zmodelImage/minimax/image-generation/text-to-image.json POST /minimax/v1/image_generation
openapi: 3.0.1
info:
  title: MiniMax Image Generation API
  description: Use this API to input text content for image generation.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.powertokens.ai
security:
  - bearerAuth: []
paths:
  /minimax/v1/image_generation:
    post:
      tags:
        - Image
      summary: Image Generation
      operationId: imageGeneration
      parameters:
        - name: Content-Type
          in: header
          required: true
          description: >-
            Media type of the request body. Set to `application/json` to ensure
            the request data is in JSON format.
          schema:
            type: string
            enum:
              - application/json
            default: application/json
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageGenerationReq'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageGenerationResp'
components:
  schemas:
    ImageGenerationReq:
      type: object
      required:
        - prompt
        - model
      properties:
        model:
          type: string
          description: 'Model name. Available value: `image-01`.'
          enum:
            - image-01
        prompt:
          type: string
          description: Text description of the image, up to 1500 characters.
        style:
          allOf:
            - $ref: '#/components/schemas/StyleObject'
          description: Style settings. Only takes effect when `model` is `image-01-live`.
        aspect_ratio:
          type: string
          description: |-
            Image aspect ratio. Defaults to `1:1`. Available values:
            - `1:1` (1024x1024)
            - `16:9` (1280x720)
            - `4:3` (1152x864)
            - `3:2` (1248x832)
            - `2:3` (832x1248)
            - `3:4` (864x1152)
            - `9:16` (720x1280)
            - `21:9` (1344x576) (only for `image-01`)
          enum:
            - '1:1'
            - '16:9'
            - '4:3'
            - '3:2'
            - '2:3'
            - '3:4'
            - '9:16'
            - '21:9'
        width:
          type: integer
          description: >-
            Width of the generated image in pixels. Only takes effect when model
            is `image-01`. Note: `width` and `height` must be set together,
            value range [512, 2048], and must be a multiple of 8. If set
            together with `aspect_ratio`, `aspect_ratio` takes precedence.
        height:
          type: integer
          description: >-
            Height of the generated image in pixels. Only takes effect when
            model is `image-01`. Note: `width` and `height` must be set
            together, value range [512, 2048], and must be a multiple of 8. If
            set together with `aspect_ratio`, `aspect_ratio` takes precedence.
        response_format:
          type: string
          enum:
            - url
            - base64
          default: url
          description: >-
            Format of the returned image. Defaults to `url`. Available values:
            `url`, `base64`.

            ⚠️ Note: URLs are valid for 24 hours.
        seed:
          type: integer
          format: int64
          description: >-
            Random seed. Using the same seed and parameters can generate images
            with similar content for reproducible results. If not provided, a
            random seed is generated for each of the n images.
        'n':
          type: integer
          default: 1
          minimum: 1
          maximum: 9
          description: >-
            Number of images to generate per request, range [1, 9]. Defaults to
            1.
        prompt_optimizer:
          type: boolean
          default: false
          description: >-
            Whether to enable automatic prompt optimization. Defaults to
            `false`.
        aigc_watermark:
          type: boolean
          description: >-
            Whether to add a watermark to the generated image. Defaults to
            `false`.
      example:
        model: image-01
        prompt: |-
          A man in a white t-shirt, full-body, standing front view, outdoors,
          with the Venice Beach sign in the background, Los Angeles. Fashion
          photography in 90s documentary style, film grain, photorealistic.
        aspect_ratio: '16:9'
        response_format: url
        'n': 3
        prompt_optimizer: true
    ImageGenerationResp:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/DataObject'
        metadata:
          type: object
          properties:
            success_count:
              type: integer
              description: Number of successfully generated images
            failed_count:
              type: integer
              description: Number of images blocked due to content safety.
          description: Number of images not returned due to content safety check failures.
        id:
          type: string
          description: ID of the generation task, used for subsequent task status queries.
        base_resp:
          $ref: '#/components/schemas/BaseResp'
      example:
        id: 03ff3cd0820949eb8a410056b5f21d38
        data:
          image_urls:
            - XXX
            - XXX
            - XXX
        metadata:
          failed_count: '0'
          success_count: '3'
        base_resp:
          status_code: 0
          status_msg: success
    StyleObject:
      type: object
      required:
        - style_type
      properties:
        style_type:
          type: string
          description: >-
            Style type. Available values: `漫画` (comic), `元气` (vibrant), `中世纪`
            (medieval), `水彩` (watercolor).
        style_weight:
          type: number
          format: float
          description: Style weight. Value range `(0, 1]`. Defaults to `0.8`.
    DataObject:
      type: object
      properties:
        image_urls:
          type: array
          items:
            type: string
          description: Returned when `response_format` is `url`. Array of image URLs.
        image_base64:
          type: array
          items:
            type: string
          description: >-
            Returned when `response_format` is `base64`. Array of Base64-encoded
            images.
    BaseResp:
      type: object
      properties:
        status_code:
          type: integer
          description: >-
            Status codes:

            - 0: Request succeeded

            - 1002: Rate limit triggered, please retry later

            - 1004: Authentication failed, please check if the API-Key is
            correct

            - 1008: Insufficient balance

            - 1026: Image description involves sensitive content

            - 2013: Invalid input parameters, please check if the parameters are
            filled in correctly

            - 2049: Invalid API key
        status_msg:
          type: string
          description: Error details
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````