一览
Grok Video API 通过 Mage 运行 Grok Video,接口为 POST https://api.mage.space/v1/grok_video/generate。默认设置下,一次请求消耗 375 Gems(约 $0.375),无需订阅。在提示词中通过 @handle 即可调用 Grok Video 已保存的角色和参考。
视频
输出
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 链接、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 的端点是什么?
向 https://api.mage.space/v1/grok_video/generate 发送 POST 请求,并在 Authorization: Bearer 请求头中带上你的 Mage API 密钥。返回结果中包含 status_url,可用来轮询生成结果。
可以调用哪些 Grok Video 模型?
grok-imagine-video(Grok Video)。默认模型为 Grok Video。
Grok Video 支持参考图片或角色吗?
Grok Video 支持 image、additional_images、video。在提示词中通过 @handle 即可使用已保存的角色和参考。
可以在 Claude 或 ChatGPT 中使用 Grok Video 吗?
可以。将 Mage MCP 服务器连接到 Claude、ChatGPT、Claude Code、Grok 或 Cursor,然后直接说出 Grok Video 的名称即可。你的助手会通过 get_model 读取可用选项,并在生成前告知价格。
Grok Video 的生成结果会保留多久?
结果和输入内容会保存 30 天。想长期保留的内容,请下载到你自己的存储空间。
用 Mage 开始开发
一个账号,一份 Gems 余额,畅用所有模型。按生成量付费,用多少付多少。