Nodes/ERPK Collection/Grok Image Generation
ComfyUI Node

Grok Image Generation

Grok images without leaving ComfyUI — and n up to 4 costs the same

By eRepublik-Labs·Created 11 months ago·Updated 21 days ago· 1
Grok Image Generation
  • client
  • image
prompt
modelgrok-imagine-image
aspect_ratio1:1
resolution1k
n1

Grok Image Generation is the text-to-image node in the ERPK Grok section: type a prompt, get an IMAGE tensor back that you can preview, save, upscale, or feed into another node - no downloading from the xAI console. If you're already running the rest of this pack, it's the quickest way to lean on Grok's image model from inside a workflow.

Mechanically it's a thin API wrapper. It sends your prompt to the grok-imagine-image model with an aspect ratio and resolution, downloads the returned URLs into a ComfyUI IMAGE tensor, and hands that out. Because the result is a real tensor, not a URL string, you can chain it straight into anything image-shaped - preview, save, upscale, even pass it to Grok Image Edit for a follow-up pass.

The inputs that matter

  • prompt - the whole ballgame, a plain-English description
  • aspect_ratio - pick from the dropdown (default 1:1)
  • resolution - 1k (~1024px) or 2k (~2048px)
  • n - 1 to 4 images per call

Here's the sleeper feature: n up to 4. Grok's image endpoint returns multiple images in a single call, and the node stacks them into a batch. In the ComfyUI world that means one queue run can hand you four candidates at once - preview them in the same Image node with the batch controls, or use the seed widget on the node to vary them. For storyboarding or "give me options" workflows, that's a lot of value for one API call.

The other inputs are the standard Grok plumbing: client (optional, falls through to ERPK Settings), model (defaults to grok-imagine-image), and that's it. No seed, no negative prompt, no CFG - xAI's image model doesn't expose them, and the node doesn't fake them.

Install

Everything here comes with 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

That installs xai-sdk>=1.14.0, the one real dependency. Or install "ERPK Custom Nodes" from ComfyUI Manager. Then put an xAI key in ERPK Settings (right-click the canvas) and you're running - the client node is optional.

Troubleshooting

Two common failure points. First, no key: you'll get a key-resolution error at execute time - set the key in ERPK Settings and re-run. Second, the node prints [Grok] Generating n image(s) via grok-imagine-image in the console before it calls out; if you see that line and then nothing, the API call itself failed - check the error text, which usually names the problem (billing, content policy, or a rate limit).

One honest caveat: Grok's image model is good at following instructions and rendering text, but it's not the same tool as a local SDXL checkpoint. Don't expect fine-grained style control - no LoRA, no ControlNet. This node is for when you want a capable hosted model inside your graph, not for squeezing a specific aesthetic out of it.

CategoryERPK/Grok

Inputs (6)

NameTypeDefaultDescription
promptSTRINGDescription of the image to generate.
clientoptGROK_API_CLIENTGrok API client from Grok API Client node. If not connected, resolves from ComfyUI Settings or environment.
modeloptCOMBOgrok-imagine-imageGrok image generation model.
aspect_ratiooptCOMBO1:1Aspect ratio of the generated image.
resolutionoptCOMBO1kOutput resolution: 1k (~1024px) or 2k (~2048px).
noptINT11–4Number of images to generate.

Outputs (1)

NameTypeDescription
imageIMAGE