how-tos

MAGI-2 API Prompt Guide: Timed Shot Lists, Dialogue and Sound

Poyo.ai Team
11 min read
Share:

MAGI-2 API prompt guide: timed shot lists, dialogue and sound

Writing a strong MAGI-2 API prompt is closer to drafting a miniature shooting script than typing a short visual caption. Because magi-2 on PoYo accepts up to 15,000 characters in prompt and generates 1080p video with synchronized audio up to 30 seconds long, the same text field controls shot timing, camera movement, spoken dialogue for lip sync, and sound effects. You can try these patterns interactively on the MAGI-2 model page or inspect every schema constraint in the MAGI-2 API docs.

This guide shows how to structure prompts for POST https://api.poyo.ai/api/generate/submit across all three input modes, with five complete, schema-valid JSON request bodies ready to send. Every rule below comes from the PoYo API schema and Sand AI's MAGI-2 documentation; we do not make unmeasured claims about visual quality or generation speed for these example prompts. For authentication, polling loops, and webhooks, see the MAGI-2 API guide.

How MAGI-2 API prompts are structured

Sand AI's MAGI-2 announcement and PoYo's API docs highlight three elements that belong directly inside the prompt string:

  1. Timed shot lists (timeline control). Rather than describing one static moment, split longer clips into explicit second ranges—such as 0-4s, 4-8s, and 8-12s—and specify the framing, camera move, and subject action for each beat. Match the final timestamp to your integer duration (4 to 30 seconds).
  2. Quoted dialogue for lip sync. Name the speaker right before the line and wrap the spoken text in double quotes ("..."). Keep the word count realistic for the beat length so the speech fits naturally inside the requested duration.
  3. Foley, ambience, and music cues. Describe the non-speech audio layer explicitly: footsteps, rain on metal, distant traffic, espresso steam, or a soft acoustic guitar. When you want environmental sound without voices, state "No dialogue." in the prompt. For a deeper look at audio behavior, read MAGI-2 API video with sound.

Three mutually exclusive input modes

Every magi-2 request uses exactly one input mode. Mixing image_urls with any reference_* field fails validation.

Input modeRequired fieldsOptional media fieldsaspect_ratio rule
Text to videopromptNone16:9 (default), 9:16, 1:1, 4:3, 3:4, 21:9
First / first-and-last framesprompt, image_urls (1–2 URLs)None (cannot mix with reference_*)Omit or pass "auto" (follows opening frame)
Reference to videoprompt + at least one reference_* arrayreference_image_urls (≤10), reference_video_urls (≤5), reference_audio_urls (≤5)16:9 (default), 9:16, 1:1, 4:3, 3:4, 21:9

All three modes output 1080p MP4 at the same flat rate on PoYo: 16 credits ($0.08) per output second, or as low as $0.072 per second with the extra 10% discount on large top-ups. Reference images, videos, and audio clips are not billed. For full cost tables, see MAGI-2 API pricing and the MAGI-2 API overview.

Five complete MAGI-2 API request bodies

Every JSON object below is a complete request body for POST https://api.poyo.ai/api/generate/submit with Authorization: Bearer $POYO_API_KEY. Replace the placeholder https://example.com/... media URLs with your own publicly downloadable files before submitting.

1. Text-to-video: timed shot list with quoted dialogue

Use a timed beat structure when you want multiple camera cuts and back-and-forth dialogue in a single take. Setting seed (any integer from 0 to 2147483647) lets you iterate on one line or camera angle while keeping the rest of the request consistent.

{
  "model": "magi-2",
  "input": {
    "prompt": "0-4s: Medium wide shot inside a quiet neighborhood bookstore at dusk. Warm pendant lamps glow above wooden shelves. A shopkeeper in a dark cardigan sorts paperbacks behind the counter while rain taps softly against the front window. 4-8s: Close-up on a customer shaking out a wet umbrella near the doorway. The customer smiles and says: \"Do you still keep the out-of-print travel guides in the back?\" 8-12s: Reverse close-up on the shopkeeper looking up from the counter, gesturing toward the rear aisle, and replying: \"Third shelf on the left, right under the brass lamp.\" Soft acoustic guitar plays faintly from a small radio, layered with steady rain and turning pages.",
    "duration": 12,
    "aspect_ratio": "16:9",
    "generate_audio": true,
    "seed": 42019
  }
}

Why this structure works: Each 4-second beat holds one clear visual change and one short spoken line, matching duration: 12 (192 credits / $0.96 at list price). Both speakers are named before their quoted lines, and the foley and ambience cues (rain, radio guitar, turning pages) are separated from the speech.

2. Ambience-only and silent video options

When you want atmospheric B-roll, product shots, or establishing footage without anyone speaking, leave generate_audio enabled and explicitly write "No dialogue." alongside concrete foley cues.

{
  "model": "magi-2",
  "input": {
    "prompt": "0-4s: Low-angle tracking shot along a misty cedar forest trail at dawn. Sunlight filters through tall trunks while dew drips from fern leaves. 4-8s: Slow tilt upward toward the canopy as wind sways the upper branches and a small flock of birds takes off. Crisp footsteps on damp pine needles, rustling leaves, and distant birdsong. No dialogue. No music.",
    "duration": 8,
    "aspect_ratio": "21:9",
    "generate_audio": true
  }
}

If your pipeline replaces the soundtrack in post-production and you want a silent MP4 with no audio track, change "generate_audio": true to "generate_audio": false. Note that disabling audio does not lower the charge: an 8-second request is 128 credits ($0.64 at list price) either way.

3. First and last frame transition (image_urls)

Pass one image in image_urls to anchor the opening frame, or two images to anchor both the opening and closing frames. Your prompt should describe the physical transition between the two frames, the camera path, and the audio that accompanies the movement.

{
  "model": "magi-2",
  "input": {
    "prompt": "0-3s: Starting from the first frame of the ceramic teapot resting on a dark slate tray, a hand enters from the right and lifts the pot smoothly, pouring steaming green tea into the empty cup in a steady arc. 3-6s: The hand sets the teapot back down and withdraws as the camera glides slightly closer to settle on the exact composition of the last frame, with steam curling above the filled cup. Clear pouring liquid sound, gentle ceramic clink on slate, and quiet room tone. No dialogue.",
    "image_urls": [
      "https://example.com/tea-start-frame.png",
      "https://example.com/tea-end-frame.png"
    ],
    "duration": 6,
    "aspect_ratio": "auto",
    "generate_audio": true
  }
}

With image_urls, either omit aspect_ratio or set "aspect_ratio": "auto" so the output inherits the opening frame's dimensions. Both URLs must be public JPG, PNG, or WEBP files. A 6-second request costs 96 credits ($0.48 at list price).

4. Omni-reference: character image + reference audio

Reference mode lets you combine up to 10 reference images, 5 reference videos, and 5 reference audio clips in a single task. Always explain inside prompt what role each reference plays—for instance, which image defines the subject or location, and how the audio clip should appear in the scene.

{
  "model": "magi-2",
  "input": {
    "prompt": "0-5s: Medium tracking shot of the street cellist from the reference image seated on a stone plaza at golden hour, bowing the cello melody from the reference audio. Pedestrians pass softly out of focus in the background while warm sunlight catches the wood grain of the instrument. 5-10s: Slow push-in to a close-up as she finishes the phrase, looks up toward the camera, and says: \"This square has the best acoustics in the city.\" Natural outdoor reverb blends the cello with distant fountain water and soft footsteps.",
    "reference_image_urls": [
      "https://example.com/cellist-character-ref.jpg"
    ],
    "reference_audio_urls": [
      "https://example.com/cello-melody-ref.mp3"
    ],
    "duration": 10,
    "aspect_ratio": "9:16",
    "generate_audio": true
  }
}

Reference audio clips must be MP3 or WAV, 2–30 seconds each, and no more than 30 seconds total across all audio references in the task. You can also send reference_audio_urls on its own without any image or video references when you only want audio-driven pacing or sound guidance. This 10-second vertical clip costs 160 credits ($0.80 at list price), with zero extra charge for the reference files.

5. Video-reference motion and camera style (reference_video_urls)

Use reference_video_urls when you want to carry camera choreography, pacing, or subject motion from an existing clip into a newly described environment.

{
  "model": "magi-2",
  "input": {
    "prompt": "0-5s: Follow the smooth forward dolly movement and pacing of the reference video through a neon-lit night market alley after rain. Wet asphalt reflects red and amber signage as steam rises from noodle stalls on both sides. 5-10s: Continue the steady camera glide past a chef tossing a wok, with sparks lifting briefly into the humid air. Sizzling oil, clattering metal spatulas, lively crowd murmur, and a distant scooter passing. No dialogue.",
    "reference_video_urls": [
      "https://example.com/dolly-camera-ref.mp4"
    ],
    "duration": 10,
    "aspect_ratio": "16:9",
    "generate_audio": true
  }
}

Each file in reference_video_urls must be MP4 or MOV, between 2 and 30 seconds long, and the combined length of all reference videos in one task cannot exceed 30 seconds. Just like images and audio, reference video seconds are not billed on PoYo—only the 10 output seconds count (160 credits / $0.80 at list price).

Strict schema validation rules and common pitfalls

The magi-2 endpoint enforces strict schema validation. Check these constraints on your server before submitting so you avoid HTTP 200 / code: 400 validation rejections:

RuleExact limit / behaviorWhat breaks requests
No extra fieldsOnly documented input keys are allowedSending negative_prompt or other unsupported keys is rejected
Mode separationimage_urls and reference_* are mutually exclusiveSending image_urls alongside reference_image_urls fails validation
prompt lengthRequired, 1–15,000 charactersEmpty string or prompts over 15,000 characters
durationInteger 4–30 (default 5)Floats like 5.5 or values outside 4–30
resolution1080p onlyRequesting 720p or 4k
image_urls1–2 public JPG, PNG, or WEBP URLsSending 3+ images or non-public links
reference_* countsUp to 10 images, 5 videos, 5 audio clipsExceeding per-type count limits
Reference media duration2–30 s per clip; 30 s total per type (video / audio)Sending a 1-second clip or two 20-second videos (40 s total)
seedOptional integer 0–2147483647Negative numbers or strings

Because negative_prompt is not part of the schema, express exclusions directly in prompt using clear, positive or direct phrasing—for example, "No dialogue.", "No background music.", or "Uncluttered studio backdrop."

Iterating on prompts without wasting credits

Since PoYo bills magi-2 strictly by output seconds (duration × 16 credits), the fastest way to control spend while refining a complex script is to draft short and scale up:

  1. Prototype at 4 or 5 seconds first. Test a single beat, character look, or voice cue at duration: 4 (64 credits / $0.32) or duration: 5 (80 credits / $0.40) before rendering a 30-second sequence (480 credits / $2.40).
  2. Lock seed while editing one variable. Keep the same seed when adjusting a line of dialogue or a sound cue so you can isolate what changed.
  3. Host references on fast, public HTTPS URLs. Ensure any signed URL stays valid for the full queue and generation window.
  4. Track task_id before polling. Poll GET https://api.poyo.ai/api/generate/status/{task_id} or configure callback_url rather than re-submitting on a client timeout, which would create a second billed task.

Frequently asked questions

Does the MAGI-2 API support negative_prompt? No. The magi-2 schema rejects extra fields outside its specification, including negative_prompt. Describe what to omit directly inside prompt (for example, "No dialogue." or "No music.").

How long can a MAGI-2 API prompt be? Up to 15,000 characters. That leaves plenty of room for multi-beat timed shot lists, camera directions, quoted dialogue, and layered sound cues in a single 4–30 second request.

How do I write dialogue for lip sync in the MAGI-2 API? Name the speaker right before their line and enclose the spoken words in double quotes ("...") inside prompt. Keep generate_audio set to true (the default) and leave enough seconds in duration for the lines to be spoken naturally.

Can I combine image_urls with reference_image_urls in one MAGI-2 API request? No. First/last frame mode (image_urls) and reference-to-video mode (reference_image_urls, reference_video_urls, reference_audio_urls) are mutually exclusive and cannot be mixed in the same task.

Can I send reference_audio_urls without a reference image or video? Yes. reference_audio_urls is valid on its own (up to 5 MP3 or WAV files, 2–30 seconds each, 30 seconds total) as long as you do not combine it with image_urls.

Does setting generate_audio: false lower the MAGI-2 API price? No. On PoYo, magi-2 is billed at a flat 16 credits ($0.08) per output second (as low as $0.072/s on large top-ups) regardless of whether generate_audio is true or false.

Share: