MAGI-2 Video Generation
Sand.ai's magi-2 natively delivers 1080p HD output, 4–30s integer durations, and synchronized audio by default, supporting text-to-video, first/last-frame control, and multi-modal omni-reference (images, videos, audio).
[!NOTE] Example model IDs are for reference only; use actual IDs from the Model Marketplace.
- OpenAI-Compatible: Submit
POST /v1/video/generations, pollGET /v1/video/generations/{task_id}(or/v1/tasks/{task_id}) - Sand.ai Native: Submit
POST /v2/generations, pollGET /v2/generations/{id} - Sand.ai Ark-Compatible: Submit
POST /compatible/ark/api/v3/contents/generations/tasks, pollGET /compatible/ark/api/v3/contents/generations/tasks/{id}(see MAGI-2 Native for native/Ark payloads)
[!NOTE]
- Defaults: Fixed
1080presolution; integerduration4–30s (default5);generate_audio/generateAudiodefaults totrue.- Media URLs: Reference media must be public
https://URLs (≤ 10 images, ≤ 5 videos totaling ≤ 30s, ≤ 5 audio clips totaling ≤ 30s).- Frame Control vs. Multi-Image: Pass
first_frame_url/last_frame_url(or 1 image inimages) for frame control; passing ≥ 2 plain URLs inimagesdefaults to multi-image reference.- No
watermark: Official endpoints rejectwatermark; completed tasks always return direct, auth-free video URLs.
1. Submit Task (POST)
- Endpoint:
https://www.roookey.com/v1/video/generations - Header:
Authorization: Bearer sk-your_token_here
A. Text-to-Video
curl -X POST https://www.roookey.com/v1/video/generations \
-H "Authorization: Bearer sk-your_token_here" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2",
"prompt": "Rainy cyberpunk street at night, neon reflections on wet asphalt, slow push-in with rain and distant traffic audio",
"duration": 5,
"ratio": "16:9",
"resolution": "1080p",
"generate_audio": true
}'
B. First / Last Frame Image-to-Video
curl -X POST https://www.roookey.com/v1/video/generations \
-H "Authorization: Bearer sk-your_token_here" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2",
"prompt": "Smooth transition from snowy alpine dawn to golden sunset clouds with rising wind",
"first_frame_url": "https://example.com/first_frame.png",
"last_frame_url": "https://example.com/last_frame.png",
"duration": 8,
"ratio": "16:9"
}'
C. Omni-Reference (Images / Video / Audio)
curl -X POST https://www.roookey.com/v1/video/generations \
-H "Authorization: Bearer sk-your_token_here" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2",
"prompt": "Keep character look and reference camera motion along a seaside boardwalk with the reference melody",
"images": ["https://example.com/char.png", "https://example.com/scene.png"],
"videos": ["https://example.com/motion.mp4"],
"audios": ["https://example.com/bgm.mp3"],
"duration": 10,
"ratio": "16:9"
}'
2. Poll Result (GET)
curl -X GET https://www.roookey.com/v1/video/generations/task_01jxyz... \
-H "Authorization: Bearer sk-your_token_here"
3. Parameter Reference
| OpenAI Param | Sand.ai Native (/v2/generations) | Ark-Compatible (/compatible/ark/...) | Type | Req | Default | Description |
|---|---|---|---|---|---|---|
model | model | model | string | Yes | - | Model ID, e.g. magi-2. |
prompt | parts[type="text"].text | content[type="text"].text | string | Yes | - | Prompt text (≤ 15,000 chars). |
first_frame_url / last_frame_url | - | content[type="image_url"] (role: "first_frame" | "last_frame") | string | No | - | Public URLs for start / end frames. |
images / image_urls | parts[type="reference_image"].image.url | content[type="image_url"] (role: "reference_image") | array | No | - | Image URLs (≤ 10; 1 = first frame, ≥ 2 = reference). |
videos / video_urls | parts[type="reference_video"].video.url | content[type="video_url"].video_url.url | array | No | - | Reference video URLs (≤ 5 clips, ≤ 30s total). |
audios / audio_urls | parts[type="reference_audio"].audio.url | content[type="audio_url"].audio_url.url | array | No | - | Reference audio URLs (≤ 5 clips, ≤ 30s total). |
duration | duration | duration | integer | No | 5 | Duration in seconds (4–30). |
ratio / aspect_ratio | aspectRatio | ratio | string | No | "16:9" | Aspect ratio: "21:9", "16:9", "4:3", "1:1", "3:4", "9:16". |
resolution | resolution | resolution | string | No | "1080p" | Resolution ("1080p" only). |
generate_audio | generateAudio | generate_audio | boolean | No | true | Generate synchronized audio. |
enhance_prompt | enhancePrompt | enhance_prompt | boolean | No | false | Enable automatic prompt enhancement. |
seed | seed | seed | integer | No | -1 | Random seed (-1 or 0–4294967295). |
4. Response Example
{
"id": "task_01jxyz1234567890",
"object": "video.generation",
"status": "completed",
"created": 1796378400,
"data": [{ "url": "https://cdn.example.com/videos/magi2_output.mp4" }]
}
5. Common Error Codes & Troubleshooting
For full HTTP codes, error body formats, and troubleshooting guides, see:
👉 Gateway Error Codes & Troubleshooting
Quick reference:
| Code | Meaning |
|---|---|
| 400 | Invalid parameters / content moderation or copyright block |
| 402 | Insufficient account balance (not 429) |
| 429 | RPS/RPM limits or in-flight task cap (low balance) |
| 403 | Token / IP / model permission (balance → 402; content filter → 400) |
200 + status: failed | Async video/long-task business failure on poll |
HTTP status matches call log status_code for traceability by log_id.