Skip to main content
POST
Submit a video generation task (text-to-video / image-to-video)
🔒 Requires the GrokOfficial group, granted on application: Grok Imagine Video is not in the Default group; access must be requested before you can call it (including the Playground on this page). Without access, or with a pay-per-request Token, every call returns 503. See Grok Imagine Video Overview - Group Setup.
The interactive Playground on the right lets you test the endpoint directly. Enter your API Key in Authorization (format: Bearer sk-xxx), pick the model, fill in prompt / seconds / size, and send; add input_reference for image-to-video. The Playground only performs step 1 (submit) — once you have the task id, poll and download as shown below.
⚠️ The three most common pitfalls
  1. Without size / seconds the default is 480p and 8 seconds, and that is what you are billed for.
  2. grok-imagine-video has no 1080p: 1920x1080 returns 400; use -1.5 or -1.5-lite for 1080p.
  3. Moderation blocks are billed: a blocked task still reports completed, but carries error.code: "moderation_blocked" and has no video.
Three-step async flow — this page covers step 1 (submit) only
  • Step 1 (this page): POST /v1/videos → returns the task id + status: "queued"
  • Step 2: poll GET /v1/videos/{id} until status is "completed" or "failed"
  • Step 3: download the MP4 from GET /v1/videos/{id}/content
Submitting returns within seconds and does not wait for the video to finish.

Code Examples

Python (text-to-video, all three steps)

Python (image-to-video, base64 input image)

cURL

Node.js (fetch)

Parameter Quick Reference

Price per second (same as xAI):
Model pricing is aligned with the official sites and may change when they do; the table above is for reference only, and the Model Pricing tab in the top navigation is authoritative: Model Pricing.

Response Examples

Submit (step 1):
Done (step 2 poll result):
Blocked by moderation: status is still completed, but there is an extra error field and no video to download:

Authorizations

Authorization
string
header
required

API Key from the APIYI console (Token group must include GrokOfficial)

Body

application/json
model
enum<string>
default:grok-imagine-video-1.5-lite
required

Model ID (billed per second × resolution rate):

  • grok-imagine-video — 480p $0.05/s, 720p $0.07/s, no 1080p
  • grok-imagine-video-1.5 — 480p $0.08, 720p $0.14, 1080p $0.25 per second
  • grok-imagine-video-1.5-lite — 480p $0.02, 720p $0.03, 1080p $0.14 per second
Available options:
grok-imagine-video,
grok-imagine-video-1.5,
grok-imagine-video-1.5-lite
prompt
string

Prompt: scene + subject + action + camera + lighting. Required for text-to-video; for image-to-video it describes motion and camera

Example:

"a red paper boat drifting on a calm lake, gentle ripples, soft morning light"

seconds
string

Duration from 1 to 15 seconds, as a string or a number; default 8. Out-of-range values return 400. Cost scales with seconds — use 1–2 seconds while testing.

Example:

"2"

size
enum<string>
default:854x480

Output size in WIDTHxHEIGHT pixels: the shorter side sets the resolution (≥1080 is 1080p, ≥720 is 720p, otherwise 480p) and the aspect ratio snaps to the nearest supported one. You can also pass 480p / 720p / 1080p directly. Without it, the default is 480p.

  • 854x480 — 480p landscape (measured 848×480)
  • 1280x720 / 720x1280 — 720p landscape / portrait
  • 1920x1080 / 1080x1920 — 1080p (1.5 / 1.5-lite only)
Available options:
854x480,
480x854,
1280x720,
720x1280,
1920x1080,
1080x1920
input_reference
string

Input image for image-to-video: a public image URL or a data:image/jpeg;base64,... data URI. Passing it makes the job image-to-video, and the output frame follows the input image. Each input image costs an extra $0.002 (grok-imagine-video) or $0.01 (1.5 / 1.5-lite).

Example:

"https://example.com/first-frame.jpg"

Response

Task submitted; returns the task id and queued status

id
string

Task ID for polling and download

Example:

"task_xxxxxxxxxxxxxxxx"

object
string

Always video

Example:

"video"

model
string
Example:

"grok-imagine-video-1.5-lite"

status
enum<string>

Task status:

  • queued — submitted, waiting
  • in_progress — generating
  • completed — done, download from /v1/videos/{id}/content; with error.code: moderation_blocked it was blocked and has no video
  • failed — failed
Available options:
queued,
in_progress,
completed,
failed
Example:

"queued"

progress
integer

Progress 0–100, coarse-grained; not suitable for a precise progress bar

Example:

0

seconds
string

Video duration, returned once done

created_at
integer

Task creation Unix timestamp (seconds)

completed_at
integer

Task completion Unix timestamp (seconds), returned once done