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

Image-to-Video 2.7

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.7-i2v

Value in"wan2.7-i2v"
input*object

Basic input information, such as prompts.

prompt*string

Text prompt. Used to describe the desired elements and visual features in the generated image. Supports both Chinese and English, with each Chinese character or letter counting as one character; any excess is automatically truncated. The length limit varies by model version: wan2.7-i2v: up to 5000 characters.

negative_prompt?string

Negative prompts describe content you do not want to appear in the video and can be used 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.

media*array<object>

List of media assets used to specify the reference materials (images, audio, and video) required for video generation. Each element in the array is a media object containing the type and url fields. Only the following specific asset combinations are supported; invalid combinations will result in an error. Video generation from the first frame: First frame: first_frame. First frame + audio: first_frame+driving_audio. Video generation from the first and last frames: First frame + last frame: first_frame+last_frame. First frame + last frame + audio: first_frame+last_frame+driving_audio. Video continuation: First clip continuation: first_clip. First clip + last frame continuation: first_clip+last_frame.

[]?object
type*string

Media asset type. Valid values: first_frame: First frame. last_frame: Last frame. driving_audio: Driving audio. first_clip: First video clip. Usage limit: Each type can appear at most once in the media array (e.g., two first_frame values cannot be passed simultaneously).

url*string

Input image (type=first_frame or last_frame): URL of the first or last frame, or Base64-encoded data. Currently supports first-frame-to-video and first-and-last-frame-to-video generation. Image constraints: Format: JPEG, JPG, PNG (alpha channel not supported), BMP, WEBP. Resolution: Width and height range from 240 to 8000 pixels. Aspect ratio: 1:8 to 8:1. File size: Up to 20MB. Input audio (type=driving_audio): URL of the audio file. With input audio: The model will use this audio as the driving source to generate the video (e.g., lip sync, beat-synced motion). Without input audio: The model will automatically generate matching background music or sound effects based on the video content. Audio constraints: Format: wav, mp3. Duration: 2 to 30s. File size: Up to 15MB. Truncation processing: If the audio length exceeds the duration value (e.g., 5 seconds), the first 5 seconds are automatically extracted and the rest is discarded. If the audio length is less than the video duration, the portion exceeding the audio length will be silent. For example, if the audio is 3 seconds and the video duration is 5 seconds, the output video will have sound for the first 3 seconds and be silent for the last 2 seconds. Input video (type=first_clip): URL of the video file. The model will generate a continuation based on the content of this video, and the maximum continuation duration is controlled by the duration parameter. For example: when duration=15, if the input video is 3 seconds, the model will generate a 12-second continuation, resulting in a final output video with a total duration of 15 seconds, billed for 15 seconds. Video constraints: Format: mp4, mov. Duration: 2 to 10s. Resolution: Width and height range from 240 to 4096 pixels. Aspect ratio: 1:8 to 8:1. File size: Up to 100MB.

parameters*object

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

resolution?string

Resolution tier for the generated video, used to control video clarity (total pixels). wan2.7-i2v: Valid values: 720P, 1080P. Default value: 1080P.

ratio?string

Aspect ratio of the generated video. 16:9 (default), 9:16, 1:1, 4:3, 3:4. Output video resolutions for different aspect ratios (width and height in pixels). 720P: 16:9: 1280720, 9:16: 7201280, 1:1: 960960, 4:3: 1104832, 3:4: 8321104. 1080P: 16:9: 19201080, 9:16: 10801920, 1:1: 14401440, 4:3: 16481248, 3:4: 12481648.

duration?integer

The duration of the generated video, in seconds. wan2.7-i2v: An integer in the range [2, 15]. 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.

watermark?string

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

Number of Images

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.7-i2v",    "input": {      "prompt": "string",      "media": [        {          "type": "string",          "url": "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"
}