Grok Reference to Video
Up to 3 images become a motion clip
- reference_images
- client
- video_url
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-videodefault. - aspect_ratio -
16:9default, with the usual portrait/landscape options. - resolution -
720pdefault;480pis 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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Text description of the video. Use <IMAGE_1>, <IMAGE_2>, <IMAGE_3> tokens to reference the connected images. | |
| reference_images | IMAGE | Batched IMAGE input — up to 3 frames. Used as visual reference for the generated video. Convert to data URIs automatically. | |
| clientopt | GROK_API_CLIENT | Grok API client from Grok API Client node. Optional: when unconnected, the key is resolved from ComfyUI Settings or grok/config.ini. | |
| modelopt | COMBO | grok-imagine-video | xAI video model. |
| aspect_ratioopt | COMBO | 16:9 | Output aspect ratio. |
| resolutionopt | COMBO | 720p | Output resolution. 480p is faster; 720p is HD. |
| durationopt | INT | 51–15 | Video duration in seconds (1–15). |
| seedopt | INT | -1-1–4294967295 | Seed for ComfyUI cache invalidation only — not forwarded to the API. -1 for random. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| video_url | STRING | — |