Grok Imagine API
How to get a Grok Imagine API key and what a clip costs: the 6 and 10 second prices next to xAI’s per-second rate, the modes and aspect ratios it takes, and the call that makes one.
Grok Imagine API price per clip
| Clip | Here | Per second | xAI at $0.050 a second | Less |
|---|---|---|---|---|
| 6 seconds | $0.2093 | $0.0349 | $0.30 | 30% |
| 10 seconds | $0.2791 | $0.0279 | $0.50 | 44% |
USD per clip. Here: live from GET /v1/catalog/media, any aspect ratio and mode. xAI: its grok-imagine-video rate on docs.x.ai (Imagine Pricing), read 2026-10-19, times the clip length.
One price per clip length, set when the request is accepted. The aspect ratio, the mode and a reference image change nothing. xAI bills the same model by the second, so its price for a clip is $0.05 times the duration; a 6-second clip is $0.30 there and $0.2093 here. Prices on this page are read from the catalog when the page is built, at most five minutes old, and a top-up locks your rate for 30 days.
Grok Imagine API key: two ways to get one
The API runs on xAI's own cloud or through a provider that resells the model. Both bill per clip. The difference is which models the key reaches and how you pay.
From xAI
- Create an account at the xAI console and set up billing.
- Open API keys and create one.
- Start a clip with
POST /v1/videos/generationsonapi.x.ai, then readGET /v1/videos/{request_id}until its status isdone.
export XAI_API_KEY="xai-..."
# xAI's own base URL and video endpoint:
# POST https://api.x.ai/v1/videos/generations, then GET https://api.x.ai/v1/videos/{request_id}Endpoints from xAI's video generation guide, read 2026-10-19; its prices are on the models page.
One key for Grok Imagine and every other model
- Sign in to the console and add credit, from $10. There is no subscription.
- Create a key. It calls
grok-imagine-video, every other video, image, speech and 3D model, and every chat model. - Send the model and its settings to
POST /v1/generationson our base URL, below.
export UPLINK_API_KEY="sk-uplink-live-..."
# one base URL for Grok Imagine and every other model:
# https://api.uplinkswitch.com/v1Which Grok Imagine model this key serves
xAI sells six Imagine models by API. This key serves one of them, Grok Imagine Video, the video model in the table above. The rest are listed so you know what you are and are not getting.
| xAI model id | xAI price | On this key |
|---|---|---|
grok-imagine-video | $0.050 per second | yes, $0.2093 per 6 s |
grok-imagine-video-1.5 | $0.080 per second | no |
grok-imagine-video-1.5-lite | $0.020 per second | no |
grok-imagine-image | $0.02 per image | no |
grok-imagine-image-2.0 | $0.04 per image | no |
grok-imagine-image-quality | $0.05 per image | no |
xAI's own prices from docs.x.ai (Imagine Pricing), read 2026-10-19. The right column is the catalog today; new models show up at GET /v1/catalog/media before they show up here.
For still images on this key, the Nano Banana and Seedream guides have the per-image prices, and the text-to-image list has every model.
Make a Grok Imagine clip
Send the model and its input to POST /v1/generations. The answer comes back at once, 202, with the generation id and the price. duration is required; everything else has a default.
curl https://api.uplinkswitch.com/v1/generations \
-H "Authorization: Bearer $UPLINK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video",
"input": {
"prompt": "A red kite turning slowly over a wheat field at golden hour, camera tracking from below",
"duration": 6,
"aspect_ratio": "16:9",
"mode": "normal"
}
}'
# 202 with the generation id and the price already set:
# {"id": "gen_...", "status": "queued", "model": "grok-imagine-video", "charge": {"amount_usd": "...", "units": 1, "unit": "generation"}}Poll the generation until its status is succeeded or failed; it passes through running and finalizing on the way, usually within a few minutes. A finished one lists its file URL in outputs.
curl https://api.uplinkswitch.com/v1/generations/gen_... \
-H "Authorization: Bearer $UPLINK_API_KEY"
# "status" moves queued -> running -> finalizing -> succeeded (or failed, which is refunded);
# a finished clip is the first entry in "outputs":
# {"id": "gen_...", "status": "succeeded", "outputs": [{"url": "https://api.uplinkswitch.com/v1/files/media/...", "content_type": "video/mp4", "bytes": 1234567}]}Grok Imagine API in Python
The generations endpoint is plain JSON over HTTPS, so requests is all you need. Start the clip, sleep, read it back until it is done.
import os, time, requests
BASE = "https://api.uplinkswitch.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['UPLINK_API_KEY']}"}
gen = requests.post(
f"{BASE}/generations",
headers=HEADERS,
json={
"model": "grok-imagine-video",
"input": {
"prompt": "A paper lantern rising past a pagoda roof at night, soft rain",
"duration": 10,
"aspect_ratio": "9:16",
"mode": "fun",
},
},
).json()
print("charged", gen["charge"]["amount_usd"])
while gen["status"] not in ("succeeded", "failed"):
time.sleep(5)
gen = requests.get(f"{BASE}/generations/{gen['id']}", headers=HEADERS).json()
if gen["status"] == "succeeded":
print(gen["outputs"][0]["url"]) # the clip, served from https://api.uplinkswitch.com/v1 for 30 days
else:
print("failed and refunded:", gen)The same two calls work from any language: one POST, then GETs five seconds apart. The media guide has the endpoint in full, including the hourly sweep that finishes clips nobody polls.
Settings: duration, aspect ratio, mode
| Setting | Values | Notes |
|---|---|---|
duration | 6 or 10 | Seconds. Required; it sets the price. |
aspect_ratio | 1:1, 2:3, 3:2, 16:9, 9:16 | 16:9 for landscape, 9:16 for shorts and reels, 2:3 and 3:2 for portrait and photo frames. |
mode | fun, normal, spicy | One per request. Same price in every mode. |
image_urls | up to 1 image | A still to animate. Public JPEG or PNG URL. |
prompt | text | Required. Describe the subject, the motion and the camera. |
Read from GET /v1/catalog/media when the page was built. An unknown setting or value is refused before anything runs, and nothing is charged.
There is no resolution setting on this model: the catalog lists none, and the price does not change with the frame size.
Animate a still image
Put the image in image_urls and write the prompt as the motion you want. The frame sets the subject; the prompt sets what happens to it. The price is the clip price, nothing extra for the image.
curl https://api.uplinkswitch.com/v1/generations \
-H "Authorization: Bearer $UPLINK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video",
"input": {
"prompt": "The model turns toward the camera and smiles; wind in the hair",
"image_urls": ["https://example.com/portrait.jpg"],
"duration": 6,
"aspect_ratio": "2:3"
}
}'A product shot, a portrait or a frame made by an image model on the same key all work. Make the still with Nano Banana or Seedream in one call, pass its URL here in the next, and the whole pair is billed on one statement.
What Grok Imagine clips cost at volume
| Clip | 10 clips | 100 clips | 1,000 clips |
|---|---|---|---|
| 6 seconds | $2.09 | $20.93 | $209.30 |
| 10 seconds | $2.79 | $27.91 | $279.10 |
USD, our live price per clip times the count. Each request makes one clip.
A $10 top-up is 47 6-second clips or 35 10-second ones. The 10-second clip is the better buy per second: $0.0279 against $0.0349.
Grok Imagine next to other video models
The same key calls every video model below. Each is shown as one short clip at its lowest resolution without sound, so the per-second column compares like with like; longer clips, 1080p, 4k and audio are on the model pages.
| Model | Clip | Per clip | Per second |
|---|---|---|---|
| Seedance 1.5 Pro | 8 s, 720p, no audio | $0.20 | $0.025 |
| Grok Imagine Video | 10 s, any aspect ratio | $0.2791 | $0.0279 |
| Veo 3.1 Lite | 8 s, 720p | $0.24 | $0.03 |
| Grok Imagine Video | 6 s, any aspect ratio | $0.2093 | $0.0349 |
| Hailuo 2.3 | 6 s, 768p | $0.2188 | $0.0365 |
| Kling 2.1 Standard | 5 s | $0.1875 | $0.0375 |
| Kling 2.5 Turbo Pro | 5 s | $0.2625 | $0.0525 |
| Veo 3.1 Fast | 8 s, 720p | $0.48 | $0.06 |
| Seedance 1.0 Pro | 5 s, 720p | $0.315 | $0.063 |
USD, live from GET /v1/catalog/media, sorted by our price per second.
Veo 3.1 clips carry sound and 8 seconds at 720p; the Veo 3.1 guide has Google's price next to ours. The text-to-video list has every video model and setting.
Timing and errors
POST /v1/generationsanswers at once with the price set. A clip is usually ready within a few minutes; poll every five seconds or so.- A request without
duration, or with a value other than 6 or 10, is refused with a 400 before anything runs. So is an unknown mode or aspect ratio. - 401 is a missing or revoked key. 402 is an empty balance or a key at its monthly spend limit, so top up or raise the limit in the console. 429 is the key's rate limit, or a busy model; the response says which, and a busy model is worth a retry in a minute.
- A clip that fails is refunded in full, and one still unfinished after 6 hours is marked failed and refunded.
- The file is an .mp4 on
api.uplinkswitch.com, kept 30 days. Download what you want to keep.
Keep the key safe
Anyone holding the key spends your credit. Keep it in an environment variable or a secrets manager, out of git and out of code that runs in a browser: start the clip from your server and hand the finished URL to the page. A key can carry a monthly spend limit and a list of the models it may call, set in the console. If it leaks, revoke it there and create a new one.
Billing, receipts and the daily check
The price is charged when the request is accepted and refunded in full if the clip fails. Every charge sits on a signed receipt and a monthly statement you can check at /statements/verify. Whether the model answered today is public at /proof, which calls every model on the list once a day. Every setting and both prices are on the model page and at GET /v1/catalog/media, and the Grok API pricing page covers xAI's chat models on the same key.
Questions
- How much does the Grok Imagine API cost?
- Here a Grok Imagine Video clip is $0.2093 for 6 seconds and $0.2791 for 10 seconds, any aspect ratio and mode, from prepaid credit. xAI's own API bills grok-imagine-video at $0.050 a second ($0.30 for 6 seconds, $0.50 for 10) and its newer Video 1.5 at $0.080 a second, per docs.x.ai on 2026-10-19.
- Is Grok Imagine no longer free?
- The Grok Imagine API was never free: xAI bills every second of video and every image. Any free use is inside xAI’s own Grok app, on its terms, which are xAI’s to change. Through an API you pay per clip, here from prepaid credit with no subscription.
- Can I use Grok Imagine for free?
- Not through this key: every clip bills at the price above, and a clip that fails is refunded. The console takes credit from $10, with no monthly fee, and one $10 top-up is 47 6-second clips.
- How do I get a Grok Imagine API key?
- Either from xAI, in the xAI console under API keys, which calls xAI’s endpoints only; or here, by adding credit in the console and creating a key, which calls Grok Imagine Video and every other model on the list. The steps for both are in the first section.
- How long can a Grok Imagine video be?
- 6 or 10 seconds here: the duration setting takes those two values and nothing else. xAI's video guide says its own API makes clips of up to 15 seconds (docs.x.ai, read 2026-10-19).
- What are fun, normal and spicy in the Grok Imagine API?
- The three values of the mode setting (fun, normal, spicy). Pick one per request; the price is the same for all three. Leave it out and the model runs in its default mode.
- Can I use the Grok Imagine API in Python?
- Yes. There is no SDK to install: two calls with requests, one POST to start the clip and GETs until its status is succeeded or failed. The script on this page does it in twenty lines.
- Does the key also call Grok Imagine Image or Video 1.5?
- Not today. This key serves grok-imagine-video, the model in the table. xAI's lineup also lists Image, Image 2.0, Image Quality, Video 1.5 and Video 1.5 Lite (docs.x.ai, read 2026-10-19); for those, call xAI directly or pick another image model on this key, such as Nano Banana or Seedream.
- Where is the Grok Imagine API documentation?
- xAI's is at docs.x.ai (models and the video generation guide). For this key, the model page lists every setting and price, GET /v1/catalog/media returns the same as JSON, and the media guide covers the generations endpoint.
- What if a clip fails?
- It is refunded in full, automatically, and one still unfinished after 6 hours is marked failed and refunded. Finished clips stay downloadable for 30 days.