Edit only the walking woman's coat to match the teal wool coat in the reference image. Preserve her face, hair, body, stride, coat cut, trousers, shoes, camera motion, street, lighting and timing exactly. The coat stays consistently teal in every frame. Do not alter any other object. No text, lettering, captions, logos, watermarks, brands, advertising or product packaging.
Wan 2.7 Video Edit API
alibaba/wan-2.7/video-editWan 2.7 Video Edit 依托自然语言提示词将源视频重构为 720p 或 1080p 高清视频,具备参考图风格引导、自动时长自适应与多镜头重塑能力。它在对画面艺术画风、材质纹理与光照氛围进行精细变换的同时,严格保留原始机位运镜、主体运动轨迹与时间节奏。
拖拽文件、粘贴剪贴板素材,或输入 URL。
1/1 个素材
拖拽文件、粘贴剪贴板素材,或输入 URL。
1/1 个素材
示例
REST API 规格
快速开始
提交任务并查询状态。
第一步:配置 API 鉴权
在控制台创建 API Key,提交请求时附带 Authorization: Bearer <API_KEY>。
- 任务提交端点
- POST
https://api.vidgo.ai/api/generate/submit - 鉴权请求头
- Authorization: Bearer VIDGO_API_KEY
第 2 步:提交任务
POST /api/generate/submit · alibaba/wan-2.7/video-edit
REQUEST_BODY=$(cat <<'JSON'
{
"model": "alibaba/wan-2.7/video-edit",
"input": {
"resolution": "720p",
"duration": 0,
"prompt": "Describe the scene or edit",
"aspect_ratio": "16:9",
"video_url": "https://example.com/source.mp4"
}
}
JSON
)
RESPONSE=$(curl --silent --show-error --fail-with-body \
--request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data "$REQUEST_BODY")
CODE=$(printf '%s' "$RESPONSE" | jq -r '.code // empty')
if [ "$CODE" != "0" ] && [ "$CODE" != "200" ]; then
printf 'API error: %s
' "$RESPONSE" >&2
exit 1
fi
printf '%s
' "$RESPONSE"第三步:轮询任务执行结果
使用 task_id 查询进度;not_started 或 running 时继续轮询,finished 或 failed 时停止。成功后读取 data.files[].file_url,失败时读取 data.error_message。
状态查询端点
GET https://api.vidgo.ai/api/generate/status/{task_id}使用 task_id 查询进度;not_started 或 running 时继续轮询,finished 或 failed 时停止。成功后读取 data.files[].file_url,失败时读取 data.error_message。
not_startedrunningfinishedfailed{
"code": 200,
"data": {
"task_id": "task-example",
"status": "running",
"created_time": "2026-09-21T08:00:00Z"
}
}{
"code": 200,
"data": {
"task_id": "task-unified-...",
"status": "finished",
"files": [
{
"file_url": "https://storage.vidgo.ai/generated/video.mp4",
"file_type": "video"
}
],
"created_time": "2026-08-22T10:00:00Z",
"progress": 100,
"error_message": null
}
}端到端完整脚本示例
展开查看在生产环境中具备轮询重试、异常保护和超时处理的完整自动化脚本。
set -euo pipefail
: "${VIDGO_API_KEY:?Set VIDGO_API_KEY in your environment}"
REQUEST_BODY=$(cat <<'JSON'
{
"model": "alibaba/wan-2.7/video-edit",
"input": {
"resolution": "720p",
"duration": 0,
"prompt": "Describe the scene or edit",
"aspect_ratio": "16:9",
"video_url": "https://example.com/source.mp4"
}
}
JSON
)
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
--request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data "$REQUEST_BODY")
TASK_ID=$(printf '%s' "$SUBMIT_RESPONSE" | jq -r '.data.task_id // .task_id // empty')
BUSINESS_CODE=$(printf '%s' "$SUBMIT_RESPONSE" | jq -r '.code // empty')
if [ "$BUSINESS_CODE" != "0" ] && [ "$BUSINESS_CODE" != "200" ]; then
printf 'Submit failed:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
if [ -z "$TASK_ID" ]; then
printf 'Submit response did not include task_id:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
START_TIME=$(date +%s)
POLL_DELAY=2
while true; do
if [ $(( $(date +%s) - START_TIME )) -ge 600 ]; then
printf 'Timed out after 600 seconds
' >&2
exit 1
fi
STATUS_RESPONSE=$(curl --silent --show-error --fail-with-body \
--url "https://api.vidgo.ai/api/generate/status/$TASK_ID" \
--header "Authorization: Bearer $VIDGO_API_KEY")
STATUS=$(printf '%s' "$STATUS_RESPONSE" | jq -r '.data.status // .status // empty')
BUSINESS_CODE=$(printf '%s' "$STATUS_RESPONSE" | jq -r '.code // empty')
if [ "$BUSINESS_CODE" != "0" ] && [ "$BUSINESS_CODE" != "200" ]; then
printf 'Status request failed:
%s
' "$STATUS_RESPONSE" >&2
exit 1
fi
case "$STATUS" in
finished)
printf '%s' "$STATUS_RESPONSE" | jq -r '(.data.files // .files // [])[]?.file_url'
break
;;
failed)
printf '%s' "$STATUS_RESPONSE" | jq -r '.data.error_message // .error_message // "Generation failed"' >&2
exit 1
;;
not_started|running)
sleep "$POLL_DELAY"
if [ "$POLL_DELAY" -lt 10 ]; then POLL_DELAY=$((POLL_DELAY + 1)); fi
;;
*)
printf 'Unexpected task status: %s
' "$STATUS" >&2
exit 1
;;
esac
done请求参数(input 对象)
向 /api/generate/submit 提交 POST 请求时,input 内部所支持的生成参数配置:
| 字段 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| prompt | string | 是 | — | 提示词去除首尾空格后最多 5,000 字符;图生视频可不填。 |
| reference_image_url | string | 否 | — | 一张可选参考图片,支持 HTTP(S)、Data URI 或 Base64。 |
| video_url | string | 是 | — | 公开 HTTP(S) 视频地址;视频编辑必填,图生视频可选。 |
| aspect_ratio | string | 否 | 16:9 | 16:9、9:16、1:1、4:3 或 3:4,默认 16:9。 |
| resolution | string | 否 | 720p | 720p 或 1080p,默认 720p。 |
| duration | integer | 否 | 0 | 0(默认,探测源视频时长并向下取整)或 2–10 整数秒。自动模式源视频要求 2–10 秒,最大 100 MiB。 |
| multi_shots | boolean | 否 | — | 可选的多镜头控制,默认不传。 |
| audio_setting | string | 否 | — | 可选音频设置字符串,传递给上游处理,默认不传。 |
| seed | integer | 否 | — | 可选整数,范围为 0–2147483647。 |
| enable_safety_checker | boolean | 否 | — | 可选安全检查设置,默认不传。 |
响应字段(查询结果)
通过 GET /api/generate/status/{task_id} 轮询获取的任务详情:
| 字段 | 类型 | 描述 |
|---|---|---|
| code | integer | 业务响应状态码,200 表示成功。 |
| data.task_id | string | 异步任务全局唯一流水号。 |
| data.status | string | 任务执行阶段:not_started(排队中)、running(生成中)、finished(已完成)、failed(失败)。 |
| data.files | array | 生成成功时包含的成片文件列表,每项含 file_url 与 file_type。 |
| data.error_message | string | null | 任务执行异常时的具体错误描述。 |
任务生命周期
客户端应根据 status 字段判断任务进度,达到 finished 或 failed 终态时立即终止轮询:
not_started排队中
running生成中
finished已就绪
failed失败
轮询与异常处理
- 轮询频次推荐建议初始轮询间隔设为 2–3 秒,随着任务持续可递增至 5 秒一次,避免过密请求。
- 网络波动与重试若查询网络出现 5xx 或连接超时,不代表任务失败,可稍作休眠后继续重试查询。
- 异步 Webhook 回调支持在提交请求体根层级传递 callback_url,在任务终态时系统将通过 POST 自动推送完整任务结果。
接口规格
| 规格项 | 取值 | 说明 |
|---|---|---|
| 模型 | alibaba/wan-2.7/video-edit | |
| 分辨率 | 720p / 1080p | 默认 720p |
| 时长 | 0(默认,探测源视频时长并向下取整)或 2–10 整数秒。自动模式源视频要求 2–10 秒,最大 100 MiB。 |
Wan 2.7 Video Edit API 常见问题
Wan 2.7 Video Edit API 是什么?
Wan 2.7 Video Edit 是阿里通义实验室研发的指令式视频编辑与风格重绘模型。它根据自然语言提示词将源视频重构为 720p 或 1080p 高清视频,具备参考图风格引导、自动时长自适应与多镜头重塑能力。基于 Diffusion Transformer 架构与 Wan-VAE 3D 时空因果压缩技术,它在精细变换艺术画风、材质纹理与光影氛围的同时,严格保留原视频机位运镜与主体动作节拍。你可以通过 API 进行程序化调用,也可以在上方体验区直接在线试用。
Wan 2.7 Video Edit 支持哪些源视频格式?
Wan 2.7 Video Edit 支持通过公开 HTTP 或 HTTPS 网络链接传入标准的 MP4 或 MOV 格式视频。源视频时长建议在 2 至 10 秒之间,画面主体清晰有助于达到最佳重绘效果。
Wan 2.7 Video Edit 的自动时长如何工作?
当 duration 参数设置为 0 或缺省时,系统会自动探测源视频的播放秒数,并将其向下取整为 2 至 10 秒之间的整数。生成视频的时长和计费扣除均严格以此整秒数作为基准。
如何在 Wan 2.7 Video Edit 中使用参考图片?
你可以在 reference_image_url 字段中传入一张参考图片的公开链接或 Data URI。模型会提取参考图中的艺术风格、色彩搭配或角色外貌特征,并精准迁移至整段视频的重绘过程中。
Wan 2.7 Video Edit 如何保持源视频的镜头运镜轨迹?
模型通过时空交叉注意力机制提取源视频的光流特征与空间坐标。它能够牢固锁定机位推拉摇移以及主体的运动速度,使重构后的新画面与原片动作完全同频。
Wan 2.7 Video Edit 如何处理原始视频中的音频?
你可以通过传入 audio_setting 参数对输出视频的音频行为进行引导。系统会协调视频与音轨的播放时序,确保重绘后的成片具备自然的视听完整性。`
Wan 2.7 Video Edit 任务如何计算费用?
计费点数按照生成视频的实际整秒时长乘以分辨率费率计算,720p 为 12 积分/秒,1080p 为 18 积分/秒。如果任务在提交校验或生成过程中失败,系统会自动将扣除的积分全额返还。