
写好一条 MAGI-2 API 提示词,更像是在写一份微缩分镜脚本,而不是敲一句简短的画面描述。因为 PoYo 上的 magi-2 在 prompt 中最多支持 15,000 个字符,且能一次性生成长达 30 秒带同步音频的 1080p 视频,同一个文本字段要同时指挥镜头时间轴、运镜方式、用于对口型的台词以及音效层次。你可以在 MAGI-2 模型页在线调试这些写法,或在 MAGI-2 API 文档中查看每一项 schema 约束。
本文介绍如何围绕 POST https://api.poyo.ai/api/generate/submit 组织三种输入模式的提示词,并给出五个完整、符合 schema 校验、可直接发送的 JSON 请求体。下文所有规则均源自 PoYo API schema 与 Sand AI 的 MAGI-2 文档,不对示例提示词的画质或生成速度做未经实测的夸大。如需鉴权、轮询循环和 Webhook 接入说明,请看 MAGI-2 API 指南。
MAGI-2 API 提示词的核心结构
Sand AI 的 MAGI-2 发布公告与 PoYo API 文档都强调了应该直接写进 prompt 字符串的三个要素:
- 分时镜头表(时间轴控制)。 与其只描写一个静态瞬间,不如把较长的片段按明确的时间区间拆分——例如
0-4s、4-8s和8-12s——逐段指定景别、运镜与主体动作,并让最后一个时间戳与整数duration(4 至 30 秒)对齐。 - 加引号的对口型台词。 在台词前写明说话人,并用英文双引号(
"...")包裹要说出口的内容。控制字数与该段时长相匹配,让语速自然落在请求的duration之内。 - 拟音、环境音与音乐提示。 明确写出非人声的音频层次:脚步声、雨点打在金属上的声音、远处车流、意式咖啡机蒸汽声,或轻柔的原声吉他。如果只需要环境音而不要人声,直接在提示词中写上
"No dialogue."。关于音频行为的更深入说明,请阅读 MAGI-2 API 有声视频。
三种互斥的输入模式
每次 magi-2 请求只能使用一种输入模式。把 image_urls 和任何 reference_* 字段混在一起发送会触发校验失败。
| 输入模式 | 必填字段 | 可选媒体字段 | aspect_ratio 规则 |
|---|---|---|---|
| 文生视频 | prompt | 无 | 16:9(默认)、9:16、1:1、4:3、3:4、21:9 |
| 首帧 / 首尾帧 | prompt、image_urls(1–2 个 URL) | 无(不能与 reference_* 混用) | 省略或传 "auto"(跟随首帧比例) |
| 参考生视频 | prompt + 至少一个 reference_* 数组 | reference_image_urls(≤10)、reference_video_urls(≤5)、reference_audio_urls(≤5) | 16:9(默认)、9:16、1:1、4:3、3:4、21:9 |
三种模式在 PoYo 上均输出 1080p MP4,且统一按 每输出秒 16 积分($0.08) 计费;大额充值叠加额外 10% 折扣后低至 每秒 $0.072。参考图片、视频和音频素材均不计费。完整价格表请见 MAGI-2 API 价格和 MAGI-2 API 概览。
五个完整的 MAGI-2 API 请求体
下面每一个 JSON 对象都是可直接发送到 POST https://api.poyo.ai/api/generate/submit(携带 Authorization: Bearer $POYO_API_KEY)的完整请求体。提交前请将其中的占位媒体链接 https://example.com/... 替换为你自己可公网下载的文件 URL。
1. 文生视频:分时镜头表 + 引号对白
当你需要在一个镜头序列里完成多次切镜和双人往返对白时,使用分时节拍结构效果最好。设置 seed(0 到 2147483647 之间的任意整数)可以在保持其余画面稳定的前提下,单独微调某句台词或机位。
{
"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
}
}
为什么这样写有效: 每个 4 秒节拍只安排一次清晰的视觉切换和一句简短台词,总长正好对应 duration: 12(标价 192 积分 / $0.96)。两位说话人在引号台词前都有明确指代,拟音与环境音(雨声、收音机吉他声、翻书声)也与对白清晰分开。
2. 纯环境音与静音视频选项
当你需要氛围空镜、产品镜头或不需要人声的定场画面时,保持 generate_audio 开启,同时在提示词里明确写出 "No dialogue." 并给出具体的拟音描述。
{
"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
}
}
如果你的后期管线会完全替换音轨、需要不带音轨的静音 MP4,只需把 "generate_audio": true 改为 "generate_audio": false。注意关闭音频不会降低费用:8 秒请求无论是否带音频,标价都是 128 积分($0.64)。
3. 首尾帧过渡(image_urls)
在 image_urls 中传入 1 张图片可锁定起始帧,传入 2 张图片则同时锁定起始帧和结束帧。提示词应重点描述两帧之间的物理过渡过程、镜头运动路径以及伴随动作产生的声音。
{
"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
}
}
使用 image_urls 时,要么省略 aspect_ratio,要么传入 "aspect_ratio": "auto",让输出继承首帧尺寸。两张图片 URL 都必须是公网可访问的 JPG、PNG 或 WEBP 文件。6 秒请求标价 96 积分($0.48)。
4. 全能参考:角色图 + 参考音频
参考模式允许在单个任务中组合最多 10 张参考图、5 段参考视频和 5 段参考音频。请务必在 prompt 中交代每个参考素材承担的角色——例如哪张图定义了人物或场景,参考音频应该以何种方式出现在画面里。
{
"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
}
}
参考音频必须为 MP3 或 WAV 格式,单段 2–30 秒,同一任务内所有参考音频总时长不超过 30 秒。如果只需要音频驱动节奏或提供声音引导,你也可以不传任何参考图片或视频,单独发送 reference_audio_urls。这条 10 秒竖版片段标价 160 积分($0.80),参考文件不额外计费。
5. 视频参考运镜与动作风格(reference_video_urls)
当你想把一段已有素材的运镜编排、剪辑节奏或主体动作迁移到全新场景时,使用 reference_video_urls。
{
"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
}
}
reference_video_urls 中的每个文件都必须是 MP4 或 MOV 格式,时长在 2 至 30 秒之间,且单个任务中所有参考视频的总时长不能超过 30 秒。与参考图和音频一样,PoYo 不会对参考视频秒数收费——只按 10 秒输出计费(标价 160 积分 / $0.80)。
严格的 Schema 校验规则与常见踩坑点
magi-2 接口执行严格的 schema 校验。在服务端提交前先核对以下约束,可避免收到 HTTP 200 / code: 400 校验报错:
| 规则 | 确切限制 / 行为 | 常见导致失败的写法 |
|---|---|---|
| 禁止额外字段 | 仅允许文档列出的 input 键名 | 传入 negative_prompt 或其他未支持字段会被拒绝 |
| 模式隔离 | image_urls 与 reference_* 互斥 | 同时传入 image_urls 和 reference_image_urls 会校验失败 |
prompt 长度 | 必填,1–15,000 字符 | 空字符串或超过 15,000 字符 |
duration | 整数 4–30(默认 5) | 传入 5.5 这类小数,或超出 4–30 范围 |
resolution | 仅支持 1080p | 请求 720p 或 4k |
image_urls | 1–2 个公网 JPG、PNG 或 WEBP 链接 | 传 3 张及以上,或使用无法公网访问的链接 |
reference_* 数量 | 最多 10 张图、5 段视频、5 段音频 | 超过任一分类的数量上限 |
| 参考媒体时长 | 单段 2–30 秒;同类型(视频/音频)总长 ≤30 秒 | 传入 1 秒片段,或传入两段 20 秒视频(总计 40 秒) |
seed | 可选整数 0–2147483647 | 传负数或字符串 |
由于 schema 中没有 negative_prompt,需要排除的元素请直接用清晰、直接的表述写进 prompt——例如 "No dialogue."、"No background music." 或 "Uncluttered studio backdrop."。
迭代提示词时如何省积分
因为 PoYo 对 magi-2 严格按输出秒数计费(duration × 16 积分),打磨复杂脚本时最省钱的办法就是先短后长:
- 先用 4 秒或 5 秒跑原型。 在渲染 30 秒长镜头(480 积分 / $2.40)之前,先用
duration: 4(64 积分 / $0.32)或duration: 5(80 积分 / $0.40)验证单个节拍、角色造型或人声效果。 - 锁定
seed,每次只改一个变量。 调整某句台词或音效提示时保持seed不变,方便观察改动带来的实际变化。 - 把参考素材托管在稳定的公网 HTTPS 地址上。 如果使用签名 URL,请确保有效期覆盖整个排队与生成窗口。
- 先记录
task_id再轮询。 客户端超时后请继续轮询GET https://api.poyo.ai/api/generate/status/{task_id}或配置callback_url,切勿盲目重提,否则会产生第二个计费任务。
常见问题
MAGI-2 API 支持 negative_prompt 吗?
不支持。magi-2 的 schema 会拒绝规范之外的额外字段,包括 negative_prompt。请直接在 prompt 内写明要排除的内容(例如 "No dialogue." 或 "No music.")。
MAGI-2 API 的提示词最长可以写多少字符? 最多 15,000 个字符。这为单次 4–30 秒请求里的多节拍分时镜头表、运镜指示、引号台词和分层音效提示留出了充足空间。
在 MAGI-2 API 里怎么写对口型台词?
在 prompt 中紧挨台词前写明说话人,并用英文双引号("...")包裹台词文本。保持 generate_audio 为 true(默认值),并在 duration 中留出足够秒数让台词自然说完。
可以在同一次 MAGI-2 API 请求里混用 image_urls 和 reference_image_urls 吗?
不行。首尾帧模式(image_urls)与参考生视频模式(reference_image_urls、reference_video_urls、reference_audio_urls)互斥,不能在同一个任务中混用。
可以不传参考图片或视频、只传 reference_audio_urls 吗?
可以。只要不同时传入 image_urls,reference_audio_urls 可以单独使用(最多 5 个 MP3 或 WAV 文件,单段 2–30 秒,总长不超过 30 秒)。
设置 generate_audio: false 会降低 MAGI-2 API 价格吗?
不会。在 PoYo 上,无论 generate_audio 为 true 还是 false,magi-2 都统一按每输出秒 16 积分($0.08)计费(大额充值低至 $0.072/秒)。