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, poll GET /v1/video/generations/{task_id} (or /v1/tasks/{task_id})
  • Sand.ai Native: Submit POST /v2/generations, poll GET /v2/generations/{id}
  • Sand.ai Ark-Compatible: Submit POST /compatible/ark/api/v3/contents/generations/tasks, poll GET /compatible/ark/api/v3/contents/generations/tasks/{id} (see MAGI-2 Native for native/Ark payloads)

[!NOTE]

  • Defaults: Fixed 1080p resolution; integer duration 4–30s (default 5); generate_audio / generateAudio defaults to true.
  • 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 in images) for frame control; passing ≥ 2 plain URLs in images defaults to multi-image reference.
  • No watermark: Official endpoints reject watermark; 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 ParamSand.ai Native (/v2/generations)Ark-Compatible (/compatible/ark/...)TypeReqDefaultDescription
modelmodelmodelstringYes-Model ID, e.g. magi-2.
promptparts[type="text"].textcontent[type="text"].textstringYes-Prompt text (≤ 15,000 chars).
first_frame_url / last_frame_url-content[type="image_url"] (role: "first_frame" | "last_frame")stringNo-Public URLs for start / end frames.
images / image_urlsparts[type="reference_image"].image.urlcontent[type="image_url"] (role: "reference_image")arrayNo-Image URLs (≤ 10; 1 = first frame, ≥ 2 = reference).
videos / video_urlsparts[type="reference_video"].video.urlcontent[type="video_url"].video_url.urlarrayNo-Reference video URLs (≤ 5 clips, ≤ 30s total).
audios / audio_urlsparts[type="reference_audio"].audio.urlcontent[type="audio_url"].audio_url.urlarrayNo-Reference audio URLs (≤ 5 clips, ≤ 30s total).
durationdurationdurationintegerNo5Duration in seconds (4–30).
ratio / aspect_ratioaspectRatioratiostringNo"16:9"Aspect ratio: "21:9", "16:9", "4:3", "1:1", "3:4", "9:16".
resolutionresolutionresolutionstringNo"1080p"Resolution ("1080p" only).
generate_audiogenerateAudiogenerate_audiobooleanNotrueGenerate synchronized audio.
enhance_promptenhancePromptenhance_promptbooleanNofalseEnable automatic prompt enhancement.
seedseedseedintegerNo-1Random 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:

CodeMeaning
400Invalid parameters / content moderation or copyright block
402Insufficient account balance (not 429)
429RPS/RPM limits or in-flight task cap (low balance)
403Token / IP / model permission (balance → 402; content filter → 400)
200 + status: failedAsync video/long-task business failure on poll

HTTP status matches call log status_code for traceability by log_id.

Raw Markdown (.md) · llms.txt