Model APIs
MAGI-2
SeedRouter 上 MAGI-2 文字轉影片、首尾影格圖片轉影片與多模態參考轉影片的非同步 API 參考文件。
MAGI-2 是 Sand.ai 推出的 480B 原生影音模型。在 SeedRouter 上,它透過統一非同步影片生成端點(POST /v1/videos/generations)開放三個公開模型 ID,並透過 GET /v1/tasks/{id} 輪詢任務狀態。
| 模型 ID | 模式 | 必填輸入 |
|---|---|---|
magi-2-text-to-video | 文字轉影片 | prompt(非空白字串,最多 15,000 個字元) |
magi-2-image-to-video | 首影格 / 首尾影格圖片轉影片 | image_urls(1–2 個公開 HTTP/HTTPS 圖片 URL) |
magi-2-reference-to-video | 多模態參考轉影片 | image_urls、video_urls 或 audio_urls 至少提供一項 |
全部三條路由均輸出 4 至 30 秒(整數)的 1080p MP4 影片,並可選配同步對白、音效與配樂(預設 generate_audio: true)。
端點與身分驗證
- 送出任務:
POST https://api.seedrouter.ai/v1/videos/generations - 輪詢任務狀態:
GET https://api.seedrouter.ai/v1/tasks/{id} - 身分驗證:
Authorization: Bearer YOUR_API_KEY - Content-Type:
application/json
請求參數
傳入未定義欄位會遭拒絕,並回傳 HTTP 400(invalid_request_error)。
| 參數 | 型別 | 預設值 | 限制與說明 |
|---|---|---|---|
model | string | 必填 | magi-2-text-to-video、magi-2-image-to-video 或 magi-2-reference-to-video。 |
prompt | string | — | magi-2-text-to-video 必填;圖片轉影片與參考轉影片選填。傳入時須為非空白字串,且不得超過 15,000 個字元。 |
image_urls | string[] | — | 公開 HTTP/HTTPS 圖片 URL(不接受 Base64 或 data: URI,單張低於 30 MB)。magi-2-text-to-video 不接受此欄位;magi-2-image-to-video 需傳入 1 張(首影格)或 2 張(首影格與尾影格);magi-2-reference-to-video 最多支援 10 張。 |
video_urls | string[] | — | 僅限 magi-2-reference-to-video。最多 5 個公開 HTTP/HTTPS MP4/MOV 參考影片(單檔不超過 200 MB,每段 2–30 秒,總長 ≤ 30 秒)。 |
audio_urls | string[] | — | 僅限 magi-2-reference-to-video。最多 5 段公開 HTTP/HTTPS WAV/MP3 參考音訊(單檔不超過 15 MB,每段 2–30 秒,總長 ≤ 30 秒)。 |
duration | integer | 5 | 請求輸出的影片長度(秒),4 到 30 之間的整數。 |
quality | string | "1080p" | 輸出解析度,目前為 "1080p"。 |
aspect_ratio | string | "16:9" | 可選 "16:9"、"9:16"、"1:1"、"4:3"、"3:4"、"21:9"。 |
generate_audio | boolean | true | 免費生成影音同步的對白、音效與配樂。設為 false 則輸出靜音影片。 |
seed | integer | — | 選填隨機種子碼(0 到 4294967295),用於重現生成結果。 |
呼叫範例
1. 文字轉影片
curl -X POST https://api.seedrouter.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEDROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2-text-to-video",
"prompt": "Continuous 5-second tracking shot through a rainy Tokyo alley at dusk, neon reflections on wet asphalt, distant train rumble and footsteps",
"duration": 5,
"quality": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}'2. 圖片轉影片(首影格 / 首尾影格)
curl -X POST https://api.seedrouter.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEDROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2-image-to-video",
"prompt": "The camera slowly pushes in as subtle natural motion brings the frame to life",
"image_urls": [
"https://example.com/first-frame.jpg"
],
"duration": 5,
"quality": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}'3. 參考轉影片
curl -X POST https://api.seedrouter.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEDROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2-reference-to-video",
"prompt": "The same character walks through a sunlit street market, handheld tracking shot",
"image_urls": [
"https://example.com/character.jpg"
],
"duration": 5,
"quality": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}'4. 輪詢任務結果
curl https://api.seedrouter.ai/v1/tasks/task_xxxxxxxx \
-H "Authorization: Bearer $SEEDROUTER_API_KEY"送出任務後會回傳:
{
"id": "task_xxxxxxxx",
"model": "magi-2-text-to-video",
"status": "processing",
"created_at": 1764120000
}當輪詢狀態變為 "status": "completed" 時,交付的 MP4 網址位於 output.video_url:
{
"id": "task_xxxxxxxx",
"model": "magi-2-text-to-video",
"status": "completed",
"created_at": 1764120000,
"finished_at": 1764120095,
"output": {
"video_url": "https://static.seedrouter.ai/..."
}
}計費方式
全部三條 MAGI-2 路由皆依 1080p 請求輸出秒數計費(duration 範圍為 4 至 30 秒)。參考圖片、參考影片、參考音訊與同步音訊生成均不額外收費。失敗的任務不扣費。
前往 MAGI-2 模型頁面 查看目前即時按秒費率。
