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

Text-to-Video 2.1-2.6

POST/api/v1/video/generation

Header Parameters

Authorization*string

Format: Authorization: Bearer sk-xxxxxx

X-DashScope-Async*string

Asynchronous processing configuration parameters. HTTP requests only support asynchronous processing and must be set to enable.

Request Body

application/json

model*string

Model name, fixed value: wan2.5-t2v-preview wan2.6-t2v

Value in"wan2.5-t2v-preview" | "wan2.6-t2v"
input*object

Basic input information, such as prompts.

prompt*string

Text prompt. Used to describe the desired elements and visual characteristics to be included in the generated image. Supports both Chinese and English, with each Chinese character or letter counting as one character, and any excess will be automatically truncated. The length limit varies by model version: wan2.6 and wan2.5 series models: no more than 1500 characters.

negative_prompt?string

Negative prompts are used to describe unwanted content in the video, allowing you to restrict the video output. Supports both Chinese and English, with a maximum length of 500 characters; any excess will be automatically truncated. Example values: low resolution, errors, worst quality, low quality, deformed, extra fingers, bad proportions, etc.

audio_url?string

Supported models: wan2.6 and wan2.5 series models. URL of the audio file, which the model will use to generate the video.

parameters*object

Video processing parameters, such as setting video resolution, setting video duration, enabling intelligent prompt rewriting, adding watermarks, etc.

resolution?string

Specifies the resolution tier for the generated video, used to adjust the video clarity (total pixels). Based on the selected resolution tier, the model automatically scales to an approximate total pixel count, and the video aspect ratio will be kept as consistent as possible with that of the input image img_url. The default and available enumerated values for this parameter depend on the model parameter, following these rules: wan2.6-t2v: Available values: 720P, 1080P. Default: 1080P. wan2.5-t2v-preview: Available values: 480P, 720P, 1080P. Default: 1080P.

size?string

Specifies the resolution of the generated video in the format of widthheight. The default value and available enumerated values of this parameter depend on the model parameter, according to the following rules: wan2.6-t2v: The default value is 19201080 (1080P). Available resolutions: all resolutions corresponding to 720P and 1080P. wan2.5-t2v-preview: The default value is 19201080 (1080P). Available resolutions: all resolutions corresponding to 480P, 720P, and 1080P. 480P tier: Available video resolutions and their corresponding aspect ratios are: 832480: 16:9. 480832: 9:16. 624624: 1:1. 720P tier: Available video resolutions and their corresponding aspect ratios are: 1280720: 16:9. 7201280: 9:16. 960960: 1:1. 1088832: 4:3. 8321088: 3:4. 1080P tier: Available video resolutions and their corresponding aspect ratios are: 19201080: 16:9. 10801920: 9:16. 14401440: 1:1. 16321248: 4:3. 12481632: 3:4.

duration?integer

The duration of the generated video, in seconds. The value of this parameter depends on the model parameter: wan2.6-t2v: an integer in the range [2, 15], with a default value of 5. wan2.5-t2v-preview: valid values are 5 and 10, with a default value of 5.

prompt_extend?boolean

Whether to enable intelligent prompt rewriting. When enabled, a large model is used to intelligently rewrite the input prompt. This significantly improves generation quality for shorter prompts, but increases latency. true: Default value, enables intelligent rewriting. false: Disables intelligent rewriting.

shot_type?string

Supported models: wan2.6 series models. Specifies the shot type of the generated video, i.e., whether the video consists of a single continuous shot or multiple switching shots. Effective condition: Takes effect only when "prompt_extend": true. Parameter priority: shot_type > prompt. For example, if shot_type is set to "single", the model will still output a single-shot video even if the prompt includes "generate a multi-shot video". Available values: single: Default value, outputs a single-shot video. multi: Outputs a multi-shot video.

watermark?string

Specifies whether to add a watermark, which is placed in the bottom right corner of the video with the fixed text "AI Generated". false: Default value, no watermark is added. true: A watermark is added.

seed?string

Random seed, with a value range of [0, 2147483647].

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

Consumption Information

images*integer

Number of Images

seconds*integer

Video Seconds

input_tokens*integer

Input Token Count

total_tokens*integer

Total Tokens

output_tokens*integer

Output Tokens

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/video/generation" \  -H "Authorization: string" \  -H "X-DashScope-Async: string" \  -H "Content-Type: application/json" \  -d '{    "model": "wan2.5-t2v-preview",    "input": {      "prompt": "string"    },    "parameters": {}  }'
{
  "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"
}