Nodes/ComfyUI-PromptsO/💀Text with Grok
ComfyUI Node

💀Text with Grok

The Grok text node that drops an LLM into your ComfyUI graph

By S4MUEL-404·Created 11 months ago·Updated 10 months ago· 3
💀Text with Grok
  • images
  • text
system_prompt
user_prompt
api_key
modelgrok-4-latest
max_tokens2048
temperature0.7
top_p0.95
seed0

💀Text with Grok is the flagship of the S4MUEL-404/ComfyUI-PromptsO pack: a node that calls the xAI Grok chat API from inside ComfyUI and hands you the reply as a string you can wire straight into your prompt encoder. If your workflow already has a local model, a sampler, and a VAE, this is the node that adds "a small language model that writes your prompts for you" without you leaving the graph or pasting text between tabs.

The obvious use is prompt generation. Feed it "a cyberpunk street scene at night, neon reflections, cinematic" and have it expand that into something richer - then send the text output into a CLIP Text Encode node. One honest caveat: what you get out is only as good as what the target model wants. On SDXL-lineage models (Illustrious, NoobAI, Pony) it helps to instruct the system prompt to reply in comma-separated booru tags; on the newer chat-template models (Z-Image, Flux 2, Anima) a plain prose paragraph is exactly right. The system prompt is where you set that, and it's worth doing.

How it works

Under the hood this is a plain OpenAI-compatible chat completion. The node posts your system_prompt and user_prompt to https://api.x.ai/v1/chat/completions with your api_key in an Authorization header. If you wire the optional images input, it base64-encodes the image as JPEG and sends it along as an image_url message - so yes, this one can see your reference image, not just read your prompt. It waits for the JSON response, pulls out the choices[0].message.content, and returns it as the single text (STRING) output.

Two details worth knowing before you hit run. First, the seed is only sent to the API when it's greater than zero - keep it at 0 and you get the provider's nondeterministic behavior, which honestly suits a text-writing node. Second, the node writes every result to a disk cache (a cache/ folder inside the pack, keyed by an md5 of your inputs). Rerun with the same params and you'll see 💾 Using cached result for seed in the console and get the exact same text back without spending tokens. That's usually a feature, but it can confuse you when you want a fresh answer - change the seed or nudge any parameter and the key changes.

The inputs that matter

  • api_key - paste your xAI key here. There's no env-var fallback; the node validates it's non-empty and fails loudly if it isn't.
  • model - defaults to grok-4-latest, and the dropdown includes grok-4-base, grok-2-latest, grok-2-base, and grok-2-1212. The 2.x models are cheaper if you're just rewriting prompts.
  • max_tokens (2048 default) and temperature (0.7) - for prompt writing, most people dial temperature up a touch and leave tokens alone.
  • images (optional) - the reference-image input that turns this into a vision node.

Install

It's part of the ComfyUI-PromptsO pack, so install once and you get all twelve nodes:

cd ComfyUI/custom_nodes/
git clone https://github.com/S4MUEL-404/ComfyUI-PromptsO.git
cd ComfyUI-PromptsO
pip install -r requirements.txt

Restart ComfyUI. Or use ComfyUI Manager and search for "PromptsO" or "S4MUEL" - the README recommends Manager, and it's the safer route because it picks up the requirements install for you. The pack pulls in requests, pillow, numpy, torch, transformers, and - the heavy one - the Janus repo from GitHub, which only matters if you also use the 💀Prompts from Janus Pro node. For the API nodes alone you could skip most of that and live with just requests and pillow.

Common issues

  • "API key cannot be empty" - you really did leave it blank. There's no .env support, so the key lives in the workflow JSON. Handy for portability, a privacy consideration if you share workflow files; the README's selling point is that nothing is stored server-side and you bill direct.
  • 401/403 errors - key is wrong, expired, or out of credits at xAI. Nothing the node can fix.
  • Same text back no matter what you change - check the console for the 💾 Using cached result line. It's the cache, not the API, and it's working as designed.

It's a small pack from a small author, so don't expect a huge support community around it - but the mechanism here is dead simple and the code is readable, which is about as much as you can ask of an API wrapper.

Category💀PromptsO

Inputs (9)

NameTypeDefaultDescription
system_promptSTRINGSystem instruction for the AI
user_promptSTRINGUser prompt for Grok
api_keySTRINGYour Grok API Key
modelCOMBOgrok-4-latestChoose Grok model
max_tokensINT20481–32768Maximum number of tokens to generate
temperatureFLOAT0.70–2Sampling temperature (0.0 = deterministic, 2.0 = very random)
top_pFLOAT0.950–1Top-p sampling threshold
seedINT00–2147483647Random seed for reproducible results (32-bit limit for Grok API)
imagesoptIMAGEOptional reference images

Outputs (1)

NameTypeDescription
textSTRING