Video edit: create an edit task from a video + reference images + instruction
curl --request POST \
--url https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-DashScope-Async: <x-dashscope-async>' \
--data @- <<EOF
{
"model": "wan2.7-videoedit",
"input": {
"prompt": "Replace the girl's outfit in the video with the outfit in the image",
"media": [
{
"type": "video",
"url": "https://your-cdn.com/source.mp4"
},
{
"type": "reference_image",
"url": "https://your-cdn.com/new-clothes.png"
}
]
}
}
EOFimport requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan2.7-videoedit",
"input": {
"prompt": "Replace the girl's outfit in the video with the outfit in the image",
"media": [
{
"type": "video",
"url": "https://your-cdn.com/source.mp4"
},
{
"type": "reference_image",
"url": "https://your-cdn.com/new-clothes.png"
}
]
}
}
headers = {
"X-DashScope-Async": "<x-dashscope-async>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DashScope-Async': '<x-dashscope-async>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan2.7-videoedit',
input: {
prompt: 'Replace the girl\'s outfit in the video with the outfit in the image',
media: [
{type: 'video', url: 'https://your-cdn.com/source.mp4'},
{type: 'reference_image', url: 'https://your-cdn.com/new-clothes.png'}
]
}
})
};
fetch('https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan2.7-videoedit',
'input' => [
'prompt' => 'Replace the girl\'s outfit in the video with the outfit in the image',
'media' => [
[
'type' => 'video',
'url' => 'https://your-cdn.com/source.mp4'
],
[
'type' => 'reference_image',
'url' => 'https://your-cdn.com/new-clothes.png'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-DashScope-Async: <x-dashscope-async>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload := strings.NewReader("{\n \"model\": \"wan2.7-videoedit\",\n \"input\": {\n \"prompt\": \"Replace the girl's outfit in the video with the outfit in the image\",\n \"media\": [\n {\n \"type\": \"video\",\n \"url\": \"https://your-cdn.com/source.mp4\"\n },\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/new-clothes.png\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DashScope-Async", "<x-dashscope-async>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
.header("X-DashScope-Async", "<x-dashscope-async>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan2.7-videoedit\",\n \"input\": {\n \"prompt\": \"Replace the girl's outfit in the video with the outfit in the image\",\n \"media\": [\n {\n \"type\": \"video\",\n \"url\": \"https://your-cdn.com/source.mp4\"\n },\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/new-clothes.png\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DashScope-Async"] = '<x-dashscope-async>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan2.7-videoedit\",\n \"input\": {\n \"prompt\": \"Replace the girl's outfit in the video with the outfit in the image\",\n \"media\": [\n {\n \"type\": \"video\",\n \"url\": \"https://your-cdn.com/source.mp4\"\n },\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/new-clothes.png\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "3b216861-6a5f-441d-a438-602ab2c0d103",
"task_status": "PENDING"
},
"request_id": "..."
}Wan2.7 동영상 생성 (Alibaba)
Wan2.7 동영상 편집 API 레퍼런스
Wan2.7-videoedit 동영상 편집 API 레퍼런스 및 실시간 플레이그라운드: 입력 동영상 + 참조 이미지 + 자연어 지시로 의상 교체와 배경 교체 같은 로컬/글로벌 편집을 수행합니다.
POST
/
wan
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
Video edit: create an edit task from a video + reference images + instruction
curl --request POST \
--url https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-DashScope-Async: <x-dashscope-async>' \
--data @- <<EOF
{
"model": "wan2.7-videoedit",
"input": {
"prompt": "Replace the girl's outfit in the video with the outfit in the image",
"media": [
{
"type": "video",
"url": "https://your-cdn.com/source.mp4"
},
{
"type": "reference_image",
"url": "https://your-cdn.com/new-clothes.png"
}
]
}
}
EOFimport requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan2.7-videoedit",
"input": {
"prompt": "Replace the girl's outfit in the video with the outfit in the image",
"media": [
{
"type": "video",
"url": "https://your-cdn.com/source.mp4"
},
{
"type": "reference_image",
"url": "https://your-cdn.com/new-clothes.png"
}
]
}
}
headers = {
"X-DashScope-Async": "<x-dashscope-async>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DashScope-Async': '<x-dashscope-async>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan2.7-videoedit',
input: {
prompt: 'Replace the girl\'s outfit in the video with the outfit in the image',
media: [
{type: 'video', url: 'https://your-cdn.com/source.mp4'},
{type: 'reference_image', url: 'https://your-cdn.com/new-clothes.png'}
]
}
})
};
fetch('https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan2.7-videoedit',
'input' => [
'prompt' => 'Replace the girl\'s outfit in the video with the outfit in the image',
'media' => [
[
'type' => 'video',
'url' => 'https://your-cdn.com/source.mp4'
],
[
'type' => 'reference_image',
'url' => 'https://your-cdn.com/new-clothes.png'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-DashScope-Async: <x-dashscope-async>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload := strings.NewReader("{\n \"model\": \"wan2.7-videoedit\",\n \"input\": {\n \"prompt\": \"Replace the girl's outfit in the video with the outfit in the image\",\n \"media\": [\n {\n \"type\": \"video\",\n \"url\": \"https://your-cdn.com/source.mp4\"\n },\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/new-clothes.png\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DashScope-Async", "<x-dashscope-async>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
.header("X-DashScope-Async", "<x-dashscope-async>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan2.7-videoedit\",\n \"input\": {\n \"prompt\": \"Replace the girl's outfit in the video with the outfit in the image\",\n \"media\": [\n {\n \"type\": \"video\",\n \"url\": \"https://your-cdn.com/source.mp4\"\n },\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/new-clothes.png\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DashScope-Async"] = '<x-dashscope-async>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan2.7-videoedit\",\n \"input\": {\n \"prompt\": \"Replace the girl's outfit in the video with the outfit in the image\",\n \"media\": [\n {\n \"type\": \"video\",\n \"url\": \"https://your-cdn.com/source.mp4\"\n },\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/new-clothes.png\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "3b216861-6a5f-441d-a438-602ab2c0d103",
"task_status": "PENDING"
},
"request_id": "..."
}오른쪽의 Playground에서는 직접 디버깅할 수 있습니다:
Bearer sk-your-api-key을 Authorization에 넣고, model / input.media / parameters를 채운 다음 요청을 전송하십시오. 성공적으로 제출되면 task_id가 반환됩니다. 폴링과 다운로드는 아래를 참조하십시오.이 페이지는
wan2.7-videoedit(동영상 편집)의 생성 엔드포인트입니다. 동영상 + 1~5개의 참조 이미지 + 자연어 편집 지시문을 제공하여 의상이나 배경을 바꾸는 등 동영상 요소를 편집할 수 있습니다. 모델 이름에는 하이픈이 없습니다(videoedit). 전체 비동기 흐름은 Wan 개요를 참조하십시오.input.media에는video(편집 중인 동영상)와 최소 하나의reference_image(참조 자산, ≤5)가 모두 포함되어야 합니다.- 모델 이름은
wan2.7-videoedit(하이픈 없음)이며, 하이픈이 있는 HappyHorse의happyhorse-1.0-video-edit와 다르므로 혼동하지 마십시오. - 생성 요청은
/wan/api/v1/...으로X-DashScope-Async: enable를 사용해 전송해야 하며,/v1/videos는 사용하지 마십시오.
코드 예시
curl -X POST "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis" \
-H "X-DashScope-Async: enable" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-videoedit",
"input": {
"prompt": "Replace the girl's outfit in the video with the outfit in the image",
"media": [
{"type": "video", "url": "https://your-cdn.com/source.mp4"},
{"type": "reference_image", "url": "https://your-cdn.com/new-clothes.png"}
]
},
"parameters": {"resolution": "720P", "prompt_extend": true, "watermark": true}
}'
import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
headers = {
"Authorization": "Bearer sk-your-api-key",
"Content-Type": "application/json",
"X-DashScope-Async": "enable",
}
body = {
"model": "wan2.7-videoedit",
"input": {
"prompt": "Replace the girl's outfit in the video with the outfit in the image",
"media": [
{"type": "video", "url": "https://your-cdn.com/source.mp4"},
{"type": "reference_image", "url": "https://your-cdn.com/new-clothes.png"},
],
},
"parameters": {"resolution": "720P", "prompt_extend": True, "watermark": True},
}
resp = requests.post(url, json=body, headers=headers, timeout=30)
print("task_id:", resp.json()["output"]["task_id"])
import requests
# Up to 5 reference_image for finer local/global edits
body = {
"model": "wan2.7-videoedit",
"input": {
"prompt": "Replace the background in the video with the seaside in image 1, and change the character's outfit to image 2",
"media": [
{"type": "video", "url": "https://your-cdn.com/source.mp4"},
{"type": "reference_image", "url": "https://your-cdn.com/beach.png"},
{"type": "reference_image", "url": "https://your-cdn.com/outfit.png"},
],
},
"parameters": {"resolution": "720P", "prompt_extend": True},
}
resp = requests.post(
"https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
json=body,
headers={"Authorization": "Bearer sk-your-api-key", "Content-Type": "application/json",
"X-DashScope-Async": "enable"},
timeout=30,
)
print(resp.json()["output"]["task_id"])
매개변수 및 미디어 빠른 참고
| 매개변수 | 유형 | 필수 | 기본값 | 비고 |
|---|---|---|---|---|
model | string | ✓ | — | 고정 wan2.7-videoedit |
input.prompt | string | ✓ | — | 자연어 편집 지시문 |
input.media | array | ✓ | — | 아래 미디어 표를 참조하십시오 |
parameters.resolution | string | 720P | 720P / 1080P | |
parameters.prompt_extend | bool | true | 스마트 재작성 | |
parameters.watermark | bool | false | “AI 생성” 워터마크 |
media[] 값
type | 필수 | 수량 | 비고 |
|---|---|---|---|
video | ✓ | 1 | 편집 중인 원본 동영상 |
reference_image | ✓ | 1-5 | 참조 자산(새 의상, 새 배경 등) |
비디오 편집 출력 길이는 입력 동영상을 따르며,
duration 매개변수가 아니라서 이 기능은 일반적으로 duration를 전달하지 않습니다.응답 형식
{
"output": { "task_id": "3b216861-6a5f-441d-a438-602ab2c0d103", "task_status": "PENDING" },
"request_id": "..."
}
상태 확인 및 다운로드
task_id를 받으면 mp4의 상태를 폴링하고 다운로드하기 위해 다음 세 단계를 따르십시오.
- 폴링
GET /v1/tasks/{task_id}을Authorization로 조회합니다(X-DashScope-Async헤더는 쿼리에 필요하지 않습니다). 5~10초마다(3초 미만은 아님)status가completed가 될 때까지 반복합니다. - 상태 값:
submitted(대기 중) /in_progress(생성 중;progress가 30%에 머무는 경우가 많아도 정상입니다) /completed(성공) /failed(error를 확인하십시오). - 다운로드: 응답에서
result_url를 직접 GET하십시오.Authorization헤더는 사용하지 마십시오(이는 OSS 서명된 직접 링크이며, Auth를 보내면 403이 반환됩니다).result_url는 기본적으로 24시간 후 만료되므로, 즉시 저장하십시오.
curl "https://api.apiyi.com/v1/tasks/3b216861-6a5f-441d-a438-602ab2c0d103" \
-H "Authorization: Bearer sk-your-api-key"
{
"status": "completed",
"progress": 100,
"result_url": "https://dashscope-result-xxx.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=...&Signature=...",
"task_id": "3b216861-6a5f-441d-a438-602ab2c0d103"
}
# result_url is an OSS signed direct link — do NOT send the Authorization header (it returns 403)
curl -L -o out.mp4 "https://dashscope-result-xxx.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=...&Signature=..."
TASK_ID="3b216861-6a5f-441d-a438-602ab2c0d103"
URL=$(curl -s "https://api.apiyi.com/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer sk-your-api-key" | jq -r '.result_url')
curl -L -o out.mp4 "$URL" # no Authorization
위 내용은 이미 task_id가 있는 경우를 위한 빠른 확인/다운로드 경로입니다. timeout fallback이 포함된 전체 polling loop와 Python client는 Wan 개요 · 비동기 호출 흐름을 참조하십시오.
인증
The API Key obtained from the APIYI console
헤더
Async processing switch; must be set to enable
사용 가능한 옵션:
enable 본문
application/json
이 페이지가 도움이 되었나요?
⌘I