HappyHorse
HappyHorse 1.1 視頻生成
使用 HappyHorse 1.1 生成、參考圖生成或編輯視頻
中國大陸用戶請注意: 中國大陸用戶請使用 https://toapis.cn 作為接口地址(Base URL)。文檔示例中的 https://toapis.com 請替換為 https://toapis.cn。
- 對外模型固定爲
happyhorse-1.1 - 通過
action區分文生視頻、首幀圖生視頻、參考圖生視頻和視頻編輯 - 未傳
action時,存在首幀圖會自動按圖生視頻處理,否則按文生視頻處理 - 異步任務管理,通過任務 ID 查詢結果
Authorizations
Authorizationstring請求頭必填所有接口均需要使用 Bearer Token 進行認證。
Authorization: Bearer YOUR_API_KEYBody
modelstring請求體必填預設值: happyhorse-1.1視頻生成模型名稱,固定爲 happyhorse-1.1。
actionstring請求體預設值: text-to-video生成模式。
可選項:
text-to-video- 文生視頻image-to-video- 首幀圖生視頻reference-to-video- 參考圖生視頻video-edit- 視頻編輯
如果省略該字段,服務端會根據是否傳入首幀圖自動判斷。
promptstring請求體視頻內容描述。
文生視頻、參考圖生視頻和視頻編輯必填。首幀圖生視頻可選,但建議填寫以控制畫面運動和風格。
image_urlsstring[]請求體圖生視頻首幀圖片 URL。僅使用第一張圖片。
也可以使用兼容字段 input_reference、images、image 或 image_with_roles[{ role: "first_frame" }]。
圖片要求:
- 格式:
JPEG、JPG、PNG、BMP、WEBP - 文件大小:不超過
10MB - 寬高:不小於
300px - 寬高比:
1:2.5到2.5:1
reference_imagesstring[]請求體參考圖片 URL 列表。
reference-to-video 必填,支持 1 到 9 張;video-edit 可選,最多 5 張。
urlstring請求體視頻編輯的輸入視頻 URL。action=video-edit 時必填。
audio_settingstring請求體預設值: auto視頻編輯的聲音控制。僅 action=video-edit 有效。
可選項:
autoorigin
durationinteger請求體預設值: 5視頻時長,單位秒。可選範圍:3 到 15。
resolutionstring請求體預設值: 1080P視頻分辨率。
可選項:
720P1080P
aspect_ratiostring請求體預設值: 16:9文生視頻寬高比。圖生視頻會根據首幀圖決定畫幅。
可選項:
16:99:161:14:33:4
也可以使用兼容字段 size。
seedinteger請求體隨機種子,用於控制生成結果的確定性。
watermarkboolean請求體預設值: 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"