grok-imagine-1.0-video
Grok Imagine 1.0 Video — async video generation with one endpoint that auto-routes text-to-video and image-to-video by `image_urls` count. 6 to 30 second outputs at 480p / 720p, five aspect ratios.
Grok Imagine 1.0 Video — async video generation. One model id
(grok-imagine-1.0-video) covers both text-to-video and
image-to-video. Mode is implicit: zero image_urls runs T2V; 1 to 7
reference images run I2V. 6 to 30 second outputs at 480p / 720p, five
aspect ratios. See current pricing on the
model page.
Quick example
curl https://reapi.ai/api/v1/videos/generations \
-H "Authorization: Bearer rk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-1.0-video",
"prompt": "A dog running on a sunlit beach, slow-motion",
"size": "16:9",
"duration": 6,
"quality": "720p"
}'import requests
resp = requests.post(
"https://reapi.ai/api/v1/videos/generations",
headers={
"Authorization": "Bearer rk_live_xxx",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-1.0-video",
"prompt": "A dog running on a sunlit beach, slow-motion",
"size": "16:9",
"duration": 6,
"quality": "720p",
},
timeout=30,
)
print(resp.json())const r = await fetch("https://reapi.ai/api/v1/videos/generations", {
method: "POST",
headers: {
Authorization: "Bearer rk_live_xxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "grok-imagine-1.0-video",
prompt: "A dog running on a sunlit beach, slow-motion",
size: "16:9",
duration: 6,
quality: "720p",
}),
});
console.log(await r.json());package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]any{
"model": "grok-imagine-1.0-video",
"prompt": "A dog running on a sunlit beach, slow-motion",
"size": "16:9",
"duration": 6,
"quality": "720p",
})
req, _ := http.NewRequest("POST",
"https://reapi.ai/api/v1/videos/generations", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer rk_live_xxx")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}Submit response
{
"id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e",
"model": "grok-imagine-1.0-video",
"status": "processing",
"created_at": 1735000000
}Poll GET /api/v1/tasks/{id} (see the Tasks reference) until
status === "completed". The completed payload's output.video_urls
holds the generated MP4 URL, valid for 7 days.
Authentication
Every call needs a Bearer token. Generate keys at reapi.ai/settings/apikeys.
Authorization: Bearer YOUR_API_KEYKeys carry the active workspace's billing scope — there is no separate project header.
Endpoint
POST /api/v1/videos/generations
GET /api/v1/tasks/{id}Submission is async. The POST returns immediately with a task_id; the
task endpoint returns the same envelope until completion. Polling does
not consume credits.
Mode routing
grok-imagine-1.0-video picks its mode from the count of image_urls
you send — there is no mode parameter:
image_urls count | Mode | What it does |
|---|---|---|
0 (or omitted) | T2V | Generate from text. size controls output ratio. |
1 – 7 | I2V | Use the references as visual guidance. Output ratio follows ref. |
Mutex rules.
- In T2V (no
image_urls),promptis required. - When
image_urlsis set (1 to 7 entries),sizeis forwarded but ignored upstream — the source frame's ratio decides the output ratio. - More than 7
image_urlsis rejected with400 image_urls accepts at most 7 entries.
Request body
model — required
string. Must be "grok-imagine-1.0-video".
prompt — string, conditional
Up to 4,000 characters. Required in T2V (when image_urls is empty);
optional in I2V when at least one image is provided.
Empty / whitespace-only prompts are treated as missing.
Failure modes.
- Empty / missing in T2V →
400 prompt is required when image_urls is empty (text-to-video)(code20002). - Longer than 4,000 chars →
400 prompt exceeds 4000 characters (got N)(code20007).
size — string, default "16:9"
Output aspect ratio in T2V mode. One of:
| Value | Shape |
|---|---|
16:9 | Landscape (default) |
9:16 | Portrait |
1:1 | Square |
3:2 | Landscape |
2:3 | Portrait |
In I2V mode the upstream derives the ratio from the reference image, so this field is ignored.
duration — integer, default 6
Output length in seconds. Any integer in [6, 30]. Out-of-range →
400. Drives pricing linearly: ceil(per_second_usd × duration × 1000)
credits (1 credit = $0.001).
Send a number, not a string. "duration": "6" is rejected with 400.
quality — string, default "480p"
480p (SD) or 720p (HD). Lowercase is canonical. Quality does not
change the per-second rate.
image_urls — string[]
Array of public HTTP(S) URLs. 0 to 7 entries:
- 0 entries — pure text-to-video.
- 1 to 7 entries — image-to-video; references guide subject and style.
No data: URIs. reAPI rejects base64 inputs platform-wide — every
URL field on this endpoint must be a public HTTP(S) URL. Upload to
your own object storage (S3, R2, OSS, …) and pass the URL.
Response envelope
Submit and poll share the same shape — only status and output fill in
over time.
{
"id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e",
"model": "grok-imagine-1.0-video",
"status": "completed",
"created_at": 1735000000,
"output": {
"video_urls": ["https://cdn.reapi.ai/media/tasks/018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e/0.mp4"]
},
"error": null
}| Field | Type | Notes |
|---|---|---|
id | string | Task identifier — keep it for polling and audit |
model | string | Echo of the submitted model |
status | string | processing / completed / failed |
created_at | integer | Submission unix timestamp |
output | object | null | null until completion. output.video_urls holds MP4s |
error | object | null | Populated on failed — { code, message } |
output.video_urls URLs are valid for 7 days. Re-host to your own
storage if you need them longer.
Validation errors
All cases below return HTTP 400 with code 20003 unless noted. Pattern-match
on code, not message — message strings carry request-specific context
(field names, observed values, etc.) and are not a stable contract.
| Trigger | Code | Message (illustrative) |
|---|---|---|
prompt missing in T2V | 20002 | grok-imagine: prompt is required when image_urls is empty (text-to-video) |
prompt longer than 4,000 chars | 20007 | grok-imagine: prompt exceeds 4000 characters (got N) |
image_urls length > 7 | 20003 | grok-imagine: image_urls accepts at most 7 entries, got N |
duration outside [6, 30] | 20003 | grok-imagine: duration must be 6-30 seconds, got N |
Unknown size | 20003 | grok-imagine: invalid size "X" (allowed: 16:9 / 9:16 / 1:1 / 3:2 / 2:3) |
Unknown quality | 20003 | grok-imagine: invalid quality "X" (allowed: 480p / 720p) |
image_urls carrying a data: URI or non-http(s) | 20003 | grok-imagine: image_urls entries must be public http(s) URLs |
The full envelope is { "error": { "code", "message", "request_id" } } —
see Errors catalog for the wire format and request_id
correlation tips.
Recipes
T2V — minimum request
{
"model": "grok-imagine-1.0-video",
"prompt": "A little girl walking down a sunset coastal road"
}T2V — full parameters
{
"model": "grok-imagine-1.0-video",
"prompt": "A dog running on a sunlit beach, slow-motion, cinematic warm tones",
"size": "16:9",
"duration": 10,
"quality": "720p"
}I2V — animate from references
{
"model": "grok-imagine-1.0-video",
"prompt": "Bring the scene to life with a gentle camera dolly forward",
"image_urls": ["https://your-cdn.com/reference.jpg"],
"duration": 8,
"quality": "720p"
}I2V — multi-reference
{
"model": "grok-imagine-1.0-video",
"prompt": "Smooth cinematic motion across the reference subjects",
"image_urls": [
"https://your-cdn.com/ref-1.jpg",
"https://your-cdn.com/ref-2.jpg",
"https://your-cdn.com/ref-3.jpg"
],
"duration": 12
}Polling pattern
The task endpoint behaves identically to other video tasks — the only
difference is the completed output shape (video_urls instead of
image_urls). A pragmatic schedule:
0–5 minutes: poll every 5s
5 min – 1 h: back off gradually toward 1 min
≥ 1 h: cap at 3 min between pollsA typical task completes in a few minutes. The worker's wall-clock cap is 48 hours, comfortably above any realistic queue.
Pricing
Per-second rate. quality does not change the price, and the rate is
flat across 480p and 720p. See current rate on the
Grok Imagine model page.
Bill formula (1 credit = $0.001):
credits = ceil(per_second_usd × duration × 1000)Failed jobs refund automatically.
Tips
- Prompt motion, not just scene. "Slow push-in, warm tones, shallow depth of field" outperforms a pure noun-list of what's on screen.
- Sweet-spot duration: 6–10 seconds. Above 10s the upstream wall-time grows fast; the per-second price stays the same either way.
- Reference-image quality matters. Subject centered, clear composition, no heavy filters — I2V output quality tracks input quality directly.
- Send up to 7 references for richer guidance. A first frame plus several style boards usually outperforms a single reference.