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

Video Editing 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-videoedit

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

Basic input information, such as prompts.

prompt*string

Text prompt. Used to describe the desired elements and visual features in the generated video. Supports Chinese and English, with each Chinese character or letter counting as one character; any excess is automatically truncated. wan2.7-videoedit: Length must not exceed 5000 characters. Example value: Dress the character in cool and flashy clothes, and add the hat from the reference image.

negative_prompt?string

Negative prompts are used to describe content you do not want to appear in the video, allowing you to constrain the visual 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>

Array of media assets, including images, videos, and audio. Supports image and video inputs as visual references, with images supporting multiple views, commonly used for referencing characters, props, scenes, etc. Each element in the array is a media object containing the type and url fields. The array order defines the sequence of character references in the prompt. Images and videos are counted separately, so Image 1 and Video 1 can 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.

[]?object
type*string

Media asset type. Valid values: video: Required. The video to be edited. reference_image: Optional. Reference images. Asset limits: Exactly one video. Up to 4 reference images.

url*string

Input video (type=video): URL of the video file to be edited. Video limits: Format: mp4, mov. Duration: 2-10s. Resolution: Width and height in the range of [240,4096] pixels. Aspect ratio: 1:8 to 8:1. File size: Up to 100MB. Input image (type=reference_image): Reference image URL or Base64 encoded data. Image limits: Format: JPEG, JPG, PNG (alpha channel not supported), BMP, WEBP. Resolution: Width and height in the range of [240, 8000] pixels. Aspect ratio: 1:8 to 8:1. File size: Up to 20MB.

parameters*object

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

resolution?string

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

ratio?string

Aspect ratio of the generated video. Logic: If the ratio parameter is not passed, a video with an approximate aspect ratio based on the input video is generated. If the ratio parameter is passed, the video is generated according to the specified ratio. Optional values: 16:9, 9:16, 1:1, 4:3, and 3:4. The output video resolutions (width and height in pixels) corresponding to different aspect ratios are as follows: 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. Usage recommendation: Configure this parameter only when video truncation is required. If you want the output video to match the duration of the input video, no configuration is needed (or pass the default value 0). Usage rules: Default behavior: The default value is 0, indicating that the input video's duration is used directly without truncation. Truncation takes effect: When a specific duration is provided, the system truncates the original video from 0 seconds up to the length specified by duration. Value range: Supports integers in the range [2, 10].

audio_setting?string

Video audio settings. auto (default): The model intelligently determines based on the prompt content. If the prompt includes audio descriptions, the audio may be regenerated; otherwise, the original audio of the input material may be retained. origin: Forces retention of the original audio from the input video without regeneration.

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

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: Watermark is added.

seed?string

Random seed, value range [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 Token Count

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-videoedit",    "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"
}