Grok Image Generation
Grok images without leaving ComfyUI — and n up to 4 costs the same
- client
- image
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 descriptionaspect_ratio- pick from the dropdown (default1:1)resolution-1k(~1024px) or2k(~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.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Description of the image to generate. | |
| clientopt | GROK_API_CLIENT | Grok API client from Grok API Client node. If not connected, resolves from ComfyUI Settings or environment. | |
| modelopt | COMBO | grok-imagine-image | Grok image generation model. |
| aspect_ratioopt | COMBO | 1:1 | Aspect ratio of the generated image. |
| resolutionopt | COMBO | 1k | Output resolution: 1k (~1024px) or 2k (~2048px). |
| nopt | INT | 11–4 | Number of images to generate. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |