
AI 媒體創作工具
在整合式工作區中建立 AI 圖片和影片
在 Flaq AI 上使用 Sand AI 的 Magi 2 API,根據參考素材生成影片。用圖片引導外觀、影片片段引導動作、音訊引導場景聲音。可組合多種參考,設定4–30秒與畫面比例。
// 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"
| 參數 | 價格 | 原價 | 折扣 |
|---|
透過 Flaq AI 上的 Sand AI Magi 2 參考生成影片 API,開發者與創作團隊可使用參考圖片、影片片段和音軌,引導新影片的生成。你可以在同一則提示詞中搭配視覺、動作與聲音參考,也可以單獨使用任一類素材,並指定片段長度、選擇畫面比例,以及決定是否產生原生音訊。
注意 參考圖片、影片片段與音訊檔案皆為選填,可自由組合。若省略所有參考素材,Magi 2 會單憑提示詞生成影片。送出請求前,請確認支援的檔案格式、檔案大小上限,以及參考影片與參考音訊各自的總時長上限。費用依請求指定的輸出片長按秒計算,所有提示詞與素材皆須符合 Sand AI 的內容安全規範。
Magi 2 參考生成影片與 Magi 2 文字生成影片
文字生成影片直接依照文字指令產生影片。參考生成影片還可選用圖片、影片與音訊,以具體範例引導畫面、動作與聲音。
Magi 2 參考生成影片與 Magi 2 圖片生成影片
圖片生成影片以必填的起始影格製作動畫,也可指定結束影格。參考生成影片則可選用多份圖片、影片與音訊素材,引導生成全新的鏡頭。
Magi 2 參考生成影片與 Seedance 2.5 參考生成影片
兩者皆可依提示詞指示,搭配使用選填的圖片、影片與音訊參考。Seedance 2.5 參考生成影片提供多種輸出解析度。Magi 2 參考生成影片採用 Sand AI 的參考素材工作流程,可明確指定片長,並依輸出秒數計費。
Magi 2 參考生成影片與 Wan 參考生成影片
Wan 參考生成影片依上傳的視覺素材引導生成。Flaq AI 上的 Magi 2 參考生成影片可在同一個請求中搭配圖片、影片片段與音軌,並提供多種畫面比例供選擇。
Magi 2 Reference to Video 在 Flaq AI 上的即時參數、支援的輸入和能力。
呼叫 API 前,先在 Playground 中試用模型。
影片、圖片、LLM、語音和 3D 模型共用一個點數餘額。購買的點數永不過期。如果任務因系統錯誤失敗,餘額不會被扣除。
在 Flaq AI 上使用 Sand AI 的 Magi 2 API,根據參考素材生成影片。用圖片引導外觀、影片片段引導動作、音訊引導場景聲音。可組合多種參考,設定4–30秒與畫面比例。
支援的任務:參考轉影片。可用的輸入和設定包括 時長, 長寬比, 參考圖片, 參考影片, referenceAudios, referenceSubjects。請查看規格,了解其支援的值。
計費方式:每秒。上方價格表列出了費率及決定適用費率的設定。
如果任務因系統錯誤失敗,餘額不會被扣除。
請在請求中使用 magi-2-reference-to-video 作為模型 ID。驗證和請求詳情請參閱 API 文件。
其他模型包括 Magi 2 Text to Video, Magi 2 Image to Video。可在各模型頁面比較其支援的輸入、輸出設定和價格。
購買的點數不會過期。生成結果的商業使用須遵守 Flaq AI 服務條款及相應模型供應商的條款。
在瀏覽器中探索多種 AI 創作工具,快速完成圖片與影片工作流程,然後透過 Flaq AI 的生產級模型 API 擴展成功想法。Flaq AI 為所有模型提供統一 API 層,讓你的工作流程更容易使用和擴展。