Nodes/ERPK Collection/Grok Reference to Video
ComfyUI Node

Grok Reference to Video

Up to 3 images become a motion clip

By eRepublik-Labs·Created 11 months ago·Updated 21 days ago· 1
Grok Reference to Video
  • reference_images
  • client
  • video_url
prompt
modelgrok-imagine-video
aspect_ratio16:9
resolution720p
duration5
seed-1

Where Grok Text-to-Video works from words alone, this node works from pictures: feed it up to three reference images plus a prompt, and xAI's grok-imagine-video model turns them into motion. It's the tool for "make this character do something," "animate this product shot," or any job where identity and composition already exist and you want the video to respect them.

The mechanism: you connect up to three images on the batched reference_images input, and the node converts them to data URIs and sends them to xAI with your prompt. The prompt can address each image by token - <IMAGE_1>, <IMAGE_2>, <IMAGE_3> - so "show <IMAGE_1> from a low angle" controls which reference is doing what. The xAI SDK then polls the video job internally, and the node returns the finished clip's URL.

Inputs

  • reference_images - required batch, up to 3 frames.
  • prompt - required, with the <IMAGE_N> tokens available.
  • model - grok-imagine-video default.
  • aspect_ratio - 16:9 default, with the usual portrait/landscape options.
  • resolution - 720p default; 480p is faster and cheaper, 720p is HD.
  • duration - 1–15 seconds, default 5. Longer = more expensive.
  • seed - here's the honest bit: the tooltip says it's cache invalidation only, not forwarded to the API. xAI picks its own noise; fixed seed = ComfyUI serves a cached result, -1 = fresh billed run.

Output

video_url - a plain STRING holding a URL to the finished video. That's the pack's convention for video: you can't wire a video tensor, so you wire the URL into Preview Anything, which renders it in-graph and gives you a download button.

Install and gotchas

Part of the ERPK Collection - needs the xai-sdk>=1.14.0 dependency that requirements.txt pulls in:

cd ComfyUI/custom_nodes
git clone https://github.com/eRepublik-Labs/comfyui-nodes-erpk.git erpk
cd erpk && pip install -r requirements.txt

Restart (or ComfyUI Manager → search erpk), then an xAI key under Settings > ERPK > API Keys (or grok/config.ini). Every generation is a paid xAI call, and video is the priciest thing on this page - resolution and duration are the two levers on the bill.

Where people get burned: forgetting the <IMAGE_N> tokens exist and writing a prompt that references "the first image" in words - the model doesn't reliably map prose to image order. Use the tokens. And don't try to wire the video_url into an image node expecting a frame; the output is a URL string, and only Preview Anything (or a URL-to-video utility) understands it.

CategoryERPK/Grok/Video

Inputs (8)

NameTypeDefaultDescription
promptSTRINGText description of the video. Use <IMAGE_1>, <IMAGE_2>, <IMAGE_3> tokens to reference the connected images.
reference_imagesIMAGEBatched IMAGE input — up to 3 frames. Used as visual reference for the generated video. Convert to data URIs automatically.
clientoptGROK_API_CLIENTGrok API client from Grok API Client node. Optional: when unconnected, the key is resolved from ComfyUI Settings or grok/config.ini.
modeloptCOMBOgrok-imagine-videoxAI video model.
aspect_ratiooptCOMBO16:9Output aspect ratio.
resolutionoptCOMBO720pOutput resolution. 480p is faster; 720p is HD.
durationoptINT51–15Video duration in seconds (1–15).
seedoptINT-1-1–4294967295Seed for ComfyUI cache invalidation only — not forwarded to the API. -1 for random.

Outputs (1)

NameTypeDescription
video_urlSTRING