
AI Media Creator
Create AI images and videos in one unified workspace
Create videos from references with the Magi 2 API by Sand AI on Flaq AI. Combine images for appearance, clips for motion, and audio for sound in 4–30s scenes.
// 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"
| Parameters | Price | Original Price | Discount |
|---|
Sand AI Magi 2 Reference-to-Video API lets developers and creative teams steer new video generation with optional reference images, video clips, and audio tracks on Flaq AI. Mix and match visual, motion, and sound references in a single prompt—or use any reference type on its own—while controlling clip duration, aspect ratio, and native audio output.
Note Reference images, video clips, and audio files are all optional and can be combined freely. If you omit all reference media, Magi 2 generates the video from your prompt alone. Check supported file formats, size caps, and separate total duration limits for reference videos and audio before submitting. Usage is billed per second based on the requested output duration, and all prompts and assets must comply with Sand AI's content safety guidelines.
Magi 2 Reference-to-Video vs. Magi 2 Text-to-Video
Text-to-Video generates directly from written instructions, while Reference-to-Video adds optional image, video, and audio inputs for concrete visual, motion, and sound guidance.
Magi 2 Reference-to-Video vs. Magi 2 Image-to-Video
Image-to-Video animates a required first frame with an optional end frame. Reference-to-Video allows multiple optional image, video, and audio references to shape an entirely new shot.
Magi 2 Reference-to-Video vs. Seedance 2.5 Reference-to-Video
Both models support mixing optional image, video, and audio references with prompt direction. Seedance 2.5 Reference-to-Video exposes selectable output resolution tiers, while Magi 2 Reference-to-Video provides Sand AI's reference workflow with explicit clip-duration control and per-second output billing.
Magi 2 Reference-to-Video vs. Wan Reference-to-Video
Wan Reference-to-Video guides generation with uploaded visual references. Magi 2 Reference-to-Video supports combining images, video clips, and audio tracks in a single request alongside broad aspect ratio selection on Flaq AI.
Live parameters, supported inputs, and capabilities for Magi 2 Reference to Video on Flaq AI.
Try the model in the Playground before making an API request.
Use one credit balance across video, image, LLM, voice, and 3D models. Purchased credits never expire. If a task fails due to a system error, your balance is not deducted.
Copy the model ID below into your API request for Magi 2 Reference to Video.
Explore other models from Sand AI and check their supported inputs and pricing.
Everything you need to know about capabilities, pricing, failed tasks, and API usage.
Create videos from references with the Magi 2 API by Sand AI on Flaq AI. Combine images for appearance, clips for motion, and audio for sound in 4–30s scenes.
Supported tasks: Reference To Video. Available inputs and settings include Duration, Aspect Ratio, Reference image, Reference Video, referenceAudios, referenceSubjects. See the specifications for their supported values.
Billing model: Per second. The pricing table above lists rates and the settings that determine which rate applies.
If a task fails due to a system error, your balance will not be deducted.
Use magi-2-reference-to-video as the model ID in your request. Refer to the API documentation for authentication and request details.
Other models include Magi 2 Text to Video, Magi 2 Image to Video. Compare their supported inputs, output settings, and pricing on their model pages.
Purchased credits do not expire. Commercial use of outputs is subject to Flaq AI’s terms of service and the applicable model provider’s terms.
Explore several AI creation tools for quick image and video workflows in your browser, then scale successful ideas with Flaq AI's production-ready model APIs. Flaq AI provides a unified API layer for all models, making it easy to use and scale your workflows.

Create AI images and videos in one unified workspace
Open your agent workspace and pick up a conversation

Build visual AI image and video workflows on an infinite canvas

Create consistent videos from reference media

Create AI images from text prompts

Create AI images from images and text prompts

Create AI videos from text prompts

Animate images into AI videos