Grok Imagine
Grok Official Video Models
Generate videos from text or reference images with grok-imagine-video and grok-imagine-video-1.5, or edit a source video with the base model.
POST
This page covers the official models
grok-imagine-video and grok-imagine-video-1.5. They are separate from grok-imagine-1.5-video-ext on the existing generation page; do not mix their model names or parameters.Integration overview
All modes use the same asynchronous endpoint:
After submission, save
data[0].task_id, then poll:
Model capabilities
Request headers
string
required
Bearer <APIMART_API_KEY>string
required
Always use
application/json.string
application/jsonstring
Idempotency-Key is optional and strongly recommended for paid generation and editing. It accepts 1–191 visible ASCII characters; UUID is recommended. Reuse the original key and identical body for a network retry. Do not switch keys when the result is uncertain.Use a new key for each new logical operation. A retry of the same operation must reuse the original key and identical body.Request parameters
Common fields
string
required
Official model name; video editing supports the base model only
grok-imagine-videogrok-imagine-video-1.5
string
required
Non-empty instruction, at most 8000 Unicode characters
Array.from(prompt).lengthboolean
default:false
Whether to perform content moderation before submitting the video task.
true: Useomni-moderation-latestto review the prompt and input imagesfalseor omitted: Do not send a moderation request, adding no moderation cost or latency (default)
Generation fields
integer
default:8
Generation only; integer from 1 to 15, default 8
string
default:"480p"
Base:
480p/720p; 1.5: 480p/720p/1080p; default 480pgrok-imagine-video:480p,720pgrok-imagine-video-1.5:480p,720p,1080p
string
default:"auto"
Generation only;
auto, 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, or 2:3auto1:1,16:9,9:164:3,3:4,3:2,2:3
string[]
Optional reference-image array; every item must be a public HTTPS URL; omit instead of sending an empty array
- Every item must be a publicly accessible HTTPS URL; relative URLs, Data URLs, and raw Base64 are not supported.
- Do not send aliases such as
image,images, orinput_reference. - Array order is preserved; duplicate URLs occupy multiple input slots and may be billed more than once.
Video-edit fields
object
Source video object
{url}; public HTTPS URL; base model onlymodel, prompt, and video, and may optionally include nsfw_check. Do not send duration, resolution, aspect_ratio, or image_urls; the platform detects the source duration.
TypeScript request types
Use a discriminated union so generation-only fields cannot be sent to video editing.Request examples
- Text to video
- 1.5 · 1080p
- Single or multiple reference images
- Video editing
Asynchronous tasks
Create success
A successful create request returns HTTP200. Save data[0].task_id; submission does not mean the video is complete. A task ID means submitted, not completed.
Query a task
GET /v1/tasks/{task_id} every 3–5 seconds. Resume polling with the saved task ID after a page refresh.
Completed response
result.videos[0].url is an array of strings, not a single string. Validate every value as an HTTPS URL before display. Runtime validation is recommended:
expires_at as the source of truth for URL expiry. Do not hard-code a lifetime; prompt users to download or persist the result.
Failed response
Pricing catalog
GET /api/pricing/models/all and find the model by id in data.models.video. Prices are estimates; the authoritative final amount is data.cost from the task response.
Output-video pricing
- Pricing keys use uppercase
480P/720P/1080P, while request values use lowercase; normalize case when looking up prices. defaultis compatibility metadata, not a selectable resolution.- Use
after_discountdirectly; do not apply the discount again.
Input-material pricing
items, billing_mode, or max_billable_seconds. Model 1.5 has no video-input price because it cannot edit video.
Estimate formulas
data.cost.
Frontend rules
Model switching
- Base model shows only
480p/720p; 1.5 also shows1080p. - Switching from 1.5
1080pto base must fall back to480p. - Video-edit mode fixes the model to
grok-imagine-video.
Mode switching
nsfw_check is optional in every mode. Send true when moderation is enabled; omit it or send false when disabled.
Disable the run button when any of these conditions applies:
- Text mode omits
image_urlsandvideo. - Reference mode sends
image_urlsand omitsvideo. - Video-edit mode clears all generation-only fields.
- Disable submission for an empty or over-limit prompt, invalid duration, unsupported resolution, invalid material URL, active upload, or duplicate submission.
- Limit prompts to 8000 Unicode characters and duration to integers from 1 to 15.
- Use public HTTPS URLs only; omit empty
image_urls.
Common errors
Frontend checklist
- Keep the API key only in the backend or BFF.
- Do not mix official model names with
grok-imagine-1.5-video-ext. - Limit prompts to 8000 Unicode characters and duration to integers from 1 to 15.
- Use public HTTPS URLs only; omit empty
image_urls. - Send only
model/prompt/videoplus optionalnsfw_checkfor video editing, and use the base model. - Read
data[0].task_idon submit and determine the terminal state fromdata.status. - Read output from
result.videos[].url[]and respectexpires_at. - Use catalog prices for display and task
data.costfor the final amount.