Nodes/ComfyUI-YogurtNodes/Grok Generate Image
ComfyUI Node

Grok Generate Image

Closed-source image gen inside ComfyUI, with zero local VRAM spent

By yogurt7771·Created 2 years ago·Updated 9 days ago· 1
Grok Generate Image
  • image
  • image1
  • image2
  • image3
  • image4
  • history
  • image
  • text
  • history
api_key
base_url
model_namegrok-imagine-image
system_prompt
prompt
aspect_ratioauto
resolutionauto
n1
response_formaturl
retry_count1
chat_template<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->
proxy_url
seed-1
timeout0
extra{}

xAI's Grok image generation doesn't run on your GPU - it runs on xAI's servers, which means the only thing this node needs from your machine is a network connection and an API key. Grok Generate Image takes a text prompt, calls the xAI API, and returns the generated image as a normal IMAGE tensor plus the model's text response. No model download, no VRAM pressure, no diffusion pipeline - it's a cloud call wearing a node's clothes.

The context makes the appeal concrete. Grok's image model has a reputation in the community for being unusually unrestricted (the KB's closed-source roundup has it as the least restrictive of the big commercial image models, with everyone early on suspecting it was secretly Flux under the hood), and because it's an API, it runs on hardware that could never dream of local generation. Real people use exactly this pattern on 8GB laptops and old cards - research threads show Grok-image-in-ComfyUI being used as the way to get strong closed-source generations on a 3050. If you want that capability piped into a workflow as a graph object, this is the node.

How it works

It builds a chat-style request and sends it to the xAI API (default model grok-imagine-image, or grok-4 for text-style replies). The chat_template field controls how your system_prompt and prompt get wrapped into the request - the default uses <-system-> / <-user-> tags, and you can edit it to match xAI's current template format. You get controls for aspect_ratio and resolution (both default "auto"), how many images to produce (n, up to 10), seed for reproducibility, and response_format (default "url" - the node downloads the returned image URL and decodes it to a tensor). There are optional image / image1-image4 inputs if you want image-editing or reference workflows, plus history and an extra JSON field for new API params.

The inputs that matter

  • api_key - your xAI key. Leave it blank and the node falls back to the XAI_API_KEY/GROK_API_KEY env vars or an api_key.json entry - which is the more sensible way to store it.
  • prompt - the actual generation prompt.
  • system_prompt - sets overall style; useful for a consistent look across many generations.
  • aspect_ratio / resolution / n / seed - the generation controls you'll touch most.

Three outputs: image (the generated tensor), text (the model's text reply), and history (for chaining into conversation).

Installing it

It's part of ComfyUI-YogurtNodes. Install via ComfyUI Manager (search "ComfyUI-YogurtNodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt

Restart ComfyUI; it's under "Yogurt Nodes". You need an xAI API key - a paid account at console.x.ai.

Where people get burned

The chat_template is the sharp edge: if xAI changes their prompt format, an old template can silently produce degraded results - if generations start looking off, check whether the template still matches the API docs. Watch your usage cost too; image generation bills per request and a looping workflow adds up. And when the node errors with an auth message, remember the key lookup order: the api_key field wins, then the config file, then environment variables - an empty field doesn't mean "no key anywhere", it means "keep looking".

CategoryYogurtNodes/LLM

Inputs (21)

NameTypeDefaultDescription
api_keySTRINGAPI key for accessing xAI API
base_urlSTRINGBase URL for xAI API (leave blank for official API)
model_nameSTRINGgrok-imagine-imagexAI image generation model name
system_promptSTRINGSystem-level prompt that affects the overall image generation style
promptSTRINGMain prompt content for image generation
aspect_ratioCOMBOautoAspect ratio for generated images
resolutionCOMBOautoResolution for generated images
nINT11–10Number of images to generate
response_formatCOMBOurlResponse format for generated images
retry_countINT1Number of retries when request fails
chat_templateSTRING<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->Content template for the image generation prompt
proxy_urlSTRING代理URL,格式: protocol://user:pass@addr:port,支持http,https,socks5,socks5h
seedINT-1-1–2147483647Random seed for generation (-1 for random)
timeoutINT00–2147483647Timeout for the request in seconds, 0 means no timeout
imageoptIMAGE
image1optIMAGE
image2optIMAGE
image3optIMAGE
image4optIMAGE
historyoptHISTORY
extraoptSTRING{}Extra parameters for the request, in JSON format

Outputs (3)

NameTypeDescription
imageIMAGE
textSTRING
historyHISTORY