generate_video
Create or edit videos from text descriptions, starting images, or existing clips. Customize duration, aspect ratio, and resolution.
Instructions
Generate or edit videos with Grok Imagine.
Args:
prompt: Video description, or the edit instruction for video editing.
model: Video model (default grok-imagine-video).
image_path: Local image to use as the starting frame.
image_url: Public image URL to use as the starting frame.
video_path: Local video to edit (max 20 MB, .mp4, ≤ 8.7s).
video_url: Public video URL to edit (.mp4, ≤ 8.7s).
reference_image_paths: Local images used as style/subject references.
reference_image_urls: Public image URLs used as style/subject references.
duration: Video length in seconds (1–15, ignored when editing).
aspect_ratio: Aspect ratio like "16:9" or "9:16".
resolution: "480p" or "720p".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | grok-imagine-video | |
| prompt | Yes | ||
| duration | No | ||
| image_url | No | ||
| video_url | No | ||
| image_path | No | ||
| resolution | No | ||
| video_path | No | ||
| aspect_ratio | No | ||
| reference_image_urls | No | ||
| reference_image_paths | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Human-formatted output (includes footers, citations, cost summary). | |
| model | Yes | Actual executing model ID (e.g. 'grok-4.5'). | |
| plane | No | API | |
| route | Yes | High-level route (fast/agentic/research/etc.). | |
| images | No | Grok Imagine image URLs. | |
| tokens | No | Total tokens consumed. | |
| profile | No | Internal routing profile. | |
| summary | No | Legacy/duplicate formatted summary of the media generation. | |
| cost_usd | No | Exact USD cost from xAI billing metadata. | |
| response | Yes | Raw model output or primary content. | |
| citations | No | Native xAI/X citations with URL + snippet. | |
| video_url | No | ||
| latency_sec | No | ||
| duration_sec | No | ||
| finish_reason | No | unknown | |
| imagine_params | No | Original prompt + seed for reproducibility. | |
| reasoning_effort | No | Grok 4.5+ native reasoning level. |