MAGI-2 API リファレンス:Sand.ai Magi AI 動画エンドポイント&スキーマ
Sand.aiのフラッグシップ480BモデルMAGI-2は、Atlas Cloud上で3つの正規Magi AI動画APIモデルID(`sand-ai/magi-2/text-to-video`、`sand-ai/magi-2/image-to-video`、`sand-ai/magi-2/reference-to-video`)を公開しています。いずれも `POST https://api.atlascloud.ai/api/v1/model/generateVideo` へ送信し、`GET /api/v1/model/prediction/{request_id}` で結果を照合します。すべてのエンドポイントが一律$0.08/秒の卸売課金(4〜30秒の1秒刻み整数)で、ネイティブ音声および最大20個のOmni-Referenceに対応しています。
- ベースオリジン
- https://api.atlascloud.ai
- モデル数
- 3つのフラッグシップエンドポイント
- 再生時間レンジ
- 4〜30秒の整数(1秒刻み)
- 最大プロンプト長
- 15,000文字
Atlas Cloud OpenAPI エンドポイント定義 (2026-12-02)
MAGI-2 Text-to-Video
| フィールド | 型 | 必須 | 制約・挙動 |
|---|---|---|---|
| model | string | 必須 | Literal "sand-ai/magi-2/text-to-video" Canonical Atlas Cloud model identifier for flagship MAGI-2 T2V. |
| prompt | string | 必須 | 1–15,000 characters Structured director brief describing subjects, camera moves, lighting, timestamped shot cuts, dialogue lines, foley, and explicit "no music" if score is unwanted. |
| duration | integer | 任意 (5) | Integer 4–30 (1-second steps) Requested clip duration in seconds. Billed per integer second. |
| aspect_ratio | enum | 任意 (16:9) | "16:9" | "9:16" | "21:9" | "4:3" | "3:4" | "1:1" Target 1080p-class framing ratio. |
{
"model": "sand-ai/magi-2/text-to-video",
"prompt": "[00:00-00:04] Medium close-up in a rain-streaked diner booth under warm tungsten overhead lamps, slow 50mm dolly-in. A tired detective sets a chipped ceramic mug on Formica and says calmly: \"You left the ledger at Pier Nine.\" Audio: muffled rain on glass, ceramic clink, no music.",
"duration": 4,
"aspect_ratio": "16:9"
}MAGI-2 Image-to-Video (First / Last Frame)
| フィールド | 型 | 必須 | 制約・挙動 |
|---|---|---|---|
| model | string | 必須 | Literal "sand-ai/magi-2/image-to-video" Canonical Atlas Cloud model identifier for flagship MAGI-2 I2V. |
| image | string | 必須 | Public HTTPS image URL or Base64 data URI (JPEG/PNG/WebP) Opening keyframe. Output aspect ratio automatically follows this image. |
| last_image | string | 任意 | Public HTTPS image URL or Base64 data URI matching start aspect ratio Optional closing keyframe for guided start-to-end camera and subject transitions. |
| prompt | string | 必須 | 1–15,000 characters Motion, camera choreography, dialogue, foley, and lighting progression between keyframes. |
| duration | integer | 任意 (5) | Integer 4–30 (1-second steps) Requested clip duration in seconds. Billed per integer second. |
{
"model": "sand-ai/magi-2/image-to-video",
"image": "https://assets.magiai.ai/examples/espresso-start.webp",
"last_image": "https://assets.magiai.ai/examples/espresso-pour-end.webp",
"prompt": "Macro 100mm locked push-in as tiger-striped espresso crema flows smoothly from a naked portafilter into a preheated stoneware demitasse. Steam rises against a dark slate background. Audio: pump hum, steady espresso drip, subtle ceramic resonance, no music.",
"duration": 6
}MAGI-2 Reference-to-Video (Omni-Reference)
| フィールド | 型 | 必須 | 制約・挙動 |
|---|---|---|---|
| model | string | 必須 | Literal "sand-ai/magi-2/reference-to-video" Canonical Atlas Cloud model identifier for flagship MAGI-2 Omni-Reference. |
| prompt | string | 必須 | 1–15,000 characters referencing @image_n, @video_n, @audio_n roles Director brief explicitly binding each uploaded reference slot to its subject, motion, or audio role. |
| duration | integer | 任意 (5) | Integer 4–30 (1-second steps) Requested clip duration in seconds. Flat $0.08/s regardless of reference count. |
| aspect_ratio | enum | 任意 (16:9) | "16:9" | "9:16" | "21:9" | "4:3" | "3:4" | "1:1" Target 1080p-class framing ratio. |
| images | string[] | 任意 | Max 10 items (public HTTPS URLs or Base64) Identity portraits, product angles, wardrobe sheets, or set plates. |
| videos | string[] | 任意 | Max 5 public HTTPS URLs; 2–30s each; combined duration <= 30s Camera movement, actor blocking, or performance pacing references. |
| audios | string[] | 任意 | Max 5 public HTTPS URLs; 2–30s each; combined duration <= 30s Voice timbre samples, spoken stems, musical grooves, or foley beds. |
{
"model": "sand-ai/magi-2/reference-to-video",
"prompt": "Using the speaker in @image_1 wearing the linen jacket in @image_2 inside the sunlit studio from @image_3, match the natural voice timbre of @audio_1 and slow handheld framing of @video_1. [00:00-00:05] She holds the serum bottle toward camera and says clearly: \"Three drops after cleansing keeps winter redness calm all day.\" Audio: crisp room tone, soft glass click, no music.",
"duration": 8,
"aspect_ratio": "9:16",
"images": [
"https://assets.magiai.ai/examples/founder-portrait.webp",
"https://assets.magiai.ai/examples/serum-bottle.webp",
"https://assets.magiai.ai/examples/bathroom-vanity.webp"
],
"videos": [
"https://assets.magiai.ai/examples/handheld-framing-4s.mp4"
],
"audios": [
"https://assets.magiai.ai/examples/founder-voice-5s.wav"
]
}認証・ヘッダーおよび基本エンドポイント
Atlas Cloudへの直接リクエストにはすべてHTTPS、`Authorization: Bearer <API_KEY>`、および `Content-Type: application/json` が必須です。レスポンスはトップレベルの `data` オブジェクト内に予測メタデータをラップします(クライアント側のパーサーでは、トップレベル直下へのフォールバック参照も防御的に実装することを推奨します)。MagiAI Studioの統合ワークスペースでは、クレジット仮押さえとジョブ投入を行う `/api/jobs`(POSTで投入、GETでステータス照合および台帳残高取得)と、スコープ付き `mgk_live_*` 認証情報を発行する `/api/keys` を認証付きエンドポイントとして提供しています。
| 操作 | メソッド&URL | 成功ステータス | 備考 |
|---|---|---|---|
| MAGI-2 ジョブ投入(Atlas直結) | POST https://api.atlascloud.ai/api/v1/model/generateVideo | 200 / 201 / 202 | T2V、I2V、またはOmni-Refを非同期で投入し、`data.id` を返却 |
| 予測ステータス取得(Atlas直結) | GET https://api.atlascloud.ai/api/v1/model/prediction/{request_id} | 200 OK | `completed`、`succeeded`、`failed`、または `canceled` になるまで20〜30秒ごとにポーリング |
| ジョブ投入(MagiAI Studio) | POST https://magiai.ai/api/jobs | 201 Created | プロンプト・参照素材を検証し、R2Vでは `likenessConsent` を強制検証、10 cr/秒をアトミックに仮押さえ |
| ジョブ一覧&照合(MagiAI Studio) | GET https://magiai.ai/api/jobs | 200 OK | 進行中のレンダリングをポーリングし、失敗・フィルタ対象ジョブに対して100%自動返金を記帳 |
フィールド命名の違い:Atlas Cloud直結 vs. MagiAI Studio `/api/jobs`
MagiAI Studioのジョブと素のAtlas Cloud呼び出しを橋渡しする際は、スキーマ上の2つの細かな違いに注意してください。第1に、`sand-ai/magi-2/image-to-video` は `aspect_ratio` を**受け付けません**(常に指定された開始フレーム `image` のアスペクト比を継承します)。第2に、MagiAI Studioの `/api/jobs` エンドポイントはキャメルケースのキー(`aspectRatio`、`lastImage`、`referenceImages`、`referenceVideos`、`referenceAudios`、`likenessConsent`)を採用しており、統合クレジットウォレットを追跡しながらアップストリームプロバイダーのペイロードへ自動変換します。
{
"mode": "reference-to-video",
"prompt": "Using Mara (@image_1) in the diner booth (@image_2) with dry voice (@audio_1) and dolly pacing (@video_1): [00:00-00:05] She sets down the ceramic mug and says calmly: \"You left the ledger at Pier Nine.\" Audio: rain on glass, ceramic clink, no music.",
"duration": 8,
"aspectRatio": "16:9",
"referenceImages": [
"https://assets.magiai.ai/examples/founder-portrait.webp",
"https://assets.magiai.ai/examples/diner-booth.webp"
],
"referenceVideos": ["https://assets.magiai.ai/examples/handheld-framing-4s.mp4"],
"referenceAudios": ["https://assets.magiai.ai/examples/founder-voice-5s.wav"],
"likenessConsent": true
}HTTPステータスコードと予測の終了状態
リトライ可能なトランスポートエラー(HTTP 429 レート/並列数制限、HTTP 502/503/504 一時的なエッジタイムアウト)と、リトライ不可のペイロードエラー(HTTP 400/422 不正な秒数、20個超の参照素材、合計30秒超の参照動画・音声、またはHEIC画像)を常に明確に区別してください。
| コード / 状態 | 意味 | クレジット / 課金への影響 | クライアント側アクション |
|---|---|---|---|
| processing / queued | アップストリームの480Bクラスタ上で処理中 | 引き落とし仮押さえ(ホールド)有効 | 20〜30秒ごとにポーリングを継続(標準7〜26分) |
| completed / succeeded + outputs[0] | 1080p・25fps MP4の準備完了 | 仮押さえを確定($0.08/秒 / 10 cr/秒) | 即座にMP4をダウンロードし、R2/S3へアーカイブ |
| completed + 空の outputs[] | PG-13セーフティフィルタにより出力を除外 | アップストリーム $0 · 100%自動返金 | `policy_filtered` として記録・ウォレットへ返金し、PG-13準拠の修正ヒントを提示 |
| failed / canceled | アップストリームエラーまたはモデレーションブロック | アップストリーム $0 · 100%自動返金 | `error` メッセージを確認し、プロンプトや素材を修正してから再試行 |
| HTTP 402 | ウォレットクレジット残高不足(MagiAI Studio) | 引き落としなし | 有効期限なしのPAYGパックのチャージをユーザーに案内 |
| HTTP 429 | アカウントの並列数またはレート制限に到達 | 引き落としなし | Retry-After を尊重し、実行中スロットが空くまでローカルでキュー待機 |
APIホストの選定とマルチモデルルーティング設計
MAGI-2と直接連携する開発チームは、ファーストパーティのSand.ai Direct(`platform.sand.ai`)、Atlas Cloud(`atlascloud.ai`)、WaveSpeedAI(`wavespeed.ai`)、Runware(`runware.ai`)、またはHiggsfield APIに接続できます。2026年12月2日現在、いずれもベースレート$0.08/秒を掲げています。バックエンドでMAGI-2と並行してKling 4.0、Seedance 2.5、Google Veo 3.1、テキストLLMを単一のAPIキーと統合請求でオーケストレーションする場合は、SpicyAPI(`https://spicyapi.ai`)のようなマルチモデル開発者ゲートウェイを利用することで、プロバイダーごとに個別のSDKアダプターを保守する手間を省けます。なお、2026年12月2日現在、fal.ai(`r/fal` によればロードマップ段階)およびReplicateのいずれもフラッグシップ480B MAGI-2のホストには対応していません。