Wan 2.7 API
Alibabaが提供するWan 2.7動画生成モデルの完全なAPIリファレンスです。
モデルバリアント {#}
この API は4つのモデルバリアントをサポートしています:
クイック比較
Wan 2.7 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: 'wan-2.7-text-to-video',
prompt: 'A cat playing with a ball of yarn in a sunlit room',
duration: 6,
resolution: '720p',
aspect_ratio: '16:9',
negative_prompt: 'blur, low quality',
seed: 42
})
});
const { data } = await response.json();
const taskId = data.task_id;
Wan 2.7 Image to Video
リクエストパラメータ
必須
任意
リクエスト例
{
model_name: 'wan-2.7-image-to-video',
image_url: 'https://example.com/first-frame.jpg',
image_end_url: 'https://example.com/last-frame.jpg',
video_url: 'https://example.com/reference-continuation.mp4',
audio_url: 'https://example.com/driving-audio.mp3',
prompt: 'Gentle camera push-in; leaves rustle softly in the breeze',
duration: 6,
resolution: '720p',
negative_prompt: 'blur, low quality',
seed: 42
}
Wan 2.7 Video Edit
リクエストパラメータ
必須
任意
リクエスト例
{
model_name: 'wan-2.7-video-edit',
prompt: 'Replace the sky with warm sunset colors, keep subjects natural',
negative_prompt: 'artifacts, flicker',
seed: 42,
video_url: 'https://example.com/source.mp4',
images: ['https://example.com/ref-a.jpg', 'https://example.com/ref-b.jpg'],
audio_setting: 'auto'
}
Wan 2.7 Reference to Video
順序付けられた画像と動画の参照から新しい動画を生成し、任意で1つの音声クリップによる音声ガイドを使用できます。
リクエストパラメータ
必須
参照メディア
少なくとも1つの参照画像または参照動画が必要です。images と videos の合計は5項目以内にしてください。
任意
@ (AT) 参照プレースホルダー
@ (AT) 参照機能は、番号付きの <<<...>>> プレースホルダーを通じて参照メディアをプロンプトに関連付けます。番号はメディアタイプごとに独立して 1 から始まり、対応する配列の順序に従います。
リクエスト例
{
model_name: 'wan-2.7-reference-to-video',
prompt: 'Use image one for the hero and video one for the motion; keep the hero voice consistent with audio one',
resolution: '1080p',
duration: 8,
aspect_ratio: '16:9',
images: ['https://example.com/hero-reference.jpg'],
videos: ['https://example.com/motion-reference.mp4'],
audios: ['https://example.com/voice-reference.mp3'],
negative_prompt: 'flicker, distorted hands, duplicate subjects',
seed: 42
}
@ (AT) Reference-to-Video リクエスト例
{
model_name: 'wan-2.7-reference-to-video',
prompt: 'Place the presenter from <<<image_1>>> in the studio from <<<image_2>>>, follow the camera path in <<<video_1>>>, and use the reference voice from <<<audio_1>>>',
resolution: '1080p',
duration: 8,
aspect_ratio: '16:9',
images: [
'https://example.com/presenter-reference.jpg',
'https://example.com/studio-reference.jpg'
],
videos: ['https://example.com/camera-path-reference.mp4'],
audios: ['https://example.com/voice-reference.mp3'],
negative_prompt: 'flicker, distorted hands, duplicate subjects',
seed: 42
}
レスポンスフォーマット
初期レスポンス
すべてのモデルはポーリング用の 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分程度です。
1080pで10〜15秒の長い動画の場合、最大8分かかることがあります。
ベストプラクティス
- シーンとモーションの説明: プロンプトにシーンの内容とカメラの動きの両方を含めてください
- 解像度の選択: 処理速度を優先する場合は720p、最高品質を求める場合は1080pを使用してください
- 時間の計画: 動画が長いほどコストが高くなります(秒単位の料金)
- 音声の統合:
audio_url パラメータでカスタム音声を追加できます
- 画像品質: image-to-videoでは、最良の結果を得るために高品質な入力画像を使用してください
- Video Editプロンプト: 変更する内容と保持する内容を具体的に記述してください
- 参照アセット数:Reference-to-Video では、
images と videos の合計を5件以内にしてください
- 参照音声:
audios は声の特徴をガイドする目的にのみ使用し、希望する発話内容はプロンプトに記述してください