MAGI-2 動画 API
テキスト、最初と最後のフレーム、またはマルチメディア参照から、音声付きの 1080p 動画を生成できます。
MAGI-2 動画 API
テキスト、最初と最後のフレーム、またはマルチメディア参照から、音声付きの 1080p 動画を生成できます。
送信とダウンロード
コンソールで API キーを作成します。Bearer 認証で JSON を送信し、返されたタスク ID を保存します。同じタスクを成功または失敗まで照会し、同じキーで MP4 をダウンロードします。照会のタイムアウトでタスクは停止しません。
curl --fail-with-body "https://apimaster.ai/v1/videos/generations" \
-H "Authorization: Bearer $APIMASTER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: magi2-cup-001" \
-d '{"model":"magi-2","prompt":"A slow camera move toward a ceramic cup in soft daylight.","duration":5,"aspect_ratio":"16:9"}'
{"id":"task_…","task_id":"task_…","object":"video","model":"magi-2","status":"queued"}
TASK_ID="task_..."
curl --fail-with-body "https://apimaster.ai/v1/videos/$TASK_ID" \
-H "Authorization: Bearer $APIMASTER_API_KEY"
curl --fail-with-body --location "https://apimaster.ai/v1/videos/$TASK_ID/content" \
-H "Authorization: Bearer $APIMASTER_API_KEY" -o magi-2.mp4
queued → in_progress → completed / failed
生成モード
テキストから動画
{"model":"magi-2","prompt":"A blue cup on a table. Slow camera push in with quiet room tone.","duration":4,"generate_audio":true}
最初と最後のフレーム
{"model":"magi-2","prompt":"Move from the first composition to the final composition.","first_frame_image":"https://example.com/start.jpg","last_frame_image":"https://example.com/end.jpg","aspect_ratio":"auto","generate_audio":false}
マルチモーダル参照
{
"model": "magi-2",
"prompt": "Use the image for appearance, the clip for camera movement and the audio for mood.",
"duration": 6,
"omni_reference_task_type": "reference",
"image_with_roles": [{"url": "https://example.com/object.jpg", "role": "reference_image"}],
"video_urls": ["https://example.com/camera.mp4"],
"audio_urls": ["https://example.com/room-tone.mp3"]
}
認証不要で直接取得できる公開 HTTP(S) URL を使います。参照素材は生成内容を誘導します。編集、延長、中間キーフレームは利用できません。
パラメータ
| フィールド | 型 | 仕様 |
|---|---|---|
model |
string |
magi-2 |
prompt |
string |
すべてのモードで必須。最大 15,000 文字。 |
duration / seconds |
integer |
4~30 の整数秒。既定は 5。両方を指定する場合は同じ値にします。 |
resolution |
string |
1080p のみ。省略できます。 |
aspect_ratio |
string |
テキストと参照の既定は 16:9。9:16、1:1、4:3、3:4、21:9 も使用できます。フレーム指定時は省略または auto で最初のフレームに合わせます。このモードでは 21:9 は非対応です。 |
generate_audio / audio |
boolean |
音声は既定で有効です。両方の指定値は一致させます。参照音声は audio_urls に指定します。 |
nsfw_check |
boolean |
送信前にプロンプトと入力画像を任意で審査します。既定は false。 |
seed |
integer |
省略または -1 でランダム。0~2147483647 の固定値でも同一の結果は保証されません。 |
omni_reference_task_type |
string |
auto または reference。動画、音声、reference_image の指定で参照モードになります。image_urls の画像だけを参照に使う場合は reference を明示します。 |
image_urls |
string[] |
フレーム指定では 1~2 枚。参照モードでは reference_image と合わせて最大 10 枚です。 |
first_frame_image / last_frame_image |
string |
image_urls と択一です。最後のフレームを指定する場合は最初のフレームが必須です。 |
image_with_roles |
object[] |
各要素に url と role を指定します。first_frame、last_frame、reference_image のいずれかを選びます。 |
video_urls / audio_urls |
string[] |
種類ごとに最大 5 クリップ、各 2~30 秒、種類ごとの合計は 30 秒以下です。 |
料金とエラー
Sand AI の基本料金は指定した出力 1 秒あたり 0.08 米ドルです。5 秒は 0.40 米ドルです。音声、素材、アスペクト比で基本料金は変わりません。拒否や生成失敗には課金されません。message / error.message を確認してください。送信がタイムアウトした場合は同じ Idempotency-Key と本文を使用します。
