grokImage
The least-censored mainstream image model, one node away
- image_ref
- image
- url_or_error
xAI's Grok Imagine is the closest thing to a mainstream image model with real teeth - famously the least-restrictive of the closed services, no open weights, and the community genuinely loves what it makes. This node puts that behind a ComfyUI canvas: prompt in, image tensor out, with an image-to-image edit mode when you wire a reference image in. It's an API-wrapper node, so there's nothing to download and no GPU needed - just an xAI API key and a tolerance for your data leaving the machine.
How it works
On execution it posts to xAI's image API - /v1/images/generations when there's no reference image, /v1/images/edits when there is. The key comes from the XAI_API_KEY environment variable or the api_key input. Two outputs: image (the IMAGE tensor) and url_or_error (a STRING - normally the source URL of the first image, or the error message when something went wrong).
The key inputs:
prompt- the actual prompt; default is a cyberpunk city, so change itmodel_name-grok-imagine-image-quality(default) orgrok-imagine-imageaspect_ratio- fourteen choices, including phone ratios (19.5:9, 20:9) andautoresolution-1kor2kn- how many images (1–10), stacked into the output batchimage_ref(optional) - wire an image in and the call becomes an edit, with your image base64-encoded as a data URI and sent to xAIresponse_format-url(node downloads the result) orb64_jsontimeout_seconds- request timeout, default 180
Two implementation details worth knowing. It sets IS_CHANGED to NaN, so the node always re-runs and ComfyUI's cache never skips it - correct behavior for an API call, but it means every run costs you a network round-trip. And when the API fails, you don't get a clean error node: you get a red 512x512 image tensor plus the real message in url_or_error. If you see solid red in your preview, read the string output, that's the node screaming.
Installing the pack
Search "Robe Nodes" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/RobeSantoro/ComfyUI-RobeNodes
Restart ComfyUI. Grab an API key from the xAI console and set XAI_API_KEY. The requests dependency comes from the pack's requirements.txt, installed by Manager.
Where people get burned
- The red tensor. Every API failure - bad key, rate limit, refusal - surfaces as a red image. Check
url_or_errorbefore blaming the node. - Cost and moderation. Grok is metered per image, and while its moderation is famously light (the "Spicy Mode" reputation is real), it's still a hosted filter at the source. What the model refuses, no node can un-refuse.
- Key hygiene again. Put the key in the env var, not the widget - widget keys get embedded in your saved workflow JSON, which rides inside output images. Prefer
XAI_API_KEY. - The edit path sends your image to xAI. That's the mechanism, not a bug, but know it's happening.
This is a small personal pack (essentially zero community footprint), so it's on you to eyeball the ~150 lines of GrokImage before trusting it with a credential - MIT-licensed, openly readable, and short. For a model you can't run locally, that's the honest trade, and the community's verdict on the model itself is loud and positive: worth trying at least once.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | A futuristic city in cyberpunk style | — |
| model_name | COMBO | grok-imagine-image-quality | 2 options: grok-imagine-image-quality, grok-imagine-image |
| aspect_ratio | COMBO | 1:1 | 14 options: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, +8 |
| resolution | COMBO | 1k | 2 options: 1k, 2k |
| n | INT | 11–10 | Number of images to generate. |
| image_refopt | IMAGE | Reference image for image-to-image editing. | |
| api_keyopt | STRING | — | |
| response_formatopt | COMBO | url | 2 options: url, b64_json |
| timeout_secondsopt | INT | 18030–600 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| url_or_error | STRING | — |