⌘K

Wan 2.6 - Text to Image

wan26_t2i

Wan 2.6 - Text to Image creates high-quality images from text descriptions using Alibaba's image generation technology.

Authentication

authorization string required

All APIs require authentication via Bearer Token.

Get API Key:

Visit API Key Management Page to get your API Key

Usage:

Add to request header:

Authorization: Bearer YOUR_API_KEY

Parameters

model string required

Model ID to use for the request

Value: wan26_t2i


input object required

Input data for the generation request

messages array required

Request content array. Currently only supports single-turn conversation, i.e., passing one set of role and content parameters. Multi-turn conversations are not supported. Array length must be 1.

role string required

The role of the message

Value: user

content array required

Message content array. Array length must be 1.

text string required

Positive prompt used to describe the image content, style, and composition you expect to generate. Supports Chinese and English. Each Chinese character, letter, number, or symbol counts as one character. Content exceeding the limit will be automatically truncated.

Maximum length: 2100 characters

Example: A sitting orange cat, cheerful expression, lively and cute, realistic and accurate.

Note: Only supports passing one text object. Not passing or passing multiple will result in an error.


parameters object

Generation parameters

negative_prompt string

Negative prompt used to describe content you don’t want to appear in the image, to constrain the output. Supports Chinese and English. Content exceeding the limit will be automatically truncated.

Maximum length: 500 characters

Example: Low resolution, low quality, deformed limbs, deformed fingers, oversaturated, waxy appearance, faceless details, overly smooth, AI-generated look, chaotic composition, blurred text, distorted.

size string

Output image resolution in the format width*height.

Total pixels must be between [1280×1280, 1440×1440] and aspect ratio must be in the range [1:4, 4:1]. For example, 768×2700 meets the requirements.

Recommended resolutions for common aspect ratios:
1:1: 1280×1280
3:4: 1104×1472
4:3: 1472×1104
9:16: 960×1696
16:9: 1696×960

Default: 1280*1280

n integer

Number of images to generate

Important: The n parameter directly affects billing costs. Cost = Unit price × Number of images. Please confirm the model pricing before calling.

Note: Billed per image. It is recommended to set to 1 during testing.

Range: 1 - 4

Default: 4

prompt_extend boolean

Whether to enable intelligent prompt rewriting. When enabled, uses a large model to optimize the positive prompt. This has a significant improvement effect on shorter prompts, but adds 3-4 seconds of processing time.

Options: true, false

Default: true

watermark boolean

Whether to add a watermark identifier. The watermark is located in the lower right corner of the image with fixed text “AI Generated”.

Options: false, true

Default: false

seed integer

Random seed. Using the same seed value can keep the generated content relatively stable. If not provided, the algorithm will automatically use a random seed.

Note: The model generation process is probabilistic. Even with the same seed, it cannot guarantee that the generation results will be completely consistent every time.

Range: 0 - 2147483647


Polling

Since image generation takes time, you need to poll the task status after creation.

The initial response returns the task ID and initial status. The actual generation results must be obtained through polling the task status endpoint.


Response Format

error object

Error information. Only present when status is failed.

code string

Error code

message string

Detailed error message


output array

Generation results. Only present when status is completed.

content array

List of generated image content

type string

Resource type

Value: image

url string

Generated image URL

jobId string

Remote task ID


usage object

Usage statistics. Only present when status is completed.

cost string

Total cost in USD

discount number

Discount amount

image_count integer

Number of images generated


metadata object

Metadata information.


Error Codes

Error CodeDescription
001015001Missing required field input
001015002input.messages must contain one message
001015003message.role must be user
001015004message.content must contain one text object
001015005content[0] must contain text field
001015006Text length must be between 1-2100 characters
001015007negative_prompt cannot exceed 500 characters
001015008n must be an integer between 1 and 4
001015009seed must be an integer between 0 and 2147483647
001015010size format must be ‘width*height’
001015011size must be between 768*768 and 1440*1440 pixels
001015012Aspect ratio must be between 1:4 and 4:1
001015013Invalid size format, must be ‘width*height’ with integers
001015095Internal generation error
001015096Result parsing error
001015097HTTP error response
001015098Status check error
001015099Task creation error