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
arrayrequiredRequest 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
stringrequiredThe role of the message
Value:
usercontent
arrayrequiredMessage content array. Array length must be
1.text
stringrequiredPositive 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:
2100charactersExample:
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
stringNegative 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:
500charactersExample:
Low resolution, low quality, deformed limbs, deformed fingers, oversaturated, waxy appearance, faceless details, overly smooth, AI-generated look, chaotic composition, blurred text, distorted.
size
stringOutput 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×2700meets 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×960Default:
1280*1280
n
integerNumber of images to generate
Important: The
nparameter 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
1during testing.Range:
1-4Default:
4
prompt_extend
booleanWhether 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-4seconds of processing time.Options:
true,falseDefault:
true
watermark
booleanWhether to add a watermark identifier. The watermark is located in the lower right corner of the image with fixed text “AI Generated”.
Options:
false,trueDefault:
false
seed
integerRandom 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
stringError code
message
stringDetailed error message
output array
Generation results. Only present when status is completed.
content
arrayList of generated image content
type
stringResource type
Value:
imageurl
stringGenerated image URL
jobId
stringRemote task ID
usage object
Usage statistics. Only present when status is completed.
cost
stringTotal cost in USD
discount
numberDiscount amount
image_count
integerNumber of images generated
metadata object
Metadata information.
Error Codes
| Error Code | Description |
|---|---|
| 001015001 | Missing required field input |
| 001015002 | input.messages must contain one message |
| 001015003 | message.role must be user |
| 001015004 | message.content must contain one text object |
| 001015005 | content[0] must contain text field |
| 001015006 | Text length must be between 1-2100 characters |
| 001015007 | negative_prompt cannot exceed 500 characters |
| 001015008 | n must be an integer between 1 and 4 |
| 001015009 | seed must be an integer between 0 and 2147483647 |
| 001015010 | size format must be ‘width*height’ |
| 001015011 | size must be between 768*768 and 1440*1440 pixels |
| 001015012 | Aspect ratio must be between 1:4 and 4:1 |
| 001015013 | Invalid size format, must be ‘width*height’ with integers |
| 001015095 | Internal generation error |
| 001015096 | Result parsing error |
| 001015097 | HTTP error response |
| 001015098 | Status check error |
| 001015099 | Task creation error |