Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generate, edit, and extend videos with xAI's grok-imagine-video model. Use when the user wants to create a video from text, animate a still image, build a reference-driven video (virtual try-on, character consistency), edit an existing video, or extend one. Asynchronous — the script handles polling.
.claude/skills/satasuk03-grok-imagine-video/SKILL.md| Model | Eval pass | Runs |
|---|---|---|
| gemini-3.6-flash | 96% | 27 |
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 115% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 76% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 217% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 59% | 0% |
| case-05 | ✗→✓ | ▲ Improved | -12% | 0% |
Calls xAI's video API (grok-imagine-video). Five modes, all in scripts/video.py:
| Mode | When to use | CLI | |------|-------------|-----| | text-to-video | Pure prompt → video | --prompt "..." | | image-to-video | Animate a still image (image becomes the first frame) | --prompt "..." --image PATH_OR_URL | | reference-to-video | Make a video featuring people / clothing / objects from reference images (no first-frame lock) | --prompt "..." --reference-image URL [URL ...] | | edit-video | Modify an existing video while preserving the rest | --prompt "..." --edit-video URL | | extend-video | Continue a video from its last frame | --prompt "..." --extend-video URL |
For full parameters, status flow, and gotchas, see references/api-reference.md. For Python recipes (xai-sdk, manual polling, async batches), see references/examples.md.
XAI_API_KEY exported in the environment.urllib). If the user prefers the official SDK, pip install xai-sdk and use the snippets in references/examples.md.bash# Text-to-video python scripts/video.py \ --prompt "Glowing crystal-powered rocket launching from red Mars dunes, ancient alien ruins lighting up" \ --duration 10 --aspect-ratio 16:9 --resolution 720p \ --output rocket.mp4 # Image-to-video (local file → animated) python scripts/video.py \ --prompt "Camera pushes in slowly. The leaves rustle in a gentle breeze." \ --image ./still.jpg \ --output animated.mp4 # Reference-to-video (virtual try-on / character consistency) python scripts/video.py \ --prompt "The model from <IMAGE_1> walks the runway wearing the shirt from <IMAGE_2>, slow motion, dramatic lighting" \ --reference-image https://.../model.jpg https://.../shirt.jpg \ --duration 10 --aspect-ratio 16:9 --resolution 720p \ --output runway.mp4 # Edit an existing video (preserves duration / aspect / resolution) python scripts/video.py \ --prompt "Give the woman a silver necklace" \ --edit-video https://.../source.mp4 \ --output edited.mp4 # Extend an existing video (duration = length of NEW portion only) python scripts/video.py \ --prompt "The cat notices a butterfly and leaps off the windowsill" \ --extend-video https://.../cat.mp4 --duration 6 \ --output extended.mp4
The script polls until status=done, downloads the resulting MP4 to --output, and prints both the local path and the source URL on stderr.
When the user wants a video, route by which inputs they have:
<IMAGE_1>, <IMAGE_2>, etc.--duration is the length of the extension only; output total = original + extension.Mutually exclusive — don't combine --image with --reference-image, and don't pass --edit-video with --extend-video. The script enforces this.
| Flag | Values | Default | Notes | |------|--------|---------|-------| | --prompt | str | required | Use <IMAGE_1>, <IMAGE_2> markers when referencing images | | --duration | int 1–15 (seconds) | model default | For extend, this is the added length only. Edit mode ignores. | | --aspect-ratio | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 | 16:9 | Edit mode ignores; image-to-video defaults to image's ratio | | --resolution | 480p, 720p | 480p | Edit mode ignores (caps at 720p) | | --image | path or https:// URL or data: URI | — | Image-to-video. Local files auto-encoded as base64 data URIs. | | --reference-image | one or more URLs / paths | — | Reference-to-video. Local files auto-encoded. | | --edit-video | URL | — | Edit-video mode. Must be an HTTPS URL (xAI-hosted is fine). | | --extend-video | URL | — | Extend-video mode. Source must be 2–15 s. | | --poll-interval | seconds | 5 | How often to check status | | --poll-timeout | seconds | 900 (15 min) | Bail out if not done by then | | --output | path | required | Where to save the downloaded MP4 | | --keep-url | flag | off | Skip the download, only print the xAI-hosted URL |
--keep-url only if you'll fetch within minutes.--duration is the length of the new portion. A 10s source + --duration 5 → 15s output.--image and --reference-image, and don't combine --edit-video and --extend-video.respect_moderation flag; if the model declines the prompt, rewrite rather than retry verbatim.pending → keep polling, done → download, expired → request lifecycle ended (re-submit), failed → permanent failure (rewrite prompt or check inputs).grok-image or gpt-image-2 skills.gpt-image-2 for image masking and consider re-animating.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 5,943 | 3,953 | -33% | 1 | 1 | 0% | 1,240 | 2,669 | +115% | 0 | 0 | — |
case-02 | fail→pass | 7,303 | 3,377 | -54% | 1 | 1 | 0% | 1,364 | 2,400 | +76% | 0 | 0 | — |
case-03 | fail→pass | 4,422 | 3,792 | -14% | 1 | 1 | 0% | 798 | 2,530 | +217% | 0 | 0 | — |
case-04 | fail→pass | 11,493 | 10,491 | -9% | 1 | 1 | 0% | 2,199 | 3,487 | +59% | 0 | 0 | — |
case-05 | fail→pass | 17,013 | 5,611 | -67% | 1 | 1 | 0% | 3,151 | 2,787 | -12% | 0 | 0 | — |
case-06 | fail→pass | 12,009 | 5,876 | -51% | 1 | 1 | 0% | 2,151 | 2,769 | +29% | 0 | 0 | — |
case-07 | fail→pass | 4,000 | 2,285 | -43% | 1 | 1 | 0% | 807 | 2,144 | +166% | 0 | 0 | — |
case-08 | pass→pass | 5,454 | 2,633 | -52% | 1 | 1 | 0% | 979 | 2,242 | +129% | 0 | 0 | — |
case-09 | fail→pass | 12,807 | 5,900 | -54% | 1 | 1 | 0% | 2,120 | 2,870 | +35% | 0 | 0 | — |
case-10 | pass→pass | 10,929 | 3,871 | -65% | 1 | 1 | 0% | 1,816 | 2,517 | +39% | 0 | 0 | — |
case-11 | fail→pass | 10,217 | 5,244 | -49% | 1 | 1 | 0% | 1,601 | 2,733 | +71% | 0 | 0 | — |
case-12 | pass→pass | 5,381 | 2,411 | -55% | 1 | 1 | 0% | 965 | 2,156 | +123% | 0 | 0 | — |
case-13 | fail→pass | 9,744 | 2,697 | -72% | 1 | 1 | 0% | 1,771 | 2,106 | +19% | 0 | 0 | — |
case-14 | fail→pass | 1,415,525 | 2,357 | -100% | 1 | 1 | 0% | 1,237 | 2,165 | +75% | 0 | 0 | — |
case-20 | fail→pass | 9,971 | 3,656 | -63% | 1 | 1 | 0% | 1,794 | 2,504 | +40% | 0 | 0 | — |
case-15 | pass→pass | 4,769 | 3,098 | -35% | 1 | 1 | 0% | 690 | 2,291 | +232% | 0 | 0 | — |
case-16 | pass→pass | 8,579 | 3,799 | -56% | 1 | 1 | 0% | 1,406 | 2,361 | +68% | 0 | 0 | — |
case-17 | fail→pass | 7,375 | 3,475 | -53% | 1 | 1 | 0% | 1,377 | 2,354 | +71% | 0 | 0 | — |
case-18 | fail→pass | 7,326 | 3,198 | -56% | 1 | 1 | 0% | 1,268 | 2,399 | +89% | 0 | 0 | — |
case-19 | fail→pass | 10,181 | 1,321 | -87% | 1 | 1 | 0% | 1,551 | 1,943 | +25% | 0 | 0 | — |
case-21 | pass→pass | 6,539 | 1,919 | -71% | 1 | 1 | 0% | 1,039 | 2,138 | +106% | 0 | 0 | — |
case-22 | fail→pass | 16,964 | 2,430 | -86% | 1 | 1 | 0% | 3,024 | 2,207 | -27% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +73 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.