Grok Image Edit
Sentence-driven edits on up to three source images
- image
- client
- image
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, defaultauto, which preserves the source ratiomodel- optional, defaults togrok-imagine-imageclient- 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.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Source image(s) to edit. Pass a batched IMAGE tensor to send multiple reference images (xAI cap: 3). | |
| prompt | STRING | Description of how to modify the image. | |
| clientopt | GROK_API_CLIENT | Grok API client from Grok API Client node. If not connected, resolves from ComfyUI Settings or environment. | |
| modelopt | COMBO | grok-imagine-image | Grok image model for editing. |
| aspect_ratioopt | COMBO | auto | Output aspect ratio. 'auto' preserves the source image ratio. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |