Grok Imagine Image 2.0 Image Edit
Reference-image editing where the ratio is mandatory
- image_urls
- image
- url
- all_urls_json
- task_id
- raw_json
- credits_consumed
- credits_left
What it is
An edit-by-reference node for xAI's Grok Imagine Image 2.0, under KIE Next / Image / xAI / Grok Imagine. You give it an image and a sentence describing what should change, and you get a new image back. No mask, no inpainting model, no latent surgery - it's the "describe the change" flavour of editing that closed image models have been good at since Kontext made the shape familiar.
Where it fits in a real workflow: this is the cleanup pass after a local generation. Your checkpoint gave you a composition you like with a detail you hate - a weird hand, a logo that says "COLA", a background that's almost right. Instead of re-rolling locally and losing the composition, send the frame here with a prompt that describes the fix. It's also the node you reach for when you want a different aspect ratio than the source, since the ratio is an explicit required field.
How it works
The connected IMAGE is uploaded to KIE's upload endpoint as PNG, the returned URL goes into the request along with your prompt and ratio, and the node then submits the task, polls it to completion, downloads the result and hands you a fresh tensor. The downloaded file is archived under your ComfyUI output folder, so a ComfyUI restart doesn't take your edit with it.
That's it. There's no local model, no LoRA, no VRAM cost - just HTTP and a paid credit, and a node id that pins you to this exact model version.
The inputs
Three are required, which is unusually opinionated for a node in this pack:
- image_urls - the
IMAGEsocket. Despite the plural name, KIE documents this model as taking a single reference image, so treat it as one. It's a normal ComfyUI image input, so it takes aLoadImageoutput, aSaveImage-adjacent tensor, or the output of a local sampler. - prompt - what you want changed, up to 8000 characters. Descriptive works better than imperative here: describe the finished image you want, not "fix the hand".
- aspect_ratio - required, default
1:1, with2:3,3:2,16:9,9:16andautoon the menu. This is the field people leave on the default and then wonder why their landscape reference came back square. Set it to match the input unless you want the crop.
Optional: timeout_seconds (default 1200) and callback_url, which you leave empty unless you're receiving KIE webhooks on a server.
Outputs
image is the edited tensor - wire it into SaveImage, a local detailer, or a video node. url and all_urls_json give you the hosted results (all_urls_json is the complete set the task returned, which is what you want if you're scripting downloads). task_id identifies the task - keep it if you might chain another Grok edit, and note that this node's own docs point at task IDs as the input path for Segment Edit. raw_json is the provider response in full, and credits_consumed / credits_left report cost and balance, also drawn on the node after a run.
Install
ComfyUI Manager → KIE.ai Nodes Next, or:
cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
python -m pip install -r ComfyUI-KIE-Nodes-Next/requirements.txt
requests, Pillow, numpy, PyYAML - that's the whole dependency list, no weights, since the model isn't on your machine. Restart ComfyUI, then paste your KIE.ai key once at Settings → KIE.ai Nodes Next → Connection. It's validated before it replaces anything, kept backend-side, and KIE_API_KEY works for headless setups.
First launch reads KIE's docs index and generates the node library from it, reloading the frontend once; after that it checks the catalog at most daily. If this node isn't in your menu, refresh the catalog rather than reinstalling the pack.
Gotchas
- It's editing an upload, not a canvas. Anything the model doesn't like about your source image, it will happily redraw, including the parts you liked. Iterate in small steps.
autoratio is a gamble. The docs list it, but the model still has to choose; if the ratio matters, say it explicitly.- Ratios are a real parameter, not metadata. Asking for
16:9from a square source means the output is 16:9, filling in the rest - that's a redraw, not a crop. - Chain costs stack. Image-to-image here, then a segment edit later, is two paid calls for one picture.
- No key, no node. You'll see
No KIE API key configured...- that's the one-time Settings step, not your wiring. - Compare with local first. For a single-region fix on an image you already have, a local inpaint with a mask is free and often more surgical. This node's edge is described edits and closed-model taste, not precision.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Recreate the Titanic movie poster with two adorable anthropomorphic cats in the same romantic pose at the bow of the ship. The male cat is an orange tabby wearing a vest, standing behind a white long-haired female cat in a lace dress, holding her paws as they stretch forward in the wind. Both cats are photorealistic with detailed fur, wind-swept hair, and dramatic sunset lighting (warm golden highlights, cool blue shadows). Background: the Titanic ship at dusk with four smokestacks, glowing deck lights, calm ocean, and orange-pink sunset sky. Center title: “CATANIC” in the same gold metallic serif style as Titanic, same size and position. | A text description specifying the desired content or style of the generated image. (Max length: 8000 characters) |
| aspect_ratio | COMBO | 1:1 | Specifies the width-to-height ratio of the generated image. Controls the aspect ratio of the output. This field is required. |
| image_urls | IMAGE | — | |
| timeout_secondsopt | INT | 120030–7200 | — |
| callback_urlopt | STRING | Optional KIE callback URL. Leave empty for normal ComfyUI use. |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| url | STRING | — |
| all_urls_json | STRING | — |
| task_id | STRING | — |
| raw_json | STRING | — |
| credits_consumed | FLOAT | — |
| credits_left | FLOAT | — |