Happy Horse 1.1 API
Alibaba の Happy Horse 1.1 動画生成モデル向けの完全な API リファレンスです。
モデルバリアント {#}
この API は 3 つのモデルバリアントをサポートしています。
クイック比較
サポートされるアスペクト比(Text to Video と Reference to Video)
Happy Horse 1.1 Text to Video
エンドポイント
POST /api/v1/video/task
リクエストパラメータ
必須
任意
リクエスト例
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_name: 'happyhorse-1.1-text-to-video',
prompt: 'A cat playing with a ball of yarn on a sunny windowsill',
duration: 5,
resolution: '1080p',
aspect_ratio: '16:9',
seed: 42,
}),
});
const { data } = await response.json();
const taskId = data.task_id;
Happy Horse 1.1 Image to Video
リクエストパラメータ
必須
任意
注意: image-to-video では aspect_ratio はサポートされません。出力のフレーミングはアップロードされた先頭フレーム画像に従います。
リクエスト例
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_name: 'happyhorse-1.1-image-to-video',
image_url: 'https://example.com/first-frame.jpg',
prompt: 'Gentle motion; cinematic lighting',
duration: 5,
resolution: '1080p',
seed: 42,
}),
});
const { data } = await response.json();
const taskId = data.task_id;
Happy Horse 1.1 Reference to Video
リクエストパラメータ
必須
@ (AT) 参照プレースホルダー
@ (AT) 参照機能は、番号付きの <<<image_N>>> プレースホルダーを通じて参照画像をプロンプトに関連付けます。番号は 1 から始まり、images 配列の順序に従います。
任意
参照画像の要件
- サポート形式:
JPEG、JPG、PNG、WEBP
- 最大ファイルサイズ:画像 1 枚あたり 20 MB
- 最短辺:400 px
- 枚数:少なくとも 1 枚、最大 9 枚の画像
リクエスト例
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_name: 'happyhorse-1.1-reference-to-video',
prompt: 'Subject moves naturally while preserving reference style and appearance',
duration: 5,
resolution: '1080p',
aspect_ratio: '16:9',
images: [
'https://example.com/ref-1.jpg',
'https://example.com/ref-2.jpg',
],
seed: 42,
}),
});
const { data } = await response.json();
const taskId = data.task_id;
@ (AT) Reference-to-Video リクエスト例
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_name: 'happyhorse-1.1-reference-to-video',
prompt: 'Show the person from <<<image_1>>> walking beside the bicycle from <<<image_2>>> through the street in <<<image_3>>>, preserving all reference details',
duration: 5,
resolution: '1080p',
aspect_ratio: '16:9',
images: [
'https://example.com/person-reference.jpg',
'https://example.com/bicycle-reference.jpg',
'https://example.com/street-reference.jpg',
],
seed: 42,
}),
});
const { data } = await response.json();
const taskId = data.task_id;
レスポンス形式
初回レスポンス
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "submitted"
}
}
ポーリングレスポンス
ステータスを確認するには GET /api/v1/video/{taskId} をポーリングします。
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"task_result": {
"videos": [
{
"url": "https://example.com/generated-video.mp4"
}
]
}
}
}
ステータス値
submitted: タスクが受け付けられ、処理待ちです
processing: 動画生成が進行中です
succeed: 動画生成が完了しました
failed: 動画生成に失敗しました
処理時間
通常の処理時間は、長さとキューの負荷に応じて 2-5 分です。
ベストプラクティス
- 動きを明確に記述する: 被写体の動き、カメラワーク、シーンの進行を追加して、動画のダイナミクスを改善します。
- まず短い反復を使う: 長いクリップを実行する前に、3-5 秒の生成から始めてプロンプトの方向性を検証します。
- 適切な入力画像を選ぶ: image-to-video では、明瞭で十分に明るく、被写体にしっかり焦点が合った先頭フレーム画像を使用します。
- 参照画像を厳選する: reference-to-video では、保持したい被写体またはスタイルを明確に表す、一貫性のある高品質な参照画像を提供します。
- バリアントではシードを再利用する: プロンプトの改善をテストするときは同じ
seed を保ち、出力をより一貫して比較します。
- 配信チャネルに比率を合わせる: 横向き動画には
16:9、ショート動画や Reels には 9:16、正方形の配置には 1:1 を使用します。