ComfyUI Node
Better Grok
Generate images or text with xAI Grok using xAI's image generation and chat completion APIs.
Better Grok
- prompt_images
- IMAGE
- STRING
◄prompt►
◄modelgrok-imagine-image►
◄response_modalitiesIMAGE►
◄api_key►
◄reasoning_effortnone►
◄aspect_ratioauto►
◄resolutionauto►
◄n1►
◄cache_outputsfalse►
Categoryapi node/image/BetterGrok
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Text prompt for image generation or image editing. | |
| model | COMBO | grok-imagine-image | xAI model name. The dropdown merges image and language models when XAI_API_KEY is available. |
| response_modalities | COMBO | IMAGE | Choose IMAGE output for Grok image generation, IMAGE+TEXT to keep image generation plus node notes, or TEXT to call Grok responses and return the result through STRING. |
| api_keyopt | STRING | Optional. If empty, uses env var XAI_API_KEY. | |
| reasoning_effortopt | COMBO | none | Reasoning effort for Grok text requests. Image generation ignores this setting. |
| prompt_imagesopt | IMAGE | Optional reference/edit images. IMAGE modes send them to xAI's edits API; TEXT mode sends them as chat image inputs. | |
| aspect_ratioopt | COMBO | auto | If 'auto', xAI chooses. Otherwise requests a specific aspect ratio supported by Grok image generation. |
| resolutionopt | COMBO | auto | Requested output resolution (best-effort). Logs a warning if the returned image size doesn't match. |
| nopt | INT | 11–10 | Number of output images to request. xAI documents a maximum of 10 images per request. |
| cache_outputsopt | BOOLEAN | false | Cache model outputs under .cache and reuse them for identical Grok requests. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| STRING | STRING | — |