Nodes/RobeNodes/grokImage
ComfyUI Node

grokImage

The least-censored mainstream image model, one node away

By RobeSantoro·Created 2 years ago·Updated 3 months ago· 0
grokImage
  • image_ref
  • image
  • url_or_error
promptA futuristic city in cyberpunk style
model_namegrok-imagine-image-quality
aspect_ratio1:1
resolution1k
n1
api_key
response_formaturl
timeout_seconds180

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 it
  • model_name - grok-imagine-image-quality (default) or grok-imagine-image
  • aspect_ratio - fourteen choices, including phone ratios (19.5:9, 20:9) and auto
  • resolution - 1k or 2k
  • n - how many images (1–10), stacked into the output batch
  • image_ref (optional) - wire an image in and the call becomes an edit, with your image base64-encoded as a data URI and sent to xAI
  • response_format - url (node downloads the result) or b64_json
  • timeout_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_error before 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.

CategoryRobeNodes/Grok

Inputs (9)

NameTypeDefaultDescription
promptSTRINGA futuristic city in cyberpunk style
model_nameCOMBOgrok-imagine-image-quality2 options: grok-imagine-image-quality, grok-imagine-image
aspect_ratioCOMBO1:114 options: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, +8
resolutionCOMBO1k2 options: 1k, 2k
nINT11–10Number of images to generate.
image_refoptIMAGEReference image for image-to-image editing.
api_keyoptSTRING
response_formatoptCOMBOurl2 options: url, b64_json
timeout_secondsoptINT18030–600

Outputs (2)

NameTypeDescription
imageIMAGE
url_or_errorSTRING