
AIメディアクリエイター
1つの統合ワークスペースでAI画像と動画を作成
Flaq AIでSand AIのMagi 2 APIを使い、参照素材から動画を作成できます。画像で見た目を、動画で動きを、音声で場面の音を指定できます。参照素材を組み合わせられます。
// Step 1: Submit generation request
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
model_name: 'magi-2-reference-to-video',
prompt: 'Use the reference image for the subject, the reference video for the camera movement, and the reference audio for the ambience',
duration: 8,
aspect_ratio: '16:9',
sound: true,
images: ['https://example.com/subject-reference.jpg'],
videos: ['https://example.com/camera-movement-reference.mp4'],
audios: ['https://example.com/ambience-reference.mp3']
})
});
const { data } = await response.json();
const taskId = data.task_id;
// Use the @ (AT) reference feature in prompt through <<<...>>> placeholders.
// Placeholder numbering is 1-based for each media array:
// <<<image_1>>> = images[0], <<<image_2>>> = images[1]
// <<<video_1>>> = videos[0], <<<audio_1>>> = audios[0]
const mediaReferenceResponse = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
model_name: 'magi-2-reference-to-video',
prompt: 'Show the cyclist from <<<image_1>>> on the trail in <<<image_2>>>. Follow the camera movement in <<<video_1>>> and use <<<audio_1>>> as a reference for the forest ambience',
duration: 10,
aspect_ratio: '16:9',
sound: true,
images: [
'https://example.com/cyclist-reference.jpg',
'https://example.com/forest-trail-reference.png'
],
videos: ['https://example.com/camera-movement-reference.mp4'],
audios: ['https://example.com/forest-ambience-reference.mp3']
})
});
const { data: mediaReferenceData } = await mediaReferenceResponse.json();
const mediaReferenceTaskId = mediaReferenceData.task_id;
// Step 2: Poll for results
const taskId = data.task_id;
const pollResult = async (taskId) => {
const res = await fetch(`https://api.flaq.ai/api/v1/video/${taskId}`, {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
return res.json();
};
while (true) {
const pollResultData = await pollResult(taskId);
const status = pollResultData.data.task_status;
if (status === 'succeed') {
console.log(pollResultData.data.task_result.videos[0].url);
break;
}
if (status === 'failed') {
console.error(pollResultData.data.task_status_msg);
break;
}
await new Promise(resolve => setTimeout(resolve, 10000));
}
# Step 1: Submit generation request
import requests
response = requests.post(
'https://api.flaq.ai/api/v1/video/task',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
json={
'model_name': 'magi-2-reference-to-video',
'prompt': 'Use the reference image for the subject, the reference video for the camera movement, and the reference audio for the ambience',
'duration': 8,
'aspect_ratio': '16:9',
'sound': True,
'images': ['https://example.com/subject-reference.jpg'],
'videos': ['https://example.com/camera-movement-reference.mp4'],
'audios': ['https://example.com/ambience-reference.mp3']
}
)
result = response.json()
task_id = result['data']['task_id']
# Use the @ (AT) reference feature in prompt through <<<...>>> placeholders.
# Placeholder numbering is 1-based for each media array:
# <<<image_1>>> = images[0], <<<image_2>>> = images[1]
# <<<video_1>>> = videos[0], <<<audio_1>>> = audios[0]
media_reference_response = requests.post(
'https://api.flaq.ai/api/v1/video/task',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
json={
'model_name': 'magi-2-reference-to-video',
'prompt': 'Show the cyclist from <<<image_1>>> on the trail in <<<image_2>>>. Follow the camera movement in <<<video_1>>> and use <<<audio_1>>> as a reference for the forest ambience',
'duration': 10,
'aspect_ratio': '16:9',
'sound': True,
'images': [
'https://example.com/cyclist-reference.jpg',
'https://example.com/forest-trail-reference.png'
],
'videos': ['https://example.com/camera-movement-reference.mp4'],
'audios': ['https://example.com/forest-ambience-reference.mp3']
}
)
media_reference_result = media_reference_response.json()
media_reference_task_id = media_reference_result['data']['task_id']
# Step 2: Poll for results
task_id = response.json()['data']['task_id']
poll_url = f"https://api.flaq.ai/api/v1/video/{task_id}"
while True:
poll_result = requests.get(poll_url, headers={'Authorization': 'Bearer YOUR_API_KEY'}).json()
status = poll_result['data']['task_status']
if status == 'succeed':
print(poll_result['data']['task_result']['videos'][0]['url'])
break
if status == 'failed':
print(poll_result['data']['task_status_msg'])
break
time.sleep(10)
# Step 1: Submit generation request
curl -X POST https://api.flaq.ai/api/v1/video/task \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model_name": "magi-2-reference-to-video",
"prompt": "Use the reference image for the subject, the reference video for the camera movement, and the reference audio for the ambience",
"duration": 8,
"aspect_ratio": "16:9",
"sound": true,
"images": ["https://example.com/subject-reference.jpg"],
"videos": ["https://example.com/camera-movement-reference.mp4"],
"audios": ["https://example.com/ambience-reference.mp3"]
}'
# Use the @ (AT) reference feature in prompt through <<<...>>> placeholders.
# Placeholder numbering is 1-based for each media array:
# <<<image_1>>> = images[0], <<<image_2>>> = images[1]
# <<<video_1>>> = videos[0], <<<audio_1>>> = audios[0]
curl -X POST https://api.flaq.ai/api/v1/video/task \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model_name": "magi-2-reference-to-video",
"prompt": "Show the cyclist from <<<image_1>>> on the trail in <<<image_2>>>. Follow the camera movement in <<<video_1>>> and use <<<audio_1>>> as a reference for the forest ambience",
"duration": 10,
"aspect_ratio": "16:9",
"sound": true,
"images": [
"https://example.com/cyclist-reference.jpg",
"https://example.com/forest-trail-reference.png"
],
"videos": ["https://example.com/camera-movement-reference.mp4"],
"audios": ["https://example.com/forest-ambience-reference.mp3"]
}'
# Step 2: Poll for results
# Replace {task_id} with the task_id returned from the submit response
curl -X GET "https://api.flaq.ai/api/v1/video/{task_id}" \
-H "Authorization: Bearer YOUR_API_KEY"
| パラメータ | 料金 | 元の料金 | 割引 |
|---|
Sand AI Magi 2 Reference-to-Video API を使うと、開発者や制作チームは Flaq AI 上で、必要に応じて参照画像、動画クリップ、音声トラックを使い、新しい動画の仕上がりを指定できます。映像、動き、音の参考素材は、1 つのプロンプト内で組み合わせることも、いずれか 1 種類だけを使うこともできます。クリップの長さ、アスペクト比、音声も同時に生成するかどうかを指定できます。
注意 参照画像、動画クリップ、音声ファイルはすべて任意で、自由に組み合わせられます。すべて省略すると、Magi 2 はプロンプトだけを使って動画を生成します。送信前に、対応ファイル形式、サイズ上限、参照動画と参照音声それぞれの合計再生時間の上限を確認してください。料金は指定した出力時間に基づいて秒単位で計算されます。プロンプトと素材はいずれも Sand AI のコンテンツ安全ガイドラインに準拠する必要があります。
Magi 2 Reference-to-Video と Magi 2 Text-to-Video
Text-to-Video は文章の指示から直接動画を生成します。Reference-to-Video では画像、動画、音声を任意で追加し、見た目、動き、音を具体的に示せます。
Magi 2 Reference-to-Video と Magi 2 Image-to-Video
Image-to-Video は必須の開始フレームをもとに動画を生成し、終了フレームも任意で指定できます。Reference-to-Video では複数の画像、動画、音声を任意で参照し、まったく新しいショットを作れます。
Magi 2 Reference-to-Video と Seedance 2.5 Reference-to-Video
どちらも、画像、動画、音声の参照素材を必要に応じて組み合わせ、プロンプトで生成を指示できます。Seedance 2.5 Reference-to-Video では出力解像度を選べます。Magi 2 Reference-to-Video では Sand AI の参照素材を使った生成方式でクリップの尺を明示でき、出力時間に応じて秒単位で課金されます。
Magi 2 Reference-to-Video と Wan Reference-to-Video
Wan Reference-to-Video はアップロードした視覚素材を参照して動画を生成します。Flaq AI の Magi 2 Reference-to-Video では 1 回のリクエストに画像、動画クリップ、音声トラックを組み合わせることができ、幅広いアスペクト比から選べます。
Flaq AIでのMagi 2 Reference to Videoの最新パラメータ、対応入力、機能。
APIリクエストの前に、Playgroundでモデルを試してください。
下のモデルIDを、Magi 2 Reference to VideoのAPIリクエストにコピーしてください。
Flaq AIでSand AIのMagi 2 APIを使い、参照素材から動画を作成できます。画像で見た目を、動画で動きを、音声で場面の音を指定できます。参照素材を組み合わせられます。
対応タスクは参照から動画です。利用可能な入力と設定には長さ, アスペクト比, 参照画像, 参照動画, referenceAudios, referenceSubjectsがあります。対応する値は仕様をご確認ください。
課金方式は秒あたりです。上の料金表に、単価と適用単価を決める設定が記載されています。
システムエラーでタスクが失敗した場合、残高は差し引かれません。
リクエストのモデルIDにmagi-2-reference-to-videoを指定してください。認証とリクエストの詳細はAPIドキュメントをご覧ください。
ほかのモデルにはMagi 2 Text to Video, Magi 2 Image to Videoがあります。各モデルのページで、対応入力、出力設定、料金を比較できます。
購入したクレジットに有効期限はありません。生成結果の商用利用には、Flaq AIの利用規約と該当するモデル提供元の規約が適用されます。
ブラウザで画像と動画のクイックワークフロー向けAI制作ツールを複数試し、成功したアイデアをFlaq AIの本番対応モデルAPIで拡張できます。Flaq AIはすべてのモデルに統合APIレイヤーを提供し、ワークフローを簡単に利用・拡張できます。