Skip to main content
POST
Wan 2.7 Video Editing

Introduction

Call Alibaba Cloud Bailian wan2.7-videoedit through the Gravitex gateway to perform instruction-based editing on existing video (replace subjects, change clothing, adjust scene style, etc.). The API is async: submit a task first, then poll for results. {task_id} is the id returned when the task is created.
Shares the unified video entry with Wan 2.7 Video Generation (T2V / I2V / R2V), but the model and media parameter semantics differโ€”do not mix them.

Authentication

string
required
Bearer Token, e.g. Bearer sk-xxxxxxxx
string
required
Must be application/json
string
Request trace ID; generate a unique value per request

Request parameters

string
required
Must be wan2.7-videoedit
string
required
Video editing instruction
integer
Output video duration in seconds; example uses 4
string
required
Raw prompt passed to Alibaba Cloud; recommend keeping it in sync with top-level prompt
array
required
Input media array; must include at least one video
string
required
Use video for source video; reference_image for reference images (up to 4)
string
required
Public HTTP/HTTPS URL or temporary URL meeting upstream requirements
string
720P or 1080P
boolean
Enable intelligent prompt rewriting
boolean
Add watermark

Request examples

Minimal request (video only):
With reference images: You can append reference images to the same media array; use โ€œๅ›พ 1โ€ in the prompt to refer to them. Up to 4 reference images are supported.

Create task response

On success, returns a standardized video task object (no outer code/message/data wrapper):
Save the returned id for subsequent queries.

Query task

Query response includes the outer code/message/data wrapper:

Status handling

Clients should use data.status as the platform standard status: Upstream status is in data.metadata.output.task_status (e.g. PENDING, SUCCEEDED); use for troubleshooting only, not as the primary status source. Recommended poll interval: 5โ€“15 seconds; avoid high-frequency polling.

Output video URL

On success, read data.video_url first; data.url is also available (typically the same in the current adapter). Output URLs are signed temporary addressesโ€”do not store them permanently as business resource URLs. Download or copy to your own OSS within the validity period for long-term storage.

Duration and billing

In testing with duration: 4, upstream usage may look like: Therefore data.seconds = 8 does not mean the output is 8 secondsโ€”it is the combined input + output billing duration. Alibaba Cloud official billing: charged by โ€œinput video duration + output video durationโ€; input images are not billed. See official billing documentation.

Common error troubleshooting

Minimal Python example