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

Image-to-Video - First Frame 2.1-2.6

POST/api/v1/video/generation

Header Parameters

Authorization*string

Format: Authorization: Bearer sk-xxxxxx

X-DashScope-Async*string

Configuration parameters for asynchronous processing. HTTP requests only support asynchronous mode and must be set to enable.

Request Body

application/json

model*string

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

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

Basic input information, such as prompts.

prompt?string

Text prompt. Used to describe the desired elements and visual characteristics in the generated image. Supports both Chinese and English, where each Chinese character or letter counts as one character, and any excess is automatically truncated. The length limit varies by model version: for the wan2.6 and wan2.5 series models, the length must not exceed 1500 characters. When using video effect parameters (i.e., when template is not empty), the prompt parameter is invalid and does not need to be filled in.

negative_prompt?string

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

img_url*string

URL or Base64-encoded data of the first frame image. Image limitations: Image formats: JPEG, JPG, PNG (alpha channel not supported), BMP, WEBP. Image resolution: Image width and height range from 240 to 8000 pixels. File size: wan2.6 and wan2.5 series models: up to 20MB.

audio_url?string

The URL of the audio file, which the model will use to generate the video. Audio limitations: Format: wav, mp3. Duration: 3-30s. File size: up to 15MB. Over-limit handling: If the audio length exceeds the duration value (5s or 10s), the first 5s or 10s are automatically extracted and the rest is discarded. If the audio length is shorter than the video duration, the portion exceeding the audio length will be silent. For example, if the audio is 3s and the video duration is 5s, the first 3s of the output video will have sound, and the last 2s will be silent.

template?string

The name of the video effect template. If left blank, no video effect is applied. Example value: flying, indicating the use of the Magic Levitation effect.

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 to adjust its clarity (total pixels). The model automatically scales to a similar total pixel count based on the selected resolution tier, and the video aspect ratio will be kept as consistent as possible with the aspect ratio of the input image img_url. The default value and available enum values for this parameter depend on the model parameter, with the following rules: wan2.6-i2v-flash: Available values: 720P, 1080P. Default value: 1080P. wan2.6-i2v: Available values: 720P, 1080P. Default value: 1080P. wan2.5-i2v-preview: Available values: 480P, 720P, 1080P. Default value: 1080P.

duration?integer

The duration of the generated video, in seconds. The value of this parameter depends on the model parameter: wan2.6-i2v-flash: an integer in the range [2, 15]. The default value is 5. wan2.6-i2v: an integer in the range [2, 15]. The default value is 5. wan2.5-i2v-preview: valid values are 5 and 10. The default value is 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

Specifies the shot type for the generated video, indicating 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", even if the prompt contains "generate a multi-shot video", the model will still output a single-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. The watermark is located in the bottom right corner of the video with the fixed text "AI-generated". false: Default value, no watermark is added. true: Add a watermark.

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

Usage Information

images*integer

Image Count

seconds*integer

Video Duration in Seconds

input_tokens*integer

Input Tokens

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