Nodes/ERPK Collection/Grok Image Edit
ComfyUI Node

Grok Image Edit

Sentence-driven edits on up to three source images

By eRepublik-Labs·Created 11 months ago·Updated 20 days ago· 1
Grok Image Edit
  • image
  • client
  • image
prompt
modelgrok-imagine-image
aspect_ratioauto

Grok Image Edit is the sibling of Grok Image Generation: instead of a prompt alone, you give it an image and a sentence, and it returns a modified image as a real IMAGE tensor. It's the hosted-model version of the instruction editing that Qwen-Image-Edit and Flux Kontext made standard locally - hand it "make this a rainy street" and it re-emits the whole frame with the change applied.

The one thing that sets this node apart from the pack's other editors is that it takes a batched IMAGE tensor as its source. Pass in a batch of up to three images and they all get sent to xAI as references. The node's own tooltip says it plainly: "Pass a batched IMAGE tensor to send multiple reference images (xAI cap: 3)." That's genuinely useful for multi-reference work - a product shot plus a style reference, a character in two poses, or a subject with a lighting reference. The prompt tells the model how to combine them.

The inputs

  • image - required, an IMAGE tensor (batched up to 3)
  • prompt - required, how to modify the image(s)
  • aspect_ratio - optional, default auto, which preserves the source ratio
  • model - optional, defaults to grok-imagine-image
  • client - optional, falls through to ERPK Settings

Note what's missing: no mask input. Like most hosted editors, this model edits the whole frame; there's no inpainting boundary. If you need bit-identical unmasked pixels - say, you're fixing one detail and want everything else untouched - this isn't the tool. That's exactly the case the KB's inpainting essay makes: instruction editors drift pixels you didn't ask to change, and a mask-based local pipeline still owns "leave the rest alone."

Install and setup

It's part of the ERPK Collection:

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

Requires xai-sdk>=1.14.0 and an xAI API key in ERPK Settings (right-click canvas > ERPK Settings). Restart after install; find it under ERPK/Grok.

The workflow shape that works

A nice pattern: Grok Image Generation makes four candidates in one call (n up to 4), then you pick the best one and feed it into Grok Image Edit to refine - "fix the hand," "change the background to night." Because both nodes output IMAGE tensors, they chain without any download/upload step, which is the real reason to use this pack's Grok section over copy-pasting between the xAI website and a LoadImage node.

The honest caveats: it's a hosted model, so no LoRA, no fine-grained style control, and each edit is a fresh billed call. And remember the whole-frame behavior - if the edit shifts something you didn't ask about, that's the model, not a setting you've missed. For surgical changes, you'd pair this with a mask-based approach instead.

CategoryERPK/Grok

Inputs (5)

NameTypeDefaultDescription
imageIMAGESource image(s) to edit. Pass a batched IMAGE tensor to send multiple reference images (xAI cap: 3).
promptSTRINGDescription of how to modify the image.
clientoptGROK_API_CLIENTGrok API client from Grok API Client node. If not connected, resolves from ComfyUI Settings or environment.
modeloptCOMBOgrok-imagine-imageGrok image model for editing.
aspect_ratiooptCOMBOautoOutput aspect ratio. 'auto' preserves the source image ratio.

Outputs (1)

NameTypeDescription
imageIMAGE