HappyHorse 1.1 视频生成
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"action": "<string>",
"prompt": "<string>",
"image_urls": [
"<string>"
],
"reference_images": [
"<string>"
],
"url": "<string>",
"audio_setting": "<string>",
"duration": 123,
"resolution": "<string>",
"aspect_ratio": "<string>",
"seed": 123,
"watermark": true
}
'import requests
url = "https://toapis.com/v1/videos/generations"
payload = {
"model": "<string>",
"action": "<string>",
"prompt": "<string>",
"image_urls": ["<string>"],
"reference_images": ["<string>"],
"url": "<string>",
"audio_setting": "<string>",
"duration": 123,
"resolution": "<string>",
"aspect_ratio": "<string>",
"seed": 123,
"watermark": True
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
action: '<string>',
prompt: '<string>',
image_urls: ['<string>'],
reference_images: ['<string>'],
url: '<string>',
audio_setting: '<string>',
duration: 123,
resolution: '<string>',
aspect_ratio: '<string>',
seed: 123,
watermark: true
})
};
fetch('https://toapis.com/v1/videos/generations', 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://toapis.com/v1/videos/generations",
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' => '<string>',
'action' => '<string>',
'prompt' => '<string>',
'image_urls' => [
'<string>'
],
'reference_images' => [
'<string>'
],
'url' => '<string>',
'audio_setting' => '<string>',
'duration' => 123,
'resolution' => '<string>',
'aspect_ratio' => '<string>',
'seed' => 123,
'watermark' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$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://toapis.com/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image_urls\": [\n \"<string>\"\n ],\n \"reference_images\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"audio_setting\": \"<string>\",\n \"duration\": 123,\n \"resolution\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"seed\": 123,\n \"watermark\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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://toapis.com/v1/videos/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image_urls\": [\n \"<string>\"\n ],\n \"reference_images\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"audio_setting\": \"<string>\",\n \"duration\": 123,\n \"resolution\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"seed\": 123,\n \"watermark\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toapis.com/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image_urls\": [\n \"<string>\"\n ],\n \"reference_images\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"audio_setting\": \"<string>\",\n \"duration\": 123,\n \"resolution\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"seed\": 123,\n \"watermark\": true\n}"
response = http.request(request)
puts response.read_bodyHappyHorse
HappyHorse 1.1 视频生成
使用 HappyHorse 1.1 生成、参考图生成或编辑视频
POST
/
v1
/
videos
/
generations
HappyHorse 1.1 视频生成
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"action": "<string>",
"prompt": "<string>",
"image_urls": [
"<string>"
],
"reference_images": [
"<string>"
],
"url": "<string>",
"audio_setting": "<string>",
"duration": 123,
"resolution": "<string>",
"aspect_ratio": "<string>",
"seed": 123,
"watermark": true
}
'import requests
url = "https://toapis.com/v1/videos/generations"
payload = {
"model": "<string>",
"action": "<string>",
"prompt": "<string>",
"image_urls": ["<string>"],
"reference_images": ["<string>"],
"url": "<string>",
"audio_setting": "<string>",
"duration": 123,
"resolution": "<string>",
"aspect_ratio": "<string>",
"seed": 123,
"watermark": True
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
action: '<string>',
prompt: '<string>',
image_urls: ['<string>'],
reference_images: ['<string>'],
url: '<string>',
audio_setting: '<string>',
duration: 123,
resolution: '<string>',
aspect_ratio: '<string>',
seed: 123,
watermark: true
})
};
fetch('https://toapis.com/v1/videos/generations', 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://toapis.com/v1/videos/generations",
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' => '<string>',
'action' => '<string>',
'prompt' => '<string>',
'image_urls' => [
'<string>'
],
'reference_images' => [
'<string>'
],
'url' => '<string>',
'audio_setting' => '<string>',
'duration' => 123,
'resolution' => '<string>',
'aspect_ratio' => '<string>',
'seed' => 123,
'watermark' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$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://toapis.com/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image_urls\": [\n \"<string>\"\n ],\n \"reference_images\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"audio_setting\": \"<string>\",\n \"duration\": 123,\n \"resolution\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"seed\": 123,\n \"watermark\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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://toapis.com/v1/videos/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image_urls\": [\n \"<string>\"\n ],\n \"reference_images\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"audio_setting\": \"<string>\",\n \"duration\": 123,\n \"resolution\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"seed\": 123,\n \"watermark\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toapis.com/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image_urls\": [\n \"<string>\"\n ],\n \"reference_images\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"audio_setting\": \"<string>\",\n \"duration\": 123,\n \"resolution\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"seed\": 123,\n \"watermark\": true\n}"
response = http.request(request)
puts response.read_body- 对外模型固定为
happyhorse-1.1 - 通过
action区分文生视频、首帧图生视频、参考图生视频和视频编辑 - 未传
action时,存在首帧图会自动按图生视频处理,否则按文生视频处理 - 异步任务管理,通过任务 ID 查询结果
Authorizations
string
必填
所有接口均需要使用 Bearer Token 进行认证。
Authorization: Bearer YOUR_API_KEY
Body
string
默认值:"happyhorse-1.1"
必填
视频生成模型名称,固定为
happyhorse-1.1。string
默认值:"text-to-video"
生成模式。可选项:
text-to-video- 文生视频image-to-video- 首帧图生视频reference-to-video- 参考图生视频video-edit- 视频编辑
string
视频内容描述。文生视频、参考图生视频和视频编辑必填。首帧图生视频可选,但建议填写以控制画面运动和风格。
string[]
图生视频首帧图片 URL。仅使用第一张图片。也可以使用兼容字段
input_reference、images、image 或 image_with_roles[{ role: "first_frame" }]。图片要求:- 格式:
JPEG、JPG、PNG、BMP、WEBP - 文件大小:不超过
10MB - 宽高:不小于
300px - 宽高比:
1:2.5到2.5:1
string[]
参考图片 URL 列表。
reference-to-video 必填,支持 1 到 9 张;video-edit 可选,最多 5 张。string
视频编辑的输入视频 URL。
action=video-edit 时必填。string
默认值:"auto"
视频编辑的声音控制。仅
action=video-edit 有效。可选项:autoorigin
integer
默认值:5
视频时长,单位秒。可选范围:
3 到 15。string
默认值:"1080P"
视频分辨率。可选项:
720P1080P
string
默认值:"16:9"
文生视频宽高比。图生视频会根据首帧图决定画幅。可选项:
16:99:161:14:33:4
size。integer
随机种子,用于控制生成结果的确定性。
boolean
默认值:true
是否添加水印。
文生视频示例
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header "Authorization: Bearer YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "happyhorse-1.1",
"action": "text-to-video",
"prompt": "夜晚的铁路桥下,一个涂鸦少年从墙上活过来,一边快速演唱英文 rap,一边做出充满活力的说唱动作。",
"duration": 10,
"resolution": "1080P",
"aspect_ratio": "16:9",
"seed": 42,
"watermark": true
}'
图生视频示例
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header "Authorization: Bearer YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "happyhorse-1.1",
"action": "image-to-video",
"prompt": "让图片中的角色自然动起来,保持原始画面风格。",
"image_urls": ["https://example.com/first-frame.png"],
"duration": 5,
"resolution": "1080P"
}'
参考图生视频示例
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header "Authorization: Bearer YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "happyhorse-1.1",
"action": "reference-to-video",
"prompt": "图 1 中的主角在图 2 的场景中奔跑,随后拿起图 3 中的道具。画面保持 3D 卡通风格。",
"reference_images": [
"https://example.com/image-01.jpg",
"https://example.com/image-02.png",
"https://example.com/image-03.jpeg"
],
"duration": 5,
"resolution": "1080P",
"aspect_ratio": "16:9",
"watermark": false
}'
视频编辑示例
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header "Authorization: Bearer YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "happyhorse-1.1",
"action": "video-edit",
"prompt": "让视频中的场景更有电影感,保留主体动作。",
"url": "https://example.com/input.mp4",
"reference_images": ["https://example.com/reference.png"],
"resolution": "1080P",
"audio_setting": "origin",
"seed": 42
}'
查询任务
提交接口会返回任务 ID。使用通用视频任务查询接口获取状态和结果:curl --request GET \
--url https://toapis.com/v1/videos/generations/{task_id} \
--header "Authorization: Bearer YOUR_API_KEY"
渠道配置
HappyHorse 使用 DashScope API Key。默认上游地址为https://dashscope.aliyuncs.com。
如需使用国际站,在管理后台将该渠道的 Base URL 覆盖为:
https://dashscope-intl.aliyuncs.com
⌘I