Video
Grok Imagine Video 1.5
用 Grok Imagine Video 1.5 從提示詞或一張圖片生成 6–15 秒有聲音的影片,480p 或 720p,按秒計費,以任務形式交付。
Grok Imagine Video 1.5 是 xAI 的影片模型。一次請求就能從提示詞,或從提示詞加一張圖片,生成一段 6–15 秒、有聲音的 480p 或 720p 影片,畫面比例為 16:9、9:16 或 1:1。傳送請求,保存回傳的任務 ID,再從該任務讀取生成完成的影片。圖片以 URL 形式傳入。
模型 ID
| 模型 ID | 輸入 | 解析度 | 時長 |
|---|---|---|---|
grok-imagine-video-1-5 | 文字、一張圖片 | 480p、720p | 6–15 秒 |
目前價格請查看模型頁面。
快速範例
curl https://api.seedrouter.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEDROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1-5",
"prompt": "A red paper boat drifting on a calm pond at sunrise, soft mist, slow push-in, birdsong. No text, no logos.",
"resolution": "480p",
"duration": 8,
"aspect_ratio": "16:9"
}'端點
POST https://api.seedrouter.ai/v1/videos/generations| 請求標頭 | 值 |
|---|---|
| Authorization | Bearer YOUR_API_KEY |
| Content-Type | application/json |
回應是一個任務({"id": "task_...", "status": "processing"}),而不是生成完成的影片。請輪詢 GET /v1/tasks/{task_id} 取得結果。請把 API 金鑰保存在伺服器端程式碼中。
參數
| 欄位 | 類型 | 預設值 | 說明 |
|---|---|---|---|
model | string | 必填 | grok-imagine-video-1-5 |
prompt | string | 必填 | 最多 10,000 個字元。使用圖片時也必填。 |
image_urls | URL 清單 | 無 | 最多一張圖片。提供時為圖片轉影片,不提供時為文字轉影片。 |
resolution | enum | 480p | 480p 或 720p。 |
duration | integer | 8 | 6–15 秒。 |
aspect_ratio | enum | 16:9 | 16:9、9:16 或 1:1。使用圖片時,影片的畫面比例與圖片一致。 |
audio | boolean | true | 為相容性而接受。每段影片都有聲音:設為 false 也不會生成無聲影片。 |
fallback | object | 無 | {"enabled": true} 或 {"enabled": false}。為相容性而接受,但會被忽略。 |
請求結構採嚴格驗證:未知欄位會被拒絕,而不是被忽略。不支援 callback_url;請改為輪詢任務。
圖片轉影片
在 image_urls 中傳入一張圖片,並在 prompt 中描述接下來發生什麼。影片以這張圖片開頭,畫面比例與它一致,因此無論 aspect_ratio 設為什麼,直式圖片都會生成直式影片。
{
"model": "grok-imagine-video-1-5",
"prompt": "The subject slowly turns toward the camera, soft natural light, gentle breeze, quiet room tone.",
"image_urls": ["https://example.com/start.png"],
"resolution": "720p",
"duration": 6
}媒體輸入
圖片是一個公開的 HTTP(S) URL。不接受 Base64 data URI:請把檔案上傳到你自己的儲存空間,再傳入它的 URL。請使用不超過 10 MB 的 JPG 或 PNG 圖片。
計費維度
目前費率請查看模型定價部分。Grok Imagine Video 1.5 按影片秒數計費,費率由解析度決定:
cost = duration × rate per second for the resolution文字轉影片和圖片轉影片價格相同。時長在請求受理時就已確定,因此預扣金額就是實際扣款金額。最終扣款請在帳戶的用量紀錄中查看。失敗的任務不計費。
輸出結構
提交後回傳任務:
{"id": "task_...", "model": "grok-imagine-video-1-5", "status": "processing", "created_at": 1789689600}查詢任務
GET https://api.seedrouter.ai/v1/tasks/{task_id}每 10–20 秒輪詢一次,直到 status 變為 completed 或 failed。輪詢過程中出現網路逾時,並不代表生成失敗:請保留任務 ID 並繼續查詢。不要為了查看進度而再建立一個任務。
完成的任務
{
"id": "task_...",
"model": "grok-imagine-video-1-5",
"status": "completed",
"created_at": 1789689600,
"finished_at": 1789689720,
"output": {
"video_url": "https://static.seedrouter.ai/media/tasks/task_example/0.mp4"
}
}在我們的測試中,8 秒的 720p 影片回傳為附 AAC 音軌的 MP4(H.264),16:9 的解析度為 1280 × 720,9:16 為 720 × 1280,1:1 為 720 × 720,從提交到完成耗時 111–133 秒。480p 影片耗時 45–84 秒。
錯誤
在任務建立之前就被拒絕的請求,會回傳 HTTP 錯誤狀態碼和一個 error 物件,且不計費。受理之後才失敗的任務,在查詢時回傳 HTTP 200,並帶有 status: "failed" 和一個 error 物件。
錯誤碼、HTTP 狀態碼和重試建議請參閱共用錯誤目錄。
{
"id": "task_...",
"model": "grok-imagine-video-1-5",
"status": "failed",
"error": {
"code": 60001,
"message": "The request was rejected by the content policy. Please revise the prompt or input images."
}
}如果提交本身逾時,請先檢查你的任務清單再重新提交:第一次請求有可能已經被受理。
實用建議
- 描述主體、地點、運鏡和光線,並寫明想要的聲音;聲音會與畫面一起生成。
- 先用
480p做草稿,再用同一個請求以720p算繪最終鏡頭。 - 要生成直式影片,請傳入
aspect_ratio: "9:16",或一張直式圖片。 - 加上
no text, no logos,避免出現憑空編造的標記。
