Nodes/Grok Imagine (xAI)/Grok Imagine Video (xAI)
ComfyUI Node

Grok Imagine Video (xAI)

Text, Image or Reference to Video — With Sound

By Slartibart23·Created 3 months ago·Updated 21 days ago· 1
Grok Imagine Video (xAI)
  • image
  • reference_images
  • frames
  • fps
  • audio
  • video
  • video_path
  • prompt
  • info
◄prompt►
◄modelgrok-imagine-video-1.5►
◄duration6►
◄aspect_ratiodefault►
◄resolution720p►
◄seed0►
◄voice_ids►
◄generate_audiotrue►
◄image_max_side2048►
◄extract_framestrue►
◄extract_audiotrue►
◄custom_model►
◄api_key►
◄api_key_filegrok_api_key.txt►
◄base_urlhttps://api.x.ai/v1►
◄poll_interval_seconds5►
◄poll_timeout_seconds900►
◄download_folder►
◄show_previewtrue►

Why you'd reach for it

Because a 15-second 1080p clip with audio is still something your GPU can't do in one shot. Wan runs locally and it's the reason a lot of people are here, but the honest framing from the threads is that grok imagine video is dirt cheap per second next to renting GPU time, and the closed video models are simply ahead on motion and audio. This node is the xAI side of that trade, and it's the centrepiece of the pack: one node, three modes.

Three modes is not marketing. With nothing connected it's text-to-video. Connect image and that picture becomes the first frame - image-to-video, prompt describes the motion. Connect reference_images instead and you get reference-to-video, where people or objects from up to seven pictures appear in the clip without locking frame one. You cannot connect both; the node raises on that combination because the API rejects it. Reference-to-video is grok-imagine-video-1.5 only and capped at 720p, while 1080p is a 1.5 feature for text and image modes.

The widgets that matter

prompt describes scene and motion. duration is 1–15 seconds and billing is per second, rising with resolution - this is the dial that turns a cheap experiment into a bill, so start at 5 s / 720p. resolution offers 480p, 720p, 1080p or default (not sent). aspect_ratio on default means 16:9 for text-to-video or the input image's ratio for image-to-video; set anything explicit and it overrides, stretching an input image that doesn't match. generate_audio defaults on - the model writes a soundtrack and voices, and the finished clip plays with sound directly in the node.

For reference-to-video there's voice_ids: up to three comma-separated preset voice names, e.g. eve, leo, from the same roster as xAI's text-to-speech. Mention them in the prompt as <AUDIO_0>, <AUDIO_1> and your reference pictures as <IMAGE_1>, <IMAGE_2> - the model won't guess. image_max_side (256–4096, default 2048) downscales your inputs before upload to keep a big base image from crawling up the wire.

seed here is the same cache-breaker as everywhere else in this pack: not sent, not reproducible, fixed means a cached identical run costs nothing again.

Outputs, and the one that saves disk space

Seven outputs, and they're deliberately generous: frames (the decoded MP4 as an IMAGE batch), fps, audio (an AUDIO dict), video (a native ComfyUI VIDEO object), video_path (a plain string path - this is the one you connect to Grok Video Save), prompt, and info.

That last one carries the model the API actually used, the duration, the respect_moderation flag, a request_id, and the billed cost. Print it or read it in the console; it's how you catch a job that quietly ran on a different model than you thought.

The MP4 downloads to your Windows temp folder (%TEMP%\grok_imagine) unless you set download_folder, and the save node moves it out - nothing is ever written to ComfyUI's output folder. The pack even prints a line on startup if unsaved videos are still sitting there.

extract_frames decoding a 15-second 1080p clip is a lot of RAM for a batch of images you may not want. Turn it off when you only need the file, the VIDEO object or the audio - video_path is unaffected. Same logic for extract_audio.

Install

Manager, search Grok Imagine. Manually:

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 in-node video preview with sound loads. imageio-ffmpeg ships with the requirements and brings its own ffmpeg binary; a system ffmpeg on PATH is used first if you have one. Key resolution is widget → XAI_API_KEY → grok_api_key.txt in the ComfyUI root, the portable root or the pack folder.

Where people get burned

Timeouts. poll_timeout_seconds defaults to 900; a 15-second 1080p render with audio can genuinely run past several minutes on a busy API, and when it does you get Timed out after ...s, not a broken video. Raise it to 1800 and try again. Silence. If ffmpeg isn't findable, the audio output comes back as a silent placeholder rather than failing - so a mysteriously quiet AUDIO wire usually means ffmpeg, not the model. Wrong mode. Connect EITHER 'image' OR 'reference_images' is the node being helpful; pick one. And if you upgraded from a 2.x install, delete and re-add the video nodes once - new widgets were added and old instances won't show them.

CategoryGrok/Imagine

Inputs (21)

NameTypeDefaultDescription
promptSTRINGDescribe the scene and the motion. For image-to-video describe what should happen; for reference-to-video mention <IMAGE_1>... and <AUDIO_0>... explicitly.
modelCOMBOgrok-imagine-video-1.5grok-imagine-video-1.5: text/image/reference-to-video, 1080p, up to 15 s, audio, preset voices. grok-imagine-video (1.0): older, cheaper per second, needed for video editing.
durationINT61–15Length in seconds (1-15). Billing is per second and rises with resolution.
aspect_ratioCOMBOdefault'default' = 16:9 for text-to-video, the input image's ratio for image-to-video. Any explicit value overrides (and stretches an input image if it does not match).
resolutionCOMBO720p480p (API default, fastest), 720p, or 1080p (grok-imagine-video-1.5 text/image-to-video only; reference-to-video is capped at 720p). 'default' = do not send.
seedINT00–18446744073709550000Cache-breaker only (not sent). randomize = new video every run; fixed = re-use the cached result for identical settings (no cost).
imageoptIMAGEConnect for IMAGE-TO-VIDEO: this picture becomes the first frame and the prompt describes the motion. Leave unconnected for text-to-video. Cannot be combined with reference_images.
reference_imagesoptIMAGEConnect an IMAGE batch (up to 7) for REFERENCE-TO-VIDEO: people, objects or clothing from these pictures appear in the video without locking the first frame. Refer to them in the prompt as <IMAGE_1>, <IMAGE_2>... Use a Batch Images node to combine several pictures. grok-imagine-video-1.5 only, max 720p. Cannot be combined with image.
voice_idsoptSTRINGOptional preset voices for reference-to-video (grok-imagine-video-1.5), comma-separated, max 3, e.g. 'eve, leo'. Refer to them in the prompt as <AUDIO_0>, <AUDIO_1>... Same roster as xAI Text-to-Speech. Leave empty for no voice reference.
generate_audiooptBOOLEANtrueOn = the model generates a soundtrack/voices (default). Off = silent video (sends generate_audio=false).
image_max_sideoptINT2048256–4096Input images are downscaled so their longer side is at most this many pixels before upload (saves upload time; the API limit is 20 MiB per image).
extract_framesoptBOOLEANtrueDecode 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_audiooptBOOLEANtrueDecode the video's audio track to the 'audio' output (AUDIO). Needs ffmpeg (bundled with imageio-ffmpeg). Off = silent placeholder.
custom_modeloptSTRINGType 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_keyoptSTRINGYour 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_fileoptSTRINGgrok_api_key.txtText 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_urloptSTRINGhttps://api.x.ai/v1API base URL. Leave at https://api.x.ai/v1 unless you use a proxy.
poll_interval_secondsoptINT52–60Seconds between status checks while the video renders.
poll_timeout_secondsoptINT90060–7200Maximum seconds to wait for the video job. 15-second 1080p clips can take several minutes — raise this if jobs time out.
download_folderoptSTRINGWhere 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_previewoptBOOLEANtrueShow 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)

NameTypeDescription
framesIMAGEAll decoded frames as an IMAGE batch (empty 64x64 placeholder if extract_frames is off).
fpsFLOATFrame rate of the MP4 as reported by the decoder - connect to Save/Combine nodes.
audioAUDIODecoded soundtrack as AUDIO (silent placeholder if the file has no audio or extract_audio is off). Works with Save Video / Video Combine audio inputs.
videoVIDEONative ComfyUI VIDEO object (file-backed) for Save Video, Preview Video, Get Video Components. None on very old ComfyUI builds.
video_pathSTRINGPath 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.
promptSTRINGThe prompt exactly as sent, for Save nodes (prompt_text) or captions.
infoSTRINGFacts about the job: model used, duration, moderation flag, request_id, billed cost.