grok edit (comfyapikey)
XAI image editing through your Comfy key
- image_1
- image_2
- image_3
- image
- show_price
The "least restrictive" image model, wired into your graph
The display name is literally "grok edit (comfyapikey)" - no glamour, which fits the job. This node runs xAI's Grok Imagine image editing through Comfy's API proxy, with your ComfyUI API key. Give it one or more reference images and a prompt, and it edits them the way GPT Image or Nano Banana edit - but from xAI, the vendor the community consistently calls the least-restrictive mainstream option. Grok's generator is architecturally a different beast too: an autoregressive mixture-of-experts that predicts visual tokens rather than doing diffusion.
Grok has no open weights, so this is one of those "call it, you can't download it" cases from the API-wrapper playbook. The node gets it into a workflow next to your local nodes without you ever touching xAI's own site.
How it works
The node base64-encodes each input image into a data URL and POSTs a JSON payload to https://api.comfy.org/proxy/xai/v1/images/edits with your key in the X-API-KEY header. It's interrupt-aware - you'll see elapsed seconds on the node while it waits, and cancel actually cancels. Result images get downloaded and returned as a batched IMAGE, so you can set number_of_images above 1 and get them all out of one call.
Four models are offered, and the default grok-imagine-image-2.0 is the one you probably want:
- grok-imagine-image-2.0 - the current flagship edit model; accepts up to 3 input images, and the only one where the
qualitysetting does anything. - grok-imagine-image-quality and grok-imagine-image - older tiers, also up to 3 images.
- grok-imagine-image-pro - the heavy one, and it's picky: exactly 1 input image, and it ignores aspect ratio entirely.
The inputs that matter
api_key- your ComfyUI API key, from comfy.org/api-keys. It also ends up in the saved workflow file, so keep those private.prompt- what to change. This is an edit, not a from-scratch generation: describe the change.image_1- the first reference.image_2andimage_3are optional references for multi-image edits.model- default 2.0 is fine to leave.aspect_ratio- here's the trap: a custom aspect ratio (anything butauto) requires multiple input images for the quality/base models. One image + a custom ratio = an error string, not an image.resolution(1K/2K) andnumber_of_images(1–10) - straightforward.
Outputs: image (the edited result, batched if you asked for several) and show_price, a string with the actual cost in USD/RMB plus credits used when the API reports it.
Install and issues
Shared pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/comfyui-PD_comfy-api-node.git
pip install -r comfyui-PD_comfy-api-node/requirements.txt
Restart and look under PD_Tools/Image_Generation. No extra model downloads - this is a network node.
The failure modes are mostly the API's, surfaced as error strings: hitting the input-image caps (3 max, or 1 on pro), the custom-aspect-ratio trap above, and timeouts - the node waits up to 600 seconds, and a busy Grok queue can eat all of it. Costs are per call and priced per model/resolution, which is why the show_price output exists. And the usual caveat: your prompts and images leave the machine for xAI's servers, moderated by xAI's policies - for the exact "least restrictive" content people reach for Grok to generate, the moderation at the API source is still the ceiling.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | — | |
| prompt | STRING | — | |
| model | COMBO | grok-imagine-image-2.0 | 4 options: grok-imagine-image-2.0, grok-imagine-image-quality, grok-imagine-image-pro, grok-imagine-image |
| image_1 | IMAGE | — | |
| resolution | COMBO | 1K | 2 options: 1K, 2K |
| quality | COMBO | medium | 2 options: medium, low |
| number_of_images | INT | 11–10 | — |
| seed | INT | 00–2147483647 | — |
| aspect_ratio | COMBO | auto | 14 options: auto, 1:1, 2:3, 3:2, 3:4, 4:3, +8 |
| image_2opt | IMAGE | — | |
| image_3opt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| show_price | STRING | — |