Reference-to-Video: create a video task with up to 9 reference images to preserve the subject
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.1-r2v",
"input": {
"prompt": "Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting",
"media": [
{
"type": "reference_image",
"url": "https://your-cdn.com/girl.png"
}
]
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "happyhorse-1.1-r2v",
"input": {
"prompt": "Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting",
"media": [
{
"type": "reference_image",
"url": "https://your-cdn.com/girl.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.1-r2v',
input: {
prompt: 'Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting',
media: [{type: 'reference_image', url: 'https://your-cdn.com/girl.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.1-r2v',
'input' => [
'prompt' => 'Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting',
'media' => [
[
'type' => 'reference_image',
'url' => 'https://your-cdn.com/girl.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.1-r2v\",\n \"input\": {\n \"prompt\": \"Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/girl.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.1-r2v\",\n \"input\": {\n \"prompt\": \"Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/girl.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.1-r2v\",\n \"input\": {\n \"prompt\": \"Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/girl.png\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "hh-...",
"task_status": "PENDING"
},
"request_id": "..."
}HappyHorse 동영상 생성 (Alibaba)
HappyHorse 레퍼런스-투-비디오 API 레퍼런스
HappyHorse-1.1-r2v 레퍼런스-투-비디오 API 레퍼런스 및 온라인 디버깅: 주제와 장면을 일관되게 유지하기 위해 최대 9장의 참조 이미지를 사용하며, DashScope 비동기 패스스루 엔드포인트입니다.
POST
/
wan
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
Reference-to-Video: create a video task with up to 9 reference images to preserve the subject
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.1-r2v",
"input": {
"prompt": "Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting",
"media": [
{
"type": "reference_image",
"url": "https://your-cdn.com/girl.png"
}
]
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "happyhorse-1.1-r2v",
"input": {
"prompt": "Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting",
"media": [
{
"type": "reference_image",
"url": "https://your-cdn.com/girl.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.1-r2v',
input: {
prompt: 'Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting',
media: [{type: 'reference_image', url: 'https://your-cdn.com/girl.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.1-r2v',
'input' => [
'prompt' => 'Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting',
'media' => [
[
'type' => 'reference_image',
'url' => 'https://your-cdn.com/girl.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.1-r2v\",\n \"input\": {\n \"prompt\": \"Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/girl.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.1-r2v\",\n \"input\": {\n \"prompt\": \"Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/girl.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.1-r2v\",\n \"input\": {\n \"prompt\": \"Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting\",\n \"media\": [\n {\n \"type\": \"reference_image\",\n \"url\": \"https://your-cdn.com/girl.png\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "hh-...",
"task_status": "PENDING"
},
"request_id": "..."
}오른쪽의 플레이그라운드에서 직접 디버그할 수 있습니다: Authorization에
Bearer sk-your-api-key을 입력하고, model / input.media / parameters를 설정한 다음 요청을 전송합니다. 제출이 성공하면 task_id가 반환됩니다. 아래에서 폴링과 다운로드를 확인하십시오.이 페이지는
happyhorse-1.1-r2v(참조 기반 동영상)의 create 엔드포인트를 다룹니다: 참조 이미지를 제공하면 모델이 그 안의 피사체와 장면 특징을 보존합니다. HappyHorse-r2v는 최대 9개의 참조 이미지를 지원하여 다중 참조 시나리오에서 더 강한 피사체 일관성을 제공합니다. 전체 비동기 흐름은 HappyHorse 개요를 참조하십시오.happyhorse-1.1-r2v는 최대 9개의reference_image항목을 지원합니다(Wan2.7-r2v의 합산 ≤5보다 많습니다).input.media이 필요하며, 미디어url는 GET으로 직접 가져올 수 있는 공개 https 링크여야 합니다.- create 요청은
/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": "happyhorse-1.1-r2v",
"input": {
"prompt": "Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting",
"media": [
{"type": "reference_image", "url": "https://your-cdn.com/girl.png"}
]
},
"parameters": {"resolution": "720P", "duration": 5, "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.1-r2v",
"input": {
"prompt": "Following the reference image, a girl walking slowly through a garden bathed in sunset light, cinematic lighting",
"media": [{"type": "reference_image", "url": "https://your-cdn.com/girl.png"}],
},
"parameters": {"resolution": "720P", "duration": 5, "prompt_extend": True},
}
resp = requests.post(url, json=body, headers=headers, timeout=30)
print("task_id:", resp.json()["output"]["task_id"])
import requests
# happyhorse-1.1-r2v supports up to 9 reference_image entries
refs = [
"https://your-cdn.com/ref1.png",
"https://your-cdn.com/ref2.png",
"https://your-cdn.com/ref3.png",
]
body = {
"model": "happyhorse-1.1-r2v",
"input": {
"prompt": "Keep the character and clothing features from the reference images, strolling through a city night scene with neon lighting",
"media": [{"type": "reference_image", "url": u} for u in refs],
},
"parameters": {"resolution": "720P", "duration": 5, "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 | ✓ | — | happyhorse-1.1-r2v로 고정됨 |
input.prompt | string | ✓ | — | 텍스트 prompt |
input.media | array | ✓ | — | 아래 미디어 표를 참조합니다 |
parameters.resolution | string | 720P | 720P / 1080P | |
parameters.duration | int | 5 | 2–15초 정수 | |
parameters.prompt_extend | bool | true | 스마트 재작성, 켜기를 권장합니다 | |
parameters.watermark | bool | false | “AI Generated” 워터마크 |
media[] 값
type | 필수 | 개수 | 설명 |
|---|---|---|---|
reference_image | ✓ | 1–9 | 참조 이미지입니다. 대상(사람/동물/물체)과 장면 특징을 유지합니다 |
응답 형식
{
"output": { "task_id": "...", "task_status": "PENDING" },
"request_id": "..."
}
제출 후,
GET /v1/tasks/{task_id}를 폴링하여 completed까지 기다린 다음, result_url에서 mp4를 다운로드합니다(Authorization 헤더 없이, 24시간 후 만료됩니다). 전체 폴링 루프는 HappyHorse 개요 · 비동기 호출 흐름에서 확인합니다.인증
The API Key obtained from the APIYI Console
헤더
Async processing switch, must be set to enable
사용 가능한 옵션:
enable 본문
application/json
이 페이지가 도움이 되었나요?
⌘I