Grok Imagine Video Extend (xAI)
Bolting Extra Seconds Onto the End
- frames
- fps
- audio
- video
- video_path
- prompt
- info
Why you'd reach for it
Because 15 seconds is the ceiling on a single Grok Imagine video request, and stories don't fit in 15 seconds. This node picks up an existing MP4 from its last frame and continues it by however many seconds you ask for: feed in a 10-second clip, ask for 5, get back 15 that looks like one take.
It's the quiet third member of the video trio, and honestly the one people discover last - you generate, you like it, you wish there were more of it. Extend is the answer to "more of it" without regenerating the first ten seconds and hoping the model agrees with your own video about what the character looks like.
The obvious use is a longer single shot. The less obvious one is stitched narrative: generate a 6-second beat, extend it 6 more, extend again, and you've built a thirty-second sequence out of three paid calls instead of one long prayer. Each call is billed for the seconds you add, so the arithmetic stays legible.
Inputs
video_path is required and takes either the video_path output of a Grok video node or a path you type. video_url is the optional alternative - a public https URL of an MP4, used only when video_path is empty, which is the polite way to extend something already hosted rather than base64-ing it up the wire again.
duration means seconds to add, not total length. The author's own example: a 10-second input with duration 5 returns a 15-second video. It's capped at 15, and the honest reading is that 15 is also roughly the useful ceiling. model defaults to grok-imagine-video-1.5 (the opposite default to the Edit node, which wants 1.0). prompt describes what happens next, starting from the last frame - write it as a continuation, not a fresh scene description. seed is the pack-wide cache-breaker: not sent to the API, not reproducible, and leaving it fixed means an unchanged graph reuses the cached result without paying again.
One thing to set expectations on: output resolution matches the input, capped at 720p. Extending a 1080p clip doesn't upgrade it, and nothing in this node asks for a bigger frame.
Outputs
Same seven as the other video nodes - frames, fps, audio, video, video_path, prompt, info - and that consistency is the point: you can swap Video, Video Edit and Video Extend in a graph without re-wiring anything. frames is the whole extended clip decoded as an IMAGE batch, audio is the soundtrack as an AUDIO dict (generate_audio is handled inside the API here; this node doesn't expose it), video is a native ComfyUI VIDEO object for the built-in video nodes, and video_path is the string you connect to Grok Video Save.
info gives you the model the API actually served, the duration, the respect_moderation flag, the request id and the billed cost - worth a glance after a chain of three extends to make sure you got three extensions and not one.
extract_frames defaults on, which is heavy for a long clip: turn it off when all you want is the file or the VIDEO object, and video_path keeps working either way. extract_audio defaults on too, and needs ffmpeg - imageio-ffmpeg in the requirements provides one, and a missing binary yields silence rather than an error. Downloads go to %TEMP%\grok_imagine unless you set download_folder, and the save node moves them out of there.
Install
Manager, search Grok Imagine, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Slartibart23/comfyui-grok-imagine-video
..\..\python_embeded\python.exe -m pip install -r comfyui-grok-imagine-video\requirements.txt
Restart, then Ctrl+F5 once so the preview script loads. Requirements are requests, numpy, Pillow, imageio and imageio-ffmpeg - no model downloads, no VRAM. Key lookup order: api_key widget, then XAI_API_KEY, then grok_api_key.txt in the ComfyUI root, the portable root or the pack folder.
Where people get burned
Extending the wrong file. Chaining Extend off an Extend is fine, but the second call uploads the already extended clip inline, so you're paying for the whole thing to grow - for very long chains it's worth tracking that the input is what you think it is. Running past the poll timeout: these are full video jobs, poll_timeout_seconds defaults to 900, and three chained extensions in one graph is three chances for a long wait. Expecting a resolution bump from a 1080p source; capped at 720p, by design. And after a 2.x upgrade the video and save nodes should be deleted and re-added once, or the newer widgets simply won't be there.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| video_path | STRING | Local .mp4 to continue. Connect the video_path output of a Grok video node or type a path. Uploaded inline (base64). | |
| prompt | STRING | What happens next, starting from the last frame. | |
| model | COMBO | grok-imagine-video-1.5 | Video model for the extension. |
| duration | INT | 51–15 | Seconds to ADD. A 10 s input with duration=5 returns a 15 s video. Output resolution matches the input, capped at 720p. |
| seed | INT | 00–18446744073709550000 | Cache-breaker only (not sent). |
| video_urlopt | STRING | Alternative to video_path: a PUBLIC https URL of an .mp4. Used only when video_path is empty. | |
| extract_framesopt | BOOLEAN | true | Decode the MP4 into an IMAGE batch on the 'frames' output. Turn off to save RAM/time when you only need the file, the VIDEO object or the audio. |
| extract_audioopt | BOOLEAN | true | Decode the video's audio track to the 'audio' output (AUDIO). Needs ffmpeg (bundled with imageio-ffmpeg). Off = silent placeholder. |
| custom_modelopt | STRING | Type any model ID here to override the dropdown (e.g. a brand-new release). Leave empty to use the dropdown. See console.x.ai or GET /v1/models for valid IDs. | |
| api_keyopt | STRING | Your xAI API key. NOT recommended here — it is saved inside exported workflows. Prefer the XAI_API_KEY environment variable or the key file. | |
| api_key_fileopt | STRING | grok_api_key.txt | Text file containing only the key. Searched in the ComfyUI root, the portable root and this pack's folder (or give an absolute path). The same file serves the Prompt Forge pack. |
| base_urlopt | STRING | https://api.x.ai/v1 | API base URL. Leave at https://api.x.ai/v1 unless you use a proxy. |
| poll_interval_secondsopt | INT | 52–60 | Seconds between status checks while the video renders. |
| poll_timeout_secondsopt | INT | 90060–7200 | Maximum seconds to wait for the video job. 15-second 1080p clips can take several minutes — raise this if jobs time out. |
| download_folderopt | STRING | Where the finished MP4 is downloaded BEFORE you save it. Empty = the Windows temp folder (<Temp>\grok_imagine). Grok Video Save MOVES the file from here to your final folder, so nothing piles up. Never the ComfyUI output folder. | |
| show_previewopt | BOOLEAN | true | Show the finished video with sound directly in this node after the run - handy for checking before you save. No file is written for this. |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| frames | IMAGE | All decoded frames as an IMAGE batch (empty 64x64 placeholder if extract_frames is off). |
| fps | FLOAT | Frame rate of the MP4 as reported by the decoder - connect to Save/Combine nodes. |
| audio | AUDIO | Decoded soundtrack as AUDIO (silent placeholder if the file has no audio or extract_audio is off). Works with Save Video / Video Combine audio inputs. |
| video | VIDEO | Native ComfyUI VIDEO object (file-backed) for Save Video, Preview Video, Get Video Components. None on very old ComfyUI builds. |
| video_path | STRING | Path of the downloaded MP4 in the temp folder - connect to Grok Video Save, which moves it to your folder without re-encoding, or to Video Edit / Extend. |
| prompt | STRING | The prompt exactly as sent, for Save nodes (prompt_text) or captions. |
| info | STRING | Facts about the job: model used, duration, moderation flag, request_id, billed cost. |