典名词元DMTOKENSHome
API DocumentationThird-Party Tools Tutorial
AI Model APIImageWanxiang

Asynchronous Image Generation Call 2.6

POST/api/v1/image/generation

Header Parameters

Authorization?string

Use Bearer Token authentication. Format: Authorization: Bearer sk-xxxxxx

X-DashScope-Async?string

Configuration parameter for asynchronous processing. Add this parameter and set it to enable when making asynchronous calls to wan2.6-t2i.

Request Body

application/json

model*string

Model name, fixed value: wan2.6-t2i

Value in"wan2.6-t2i"
input*object

Basic input information.

messages*array<object>

Request content array. Currently, only single-turn conversations are supported, i.e., passing a single set of role and content parameters; multi-turn conversations are not supported.

[]?object
role*string

The role of the message. This parameter must be set to user.

text*string

Positive prompt, used to describe the desired content, style, and composition of the generated image. Supports both Chinese and English, with a maximum length of 2100 characters. Each Chinese character, letter, number, or symbol counts as one character, and any excess will be automatically truncated. Example value: A sitting orange cat with a cheerful expression, lively and cute, realistic and accurate. Note: Only one text parameter is supported; passing none or multiple will result in an error.

parameters?object

Image processing parameters.

negative_prompt?string

Negative prompt, used to describe content you do not want to appear in the image, restricting the visual output. Supports both Chinese and English, with a maximum length of 500 characters; any excess will be automatically truncated. Example values: low resolution, low quality, deformed limbs, deformed fingers, oversaturated image, waxy appearance, lack of facial details, overly smooth, AI-generated look, chaotic composition, blurry and distorted text.

size?string

The resolution of the output image, in the format of widthheight. The default value is 12801280. The total pixel count is within [12801280, 14401440] and the aspect ratio is within the range of [1:4, 4:1]. For example, 7682700 meets the requirements. Example value: 12801280. Recommended resolutions for common aspect ratios: 1:1: 12801280; 3:4: 11041472; 4:3: 14721104; 9:16: 9601696; 16:9: 1696*960.

n?integer

The number of images to generate. Valid values range from 1 to 4, with a default of 4. Note: Billing is per image; it is recommended to set this to 1 for testing.

prompt_extend?boolean

Whether to enable intelligent prompt rewriting. When enabled, a large model will be used to optimize positive prompts, significantly improving shorter prompts but adding 3-4 seconds of latency. true: Default value, enables intelligent rewriting. false: Disables intelligent rewriting.

watermark?boolean

Whether to add a watermark. The watermark is located in the bottom right corner of the image, with the fixed text "AI-generated". false: Default value, no watermark added. true: Add watermark.

seed?integer

Random seed, value range [0, 2147483647]. Using the same seed parameter value helps maintain relatively stable generated content. If not provided, the algorithm will automatically use a random seed. Note: The model generation process is probabilistic, so even with the same seed, identical results cannot be guaranteed across generations.

Response Body

application/json

Success

TypeScript Definitions

Use the response body type in TypeScript.

code*integer

Status Code

data*object

Data Object

urls*array<string>

Result Set

[]?string
usage*object

Usage Information

images*integer

Number of Images

seconds*integer

Video Duration in Seconds

input_tokens*integer

Input Token Count

total_tokens*integer

Total Tokens

output_tokens*integer

Output Token Count

expired*string

Validity Period

task_id*string

Task ID

task_status*string

Task Status

message*string

Status Information

request_id*string

Request ID

curl -X POST "https://api.ygw.ai/api/v1/image/generation" \  -H "Content-Type: application/json" \  -d '{    "model": "wan2.6-t2i",    "input": {      "messages": [        {          "role": "string",          "text": "string"        }      ]    }  }'
{
  "code": 0,
  "data": {
    "urls": [
      "string"
    ],
    "usage": {
      "images": 0,
      "seconds": 0,
      "input_tokens": 0,
      "total_tokens": 0,
      "output_tokens": 0
    },
    "expired": "string",
    "task_id": "string",
    "task_status": "string"
  },
  "message": "string",
  "request_id": "string"
}