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

# Wan Text to Image

> Calls Ali `wan2.7-image-pro` to perform text-to-image generation.

The public calling convention keeps top-level `model`, `input`, `response_format`, and exposes `size`, `n`, `watermark`, `thinking_mode`, `enable_sequential`, `color_palette`, `seed` as top-level fields. The prompt is placed in `input.messages[0].content[0].text`. The request body does not accept a top-level `parameters` field.



## OpenAPI

````yaml api-reference/en/zmodelImage/ali/wan-text-to-image.json POST /v1/images/generations
openapi: 3.0.1
info:
  title: Wan text-to-image
  version: 1.0.0
  description: >-
    Ali Wan text-to-image capability documentation. The unified API endpoint is
    `/v1/images/generations`. This document describes the public gateway
    contract for `wan2.7-image-pro`: `input.messages[].content[].text` carries
    the prompt, while other control fields use top-level OpenAI-style fields
    that the gateway maps to upstream `parameters`.
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: Baze API server endpoint
security: []
tags:
  - name: Wan Image
    description: Wan text-to-image capability
paths:
  /v1/images/generations:
    post:
      tags:
        - Wan Image
      summary: Wan text-to-image
      description: >-
        Calls Ali `wan2.7-image-pro` to perform text-to-image generation.


        The public calling convention keeps top-level `model`, `input`,
        `response_format`, and exposes `size`, `n`, `watermark`,
        `thinking_mode`, `enable_sequential`, `color_palette`, `seed` as
        top-level fields. The prompt is placed in
        `input.messages[0].content[0].text`. The request body does not accept a
        top-level `parameters` field.
      operationId: aliWanTextToImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WanTextToImageRequest'
            examples:
              basic_generation:
                summary: Basic text-to-image
                value:
                  model: wan2.7-image-pro
                  response_format: url
                  input:
                    messages:
                      - role: user
                        content:
                          - text: >-
                              A flower shop with elegant windows, a beautiful
                              wooden door, displaying flowers
                  size: 2K
                  'n': 1
                  watermark: false
                  thinking_mode: true
                  seed: 0
              sequential_generation:
                summary: Sequential image generation
                value:
                  model: wan2.7-image-pro
                  response_format: url
                  input:
                    messages:
                      - role: user
                        content:
                          - text: >-
                              A cinematic image set documenting the same stray
                              orange cat with consistent features. Image 1:
                              Spring, the cat walks under blooming cherry trees;
                              Image 2: Summer, the cat rests in the shade on an
                              old street; Image 3: Autumn, the cat steps on
                              golden fallen leaves; Image 4: Winter, the cat
                              leaves footprints in the snow.
                  enable_sequential: true
                  'n': 4
                  size: 2K
                  color_palette:
                    - hex: '#C2D1E6'
                      ratio: 23.51%
                    - hex: '#CDD8E9'
                      ratio: 20.13%
                    - hex: '#B5C8DB'
                      ratio: 15.88%
      responses:
        '200':
          description: Success. Returns the image generation result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication failed, e.g. missing or invalid token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          description: Request body too large.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit triggered or insufficient account quota.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error while processing the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Upstream provider returned an abnormal response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            Upstream provider is temporarily unavailable, or no available
            channel for the current model.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    WanTextToImageRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          enum:
            - wan2.7-image-pro
          description: 'Model name. Available value: `wan2.7-image-pro`.'
        response_format:
          type: string
          enum:
            - url
            - b64_json
          description: 'Unified response format. Supported values: `url` or `b64_json`.'
          default: url
        input:
          $ref: '#/components/schemas/WanTextToImageInput'
        size:
          type: string
          description: >-
            Controls output image resolution. Supports two modes (do not mix):


            **Mode 1: Resolution preset (recommended)**

            Supported presets: `1K`, `2K` (default), `4K`.

            - Text-to-image (no input image, non-sequential): supports 1K, 2K,
            4K.

            - Other scenarios: supports 1K, 2K.

            - Pixel totals: 1K = 1024×1024, 2K = 2048×2048, 4K = 4096×4096.

            - With input image: output aspect ratio matches the last input
            image, scaled to the selected resolution.

            - Without input image: output is square.


            **Mode 2: Custom width×height**

            Format: `{width}*{height}`, e.g. `1024*768`.

            - Text-to-image: total pixels [768×768, 4096×4096], aspect ratio
            [1:8, 8:1].

            - Other scenarios: total pixels [768×768, 2048×2048], aspect ratio
            [1:8, 8:1].


            Note: actual output dimensions may differ slightly from the
            specified values.
          x-enum:
            - 1K
            - 2K
            - 4K
          default: 1K
        'n':
          type: integer
          minimum: 1
          maximum: 12
          description: >-
            Important: `n` directly affects cost. Cost = unit price × number of
            successfully generated images. Confirm the model pricing before
            calling.


            Required range: 1 <= n <= 12.


            Non-sequential mode: range 1-4, default 1.

            Sequential mode: range 1-12, default 12. The actual count is
            determined by the model and will not exceed `n`.
        watermark:
          type: boolean
          description: >-
            Whether to add a watermark. The watermark is positioned at the
            bottom-right corner with the text 'AI生成'. `false` (default): no
            watermark. `true`: add watermark.
          default: false
        thinking_mode:
          type: boolean
          description: >-
            Whether to enable thinking mode. Default `true` (enabled). When
            enabled, the model enhances reasoning to improve output quality, but
            increases generation time. Only effective when sequential mode is
            disabled. The gateway maps this to upstream
            `parameters.thinking_mode`.
        enable_sequential:
          type: boolean
          description: >-
            Controls generation mode. `false` (default): normal mode. `true`:
            enable sequential (group) image output mode.
        color_palette:
          type: array
          description: >-
            Custom color palette. An array of objects containing hex color and
            ratio. Requires 3-10 colors, recommended 8. Only available when
            sequential mode is disabled (`enable_sequential=false`). The gateway
            maps this to upstream `parameters.color_palette`.
          items:
            $ref: '#/components/schemas/WanColorPaletteItem'
        seed:
          type: integer
          format: int64
          description: >-
            Random seed. Range [0, 2147483647].


            Using the same seed value helps keep generation results relatively
            stable. If not provided, the algorithm automatically uses a random
            seed.


            Note: the generation process is probabilistic; the same seed does
            not guarantee identical results every time.
          minimum: 0
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
          format: int64
          description: Response generation timestamp.
        data:
          type: array
          description: List of generated image results.
          items:
            $ref: '#/components/schemas/ImageData'
        metadata:
          type: object
          description: Pass-through raw response metadata from the upstream provider.
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    WanTextToImageInput:
      type: object
      required:
        - messages
      properties:
        messages:
          type: array
          minItems: 1
          maxItems: 1
          description: >-
            Message content array. Currently only single-turn conversation is
            supported, i.e. one set of `role`/`content` parameters. Multi-turn
            conversation is not supported.
          items:
            $ref: '#/components/schemas/WanTextToImageMessage'
    WanColorPaletteItem:
      type: object
      required:
        - hex
        - ratio
      properties:
        hex:
          type: string
          description: HEX color value, e.g. `#C2D1E6`.
        ratio:
          type: string
          description: >-
            Color percentage, precise to 2 decimal places, e.g. `"23.51%"`. All
            ratios must sum to 100.00%.
    ImageData:
      type: object
      properties:
        url:
          type: string
          description: Used when the result is returned as a URL.
        b64_json:
          type: string
          description: Used when the result is returned as Base64.
        revised_prompt:
          type: string
          description: Revised prompt returned by the upstream provider.
    ErrorObject:
      type: object
      properties:
        message:
          type: string
        type:
          type: string
        param:
          type: string
        code:
          type: string
    WanTextToImageMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: Fixed to `user`.
        content:
          type: array
          minItems: 1
          description: Message content array. Contains `text` and/or `image` objects.
          items:
            $ref: '#/components/schemas/WanTextToImageContentItem'
    WanTextToImageContentItem:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          maxLength: 5000
          description: >-
            Prompt. Supports Chinese and English, up to 5000 characters (each
            character, letter, digit, or symbol counts as one). Excess
            characters will be automatically truncated.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````