Reference Video Generation 2.7
/api/v1/video/generationHeader Parameters
Format: Authorization: Bearer sk-xxxxxx
Configuration parameters for asynchronous processing. HTTP requests only support asynchronous processing and must be set to enable.
Request Body
application/json
Model name, fixed value: wan2.7-r2v
"wan2.7-r2v"Basic input information, such as prompts.
Text prompt. Used to describe the expected elements and visual characteristics to be included in the generated video. Supports both Chinese and English, where each Chinese character, letter, and punctuation mark counts as one character, and any excess will be automatically truncated. wan2.7-r2v: Up to 5000 characters. Reference designation: For Chinese prompts, reference images are designated by identifiers such as "图1" and "图2", and reference videos by "视频1" and "视频2". For English prompts, use identifiers such as "Image 1" and "Video 1". There should be a space between English letters and numbers, with the first letter capitalized. The order must be consistent with the media array. Images and videos are counted separately, meaning identifiers like Image 1 and Video 1 can coexist. If the reference material contains exactly one image or one video, it can be simplified to "reference image" or "reference video". Scene description: Assuming reference Image 1 is a cat and Image 2 is a room, to describe the cat playing in the room, two writing styles are supported: one is to directly use the identifiers (e.g., "Image 1 playing in Image 2"); the other is to combine the subject and scene with supplementary descriptions (e.g., "The cat in Image 1 playing in the room in Image 2"). When the reference image is a multi-panel grid (storyboard image), it is recommended to describe the scene content in a multi-shot format in the prompt. There is no need to describe every panel; simply provide the key shot content, and the model will automatically recognize the panel logic and intelligently complete the shot content. For better results, it is recommended to input only one multi-panel image at a time.
Negative prompts are used to describe unwanted content in the video and can restrict the visual 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, deformed, extra fingers, bad proportions, etc.
Array of media assets, including images, videos, and audio. Supports image and video input as visual references; images support multiple views, commonly referencing characters, props, scenes, etc. Each element in the array is a media object containing the type and url fields. The order of character references in the prompt is defined by the array order. Images and videos are counted separately, allowing Image 1 and Video 1 to coexist. The first reference_video in the array corresponds to Video 1, the second to Video 2, and so on. The first reference_image in the array corresponds to Image 1, the second to Image 2, and so on.
Media asset type. Optional values: reference_image: Reference image. Provides subject character (person/animal/object) and scene references. reference_video: Reference video. Provides subject character (person/animal/object) and voice timbre references; passing empty-shot videos is not recommended. first_frame: First frame image. Generates video based on the first frame, typically containing the subject character (person/animal/object). Supports simultaneous input of the first frame image for joint control, with common usages as follows: The subject to be referenced already appears in the first frame: In this case, it can be combined with subject reference to enhance consistency, or used for voice timbre reference. The subject to be referenced does not appear in the first frame: In this case, subject reference can be used to define the characteristics of newly appearing subjects during the video's dynamic process. Asset limits: A maximum of 1 first frame image can be passed. At least 1 reference image or reference video must be passed, and the total number of reference images + reference videos ≤ 5. When the reference asset is a subject character, it must contain only a single character.
Audio URL. Used to specify the voice timbre of the main character in the reference material (image/video). Used in conjunction with reference_image or reference_video. This audio is referenced only for its timbre and is independent of the spoken content. It is recommended to keep the language of the reference audio consistent with the language of the prompt for better matching results. Audio application logic: Default behavior: If the reference_video itself contains audio but reference_voice is not specified, the original video audio is used by default. Priority: If both reference_video (with audio) and reference_voice are provided, the timbre of reference_voice takes priority and overrides the original video audio. Audio restrictions: Format: wav, mp3. Duration: 1-10s. File size: Up to 15MB.
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-r2v: Valid values: 720P, 1080P. Default value: 1080P.
The aspect ratio of the generated video. Effective logic: If no first frame image is provided, the video is generated according to the specified ratio parameter; if a first frame image is provided, the ratio parameter is automatically ignored, and the video is generated with an approximate aspect ratio based on the first frame image. Optional values: 16:9 (default), 9:16, 1:1, 4:3, and 3:4. For the output video resolutions (width and height in pixels) corresponding to different aspect ratios, see the table below.
The duration of the generated video, in seconds. wan2.7-r2v: The default value is 5. When the reference material contains a video: the value is an integer in the range [2, 10]. When the reference material does not contain a video: the value is an integer in the range [2, 15].
Whether to enable intelligent prompt rewriting. When enabled, a large model is used to intelligently rewrite the input prompt. This significantly improves generation results for shorter prompts but increases latency. true: Default value, enables intelligent rewriting. false: Disables intelligent rewriting.
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.
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 Seconds
Input Token Count
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-r2v", "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"
}