Image-to-Video 2.7
/api/v1/video/generationHeader Parameters
Format: Authorization: Bearer sk-xxxxxx
Asynchronous processing configuration parameters. HTTP requests only support asynchronous processing and must be set to enable.
Request Body
application/json
Model name, fixed value: wan2.7-i2v
"wan2.7-i2v"Basic input information, such as prompts.
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 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.
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.
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).
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.
Video processing parameters, such as setting video resolution, setting video duration, enabling intelligent prompt rewriting, and adding watermarks.
Resolution tier for the generated video, used to control video clarity (total pixels). wan2.7-i2v: Valid values: 720P, 1080P. Default value: 1080P.
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.
The duration of the generated video, in seconds. wan2.7-i2v: An integer in the range [2, 15]. The default value is 5.
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.
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.
Random seed, with a value range of [0, 2147483647].
Response Body
application/json
Success
TypeScript Definitions
Use the response body type in TypeScript.
Status Code
Data Object
Result Set
Usage Information
Number of Images
Video Duration in Seconds
Input Tokens
Total Tokens
Output Token Count
Validity Period
Task ID
Task Status
Status Information
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"
}