
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 层,让你的工作流更容易使用和扩展。