Mage API · Video model
Grok Video API
Grok Imagine, in motion
POST https://api.mage.space/v1/grok_video/generateAt a glance
The Grok Video API runs Grok Video through Mage at POST https://api.mage.space/v1/grok_video/generate. A request at the default settings costs 375 Gems (about $0.375), with no subscription. Grok Video takes saved characters, references by @handle in the prompt.
- VideoOutput
- 1Variant
- 375Gems per clip, default
- $0.375About, in USD
Overview
What the Grok Video API does
xAI's Grok Imagine for video, from text, up to 5 references, or a short source clip. 1 to 15 seconds at up to 720p. xAI's safety filter applies.
xAI's Grok Imagine for video, from text, reference images, or a source video to edit. xAI's safety filter applies.
It accepts image, additional_images, video as inputs.
Quick start
Call the Grok Video API
Set MAGE_API_KEY, submit to /grok_video/generate, and poll status_url until the request completes.
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"])Models
Grok Video model_id values
Send model_id to pick a variant. A request without one runs the default.
| model_id | Name | Default |
|---|---|---|
| grok-imagine-video | Grok Video | Yes |
Options
Grok Video parameters
Allowed values across all variants; a variant may offer fewer. The docs list the options per variant.
| Field | Values |
|---|---|
| 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 |
Inputs
Media inputs Grok Video accepts
Send each as an https URL, a data URL, or an upload of up to 100 MB.
| Field | Role |
|---|---|
| image | The reference image. |
| additional_images | Additional reference images. |
| video | The source video. |
Rules
What the Grok Video API enforces
- A source video must be at most 8.7 seconds and cannot be combined with reference images.
- Up to 5 reference images, which cap the clip at 10 seconds.
More video models
Other video generation APIs on Mage
Kiwi API
Everyday video, zero setup
Lemon API
Every video feature, at a friendlier price
LTX Video API
Fast open-weights video for iteration
Magejutsu API
Recast any video, keeping its motion
Melon API
Anime in motion, with optional audio
MiniMax-H3 API
Fast open video with stereo sound
FAQ
Frequently asked questions
How much does the Grok Video API cost?
What is the Grok Video API endpoint?
Which Grok Video models can I call?
Does Grok Video support reference images or characters?
Can I use Grok Video from Claude or ChatGPT?
How long are Grok Video results kept?
Start building with Mage
One account, one Gems balance, every model. Pay only for what you generate.