Video Edit: create an edit task from 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 '
{
"model": "happyhorse-1.0-video-edit",
"input": {
"prompt": "Replace the clothes of the girl in the video with the clothes in the image",
"media": [
{
"type": "video",
"url": "https://your-cdn.com/source.mp4"
},
{
"type": "reference_image",
"url": "https://your-cdn.com/new-clothes.png"
}
]
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "happyhorse-1.0-video-edit",
"input": {
"prompt": "Replace the clothes of the girl in the video with the clothes 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: 'happyhorse-1.0-video-edit',
input: {
prompt: 'Replace the clothes of the girl in the video with the clothes 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' => 'happyhorse-1.0-video-edit',
'input' => [
'prompt' => 'Replace the clothes of the girl in the video with the clothes 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\": \"happyhorse-1.0-video-edit\",\n \"input\": {\n \"prompt\": \"Replace the clothes of the girl in the video with the clothes 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\": \"happyhorse-1.0-video-edit\",\n \"input\": {\n \"prompt\": \"Replace the clothes of the girl in the video with the clothes 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\": \"happyhorse-1.0-video-edit\",\n \"input\": {\n \"prompt\": \"Replace the clothes of the girl in the video with the clothes 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": "hh-...",
"task_status": "PENDING"
},
"request_id": "..."
}HappyHorse Video Edit API Reference
HappyHorse-1.0-video-edit Video Edit API reference and online debugging: input video + up to 5 reference images + natural-language instructions for local/global edits.
POST
/
wan
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
Video Edit: create an edit task from 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 '
{
"model": "happyhorse-1.0-video-edit",
"input": {
"prompt": "Replace the clothes of the girl in the video with the clothes in the image",
"media": [
{
"type": "video",
"url": "https://your-cdn.com/source.mp4"
},
{
"type": "reference_image",
"url": "https://your-cdn.com/new-clothes.png"
}
]
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "happyhorse-1.0-video-edit",
"input": {
"prompt": "Replace the clothes of the girl in the video with the clothes 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: 'happyhorse-1.0-video-edit',
input: {
prompt: 'Replace the clothes of the girl in the video with the clothes 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' => 'happyhorse-1.0-video-edit',
'input' => [
'prompt' => 'Replace the clothes of the girl in the video with the clothes 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\": \"happyhorse-1.0-video-edit\",\n \"input\": {\n \"prompt\": \"Replace the clothes of the girl in the video with the clothes 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\": \"happyhorse-1.0-video-edit\",\n \"input\": {\n \"prompt\": \"Replace the clothes of the girl in the video with the clothes 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\": \"happyhorse-1.0-video-edit\",\n \"input\": {\n \"prompt\": \"Replace the clothes of the girl in the video with the clothes 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": "hh-...",
"task_status": "PENDING"
},
"request_id": "..."
}You can debug directly in the Playground on the right: fill in Authorization with
Bearer sk-your-api-key, set model / input.media / parameters, then send the request. A successful submission returns a task_id; see below for polling and downloading.This page covers the create endpoint for
happyhorse-1.0-video-edit (Video Edit): provide a video + up to 5 reference images + natural-language instructions to make local/global edits to video elements. Note that the model name has a hyphen (video-edit). For the complete async flow, see the HappyHorse Overview.input.mediamust include both avideo(the video being edited) and at least 1reference_image(≤5).- The model name is
happyhorse-1.0-video-edit(has a hyphen), different from Wan’swan2.7-videoedit(no hyphen) — don’t get it wrong. - The create request goes to
/wan/api/v1/...withX-DashScope-Async: enable; do not use/v1/videos.
Code Examples
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": "happyhorse-1.0-video-edit",
"input": {
"prompt": "Replace the clothes of the girl in the video with the clothes 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": "happyhorse-1.0-video-edit",
"input": {
"prompt": "Replace the clothes of the girl in the video with the clothes 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"])
Parameter and Media Quick Reference
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
model | string | ✓ | — | Fixed to happyhorse-1.0-video-edit |
input.prompt | string | ✓ | — | Natural-language editing instruction |
input.media | array | ✓ | — | See the media table below |
parameters.resolution | string | 720P | 720P / 1080P | |
parameters.prompt_extend | bool | true | Smart rewriting | |
parameters.watermark | bool | false | ”AI Generated” watermark |
media[] Values
type | Required | Count | Notes |
|---|---|---|---|
video | ✓ | 1 | The source video being edited |
reference_image | ✓ | 1–5 | Reference material (new clothing, new background, etc.) |
The output duration of video editing follows the input video and is not determined by
duration, so this capability typically does not pass duration.Response Format
{
"output": { "task_id": "...", "task_status": "PENDING" },
"request_id": "..."
}
After submission, poll
GET /v1/tasks/{task_id} until completed, then download the mp4 from result_url (without the Authorization header, expires in 24 hours). See the full polling loop in HappyHorse Overview · Async Call Flow.授权
The API Key obtained from the APIYI Console
请求头
Async processing switch, must be set to enable
可用选项:
enable 请求体
application/json
此页面对您有帮助吗?
⌘I