重點速覽
Grok Video API 透過 Mage 執行 Grok Video,端點為 POST https://api.mage.space/v1/grok_video/generate。使用預設設定的一次請求費用為 375 Gems(約 $0.375),無需訂閱。Grok Video 支援在提示詞中用 @handle 呼叫已儲存的角色與參考圖片。
影片
輸出
1
版本
375
預設每段影片所需 Gems
$0.375
約合美元
總覽
Grok Video API 的功能
使用 xAI 的 Grok Imagine 生成影片,可透過文字、最多 5 張參考圖片或一段簡短的來源影片來生成。長度 1 至 15 秒,解析度最高 720p。適用 xAI 的安全過濾機制。
使用 xAI 的 Grok Imagine 生成影片,可透過文字、參考圖片或要編輯的來源影片來生成。適用 xAI 的安全過濾機制。
支援 image、additional_images、video 作為輸入。
快速開始
呼叫 Grok Video API
設定 MAGE_API_KEY,將請求送到 /grok_video/generate,然後輪詢 status_url,直到請求完成。
cURL
STATUS_URL=$(curl --request POST 'https://api.mage.space/v1/grok_video/generate' \
--header "Authorization: Bearer $MAGE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"prompt": "A slow push-in on a lighthouse at dusk, waves breaking below",
"aspect_ratio": "16:9",
"duration": "5",
"model_id": "grok-imagine-video"
}' | jq -r '.status_url')
# Repeat until status is "completed"; result.url is the file
curl "$STATUS_URL" --header "Authorization: Bearer $MAGE_API_KEY"TypeScript
// npm install @mage-space/sdk
import Mage from '@mage-space/sdk';
const mage = new Mage(); // reads MAGE_API_KEY
const request = await mage.run('grok_video', {
prompt: 'A slow push-in on a lighthouse at dusk, waves breaking below',
aspect_ratio: '16:9',
duration: '5',
model_id: 'grok-imagine-video',
});
console.log(request.result.url);Python
# pip install mage-space
from mage_space import Mage
mage = Mage() # reads MAGE_API_KEY
request = mage.run("grok_video", {
"prompt": "A slow push-in on a lighthouse at dusk, waves breaking below",
"aspect_ratio": "16:9",
"duration": "5",
"model_id": "grok-imagine-video",
})
print(request["result"]["url"])模型
Grok Video 的 model_id 值
傳入 model_id 即可選擇版本。未指定時,請求會使用預設版本。
| model_id | 名稱 | 預設 |
|---|---|---|
| grok-imagine-video | Grok Video | 是 |
選項
Grok Video 參數
以下為所有版本可接受的值;個別版本可能提供較少選項。各版本的選項請參閱文件。
| 欄位 | 可用值 |
|---|---|
| aspect_ratio | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 |
| resolution | 480p, 720p |
| duration | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 |
輸入
Grok Video 支援的媒體輸入
每個輸入可使用 https URL、data URL,或上傳最大 100 MB 的檔案。
| 欄位 | 用途 |
|---|---|
| image | 參考圖片。 |
| additional_images | 其他參考圖片。 |
| video | 來源影片。 |
規則
Grok Video API 的限制
- 來源影片最長 8.7 秒,且不能與參考圖片合併使用。
- 最多 5 張參考圖片,此時影片長度上限為 10 秒。
更多影片模型
Mage 上的其他影片生成 API
常見問題
常見問題
Grok Video API 的費用是多少?
以預設設定(Grok Video)發送一次 Grok Video 請求,費用為 375 Gems,約 $0.375。其他解析度、長度和版本會影響價格,實際扣款金額會顯示在回應中。生成失敗會退還 Gems;若因違反 Mage 的內容政策而被封鎖,則不予退還。
Grok Video API 的端點是什麼?
使用 POST https://api.mage.space/v1/grok_video/generate,並在 Authorization: Bearer 標頭中帶入你的 Mage API 金鑰。回應中會包含 status_url,可用來輪詢取得結果。
我可以呼叫哪些 Grok Video 模型?
grok-imagine-video(Grok Video)。預設為 Grok Video。
Grok Video 支援參考圖片或角色嗎?
Grok Video 接受 image、additional_images、video。Grok Video 可在提示詞中以 @handle 使用已儲存的角色和參考素材。
我可以在 Claude 或 ChatGPT 中使用 Grok Video 嗎?
可以。將 Mage MCP 伺服器連接到 Claude、ChatGPT、Claude Code、Grok 或 Cursor,然後直接指定要使用 Grok Video。你的助理會透過 get_model 讀取可用選項,並在生成前告知價格。
Grok Video 的生成結果會保留多久?
結果與輸入內容會保存 30 天。想留存的內容,請自行下載到你的儲存空間。
開始使用 Mage 打造你的作品
一個帳號、一份 Gems 餘額,通用所有模型。只需為你生成的內容付費。