Grok Imagine API: Quick Clips From a Prompt or Image
The Grok Imagine API on one key: quick clips from a prompt or a start image, the lengths and sizes it takes, code in curl, Python and Node, and the cost.
Updated 4 min read
Grok Imagine is a video model by xAI that makes quick clips from a prompt or a start image. On Frameport the Grok Imagine API makes clips of 1 to 15 seconds, with a choice of 480p, 720p and 1080p, from $0.093 per second, and a clip that fails costs nothing.
The same API key calls Grok Imagine 2.0, its image sibling, and every other model of the catalog. This page covers both: a first clip in curl, Python and Node, a clip from a still, short drafts, images, and what each costs.
Grok Imagine at a glance: video and image
| Grok Imagine | Grok Imagine 2.0 | |
|---|---|---|
| Kind | video model | image model |
| What it does | Text to video and Image to video | Text to image |
| Lengths | 1 to 15 seconds | One image each, up to 4 per request |
| Resolutions | 480p, 720p and 1080p | — |
| Aspect ratios | 16:9, 9:16, 1:1, 4:3 and 3:4 | 1:1, 3:4, 4:3, 9:16 and 16:9 |
| Price | From $0.093 per second | $0.088 per image |
| Endpoint | POST /v1/videos/generations | POST /v1/images/generations |
The video model takes a prompt, or a prompt and one picture as the first frame. It takes no last frame, no reference pictures and no seed, and the catalog does not say whether its clips carry sound. A request it cannot take is refused with 400 invalid_request before anything is held, and the message says why.
Your first Grok Imagine API clip
A clip takes longer than one HTTP request can wait, so you submit it, keep its id, and read it until it is done. This request asks for 6 seconds at 720p:
# 1. Submit
curl https://frameport.ai/v1/videos/generations \
-H "Authorization: Bearer $FRAMEPORT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine",
"prompt": "A hot air balloon lifts off at sunrise over a misty valley, wide shot",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9"
}'
# 2. Poll with the id it returned until "status" is "succeeded"
curl https://frameport.ai/v1/videos/generations/$GENERATION_ID \
-H "Authorization: Bearer $FRAMEPORT_API_KEY"{
"id": "gen_9sLq2VbX7mN4kR1tYc8WpE",
"object": "generation",
"type": "video",
"model": "grok-imagine",
"status": "queued",
"input": {
"prompt": "A hot air balloon lifts off at sunrise over a misty valley, wide shot",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9",
"audio": true,
"reference_images": 0,
"end_image": false
},
"reserved_usd": 0.99,
"cost_usd": null,
"outputs": [{ "id": "file_2Tn7XcQ9vLm4Ra8Ws1KbZd", "status": "queued" }],
"error": null,
"created_at": "2026-11-28T10:00:00.000Z",
"completed_at": null
}Without resolution the clip is 720p, and without duration it is 5 seconds. To skip polling, add a webhook and get the finished generation posted to your server.
From a start image
Send one picture in reference_images and the clip opens on it. The prompt then says only what happens next: the picture already sets the subject, the set and the light.
{
"model": "grok-imagine",
"prompt": "The cat on the windowsill stretches, yawns and turns to watch a bird fly past",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "9:16",
"reference_images": ["upl_7Rk2PqV9wXm4Tn8Lc1BdZe"]
}The picture can be an https URL, a base64 data URI, an upload (upl_…) or one of your image outputs (file_…), so an image made on Grok Imagine 2.0 can become the first frame without a download. One picture only: a second one is refused. Set aspect_ratio to the picture's shape. Each picture adds a fixed fee to the clip, listed on the model page and in the breakdown of a quote. The image to video API guide compares the models that take a first frame, a last frame or reference pictures.
Short lengths for fast drafts
Clips start at 1 second and go up in whole seconds, so a draft costs only the seconds it needs. A few habits that suit the model:
- Short clip, short prompt: one subject, one action, one camera note. "A paper boat drifts down a rain gutter, low angle" is enough for 3 seconds.
- Draft low, finish high: try the idea at 480p, then render the take you keep at 1080p.
- No seed: the same prompt gives a new take each time, so send a few and keep the one you like.
- Made for short forms: reactions, loops and social cuts, in 16:9, 9:16, 1:1, 4:3 and 3:4.
When a clip must land on a set last frame, keep the same character from pictures, or take a seed, pick a model that lists those options, such as Seedance 2.5.
Grok Imagine 2.0 for images
Grok Imagine 2.0 is xAI's fast, characterful image model: renders with a distinct look, made for exploring ideas in volume, concepts and thumbnails before a final render, and stylized pictures rather than clinical photorealism. Short, punchy prompts work: describe the idea, name a style if you want one, and run several takes.
{
"model": "grok-imagine-2-0",
"prompt": "A tiny bakery on a hillside street, isometric illustration, warm window light, early evening",
"n": 4,
"aspect_ratio": "1:1"
}Each image costs $0.088, so this batch of four costs $0.352; each image is charged only if it succeeds.
Short clips or a long take? Grok Imagine vs Seedance 2.5 weighs the two.
What Grok Imagine costs and how to check
A clip costs its seconds times the rate at its resolution:
| Resolution | Per second | 3 s clip | 6 s clip | 15 s clip |
|---|---|---|---|---|
| 480p | $0.093 | $0.279 | $0.558 | $1.395 |
| 720p | $0.165 | $0.495 | $0.99 | $2.475 |
| 1080p | $0.29 | $0.87 | $1.74 | $4.35 |
A start image adds its fee on top. When you submit, the price is held from your balance; it is charged only when the clip succeeds, and a failed clip gives the hold back with cost_usd: 0. To price an exact body first, send it to POST /v1/generations/quote: nothing is held or started.
{
"object": "quote",
"model": "grok-imagine",
"type": "video",
"mode": "generate",
"price_usd": 0.99,
"reserved_usd": 0.99,
"breakdown": "6 s at 720p × $0.165/s",
"available_usd": 42.5,
"enough_balance": true
}Both models keep xAI's own content policy: a prompt they refuse answers 400 content_policy, a job refused after it started fails, and neither costs anything.
Every rate, video and image, is in Grok Imagine API pricing.
FAQ
How do I get a Grok Imagine API key?
Use a Frameport key: create an account, add funds under Billing, then create a key under API keys. It starts with fp_live_, is shown once, and calls Grok Imagine, Grok Imagine 2.0 and every other model of the catalog. No second account is needed.
Is there a free tier or a free trial?
The account, the key and quotes are free, and a clip that fails costs nothing. Clips are paid from a prepaid balance, topped up from $10, with no subscription. You can also try Grok Imagine online before writing code.
How much does the Grok Imagine API cost?
$0.093 per second at 480p, $0.165 at 720p and $0.29 at 1080p, so a 6-second clip at 720p costs $0.99. A start image adds a fixed fee, and images on Grok Imagine 2.0 cost $0.088 each.
Can Grok Imagine use a last frame or reference pictures?
Not in this catalog: it takes a prompt and, optionally, one start image. For a last frame or reference pictures, use a model that lists them, such as Veo 3.1 or Seedance 2.0, on the same key.
Where is the Grok Imagine API documentation?
The videos reference documents the endpoint and its fields, the model page lists the options and prices, and GET /v1/models returns the live values for your code: options.durations, options.resolutions, options.aspect_ratios, pricing.per_second and pricing.per_frame_image.