Universal LLM Prompt
Stuck on a prompt? This node makes GPT, Claude, Gemini, Groq or Mistral write it for you
- STRING
You know the moment. The checkpoint is loaded, the empty prompt box is staring back, and you've got a scene in your head but zero words for it. Universal LLM Prompt is the node that fixes that: type a rough idea like "girl sitting by a lake in early summer," and it hands the job to a hosted LLM - OpenAI, Anthropic/Claude, Google Gemini, Groq, or Mistral - which writes back a ready-to-use SDXL prompt.
The name is honest in one sense and misleading in another. It genuinely is universal across five providers, sharing one interface and one output. But it's not running anything locally: this is a pure API call. No model download, no VRAM, no GPU. It needs an API key and a bit of billable credit per run, and in exchange it does nothing to your machine's resources.
How it works
Under the hood the node is a single query. It wraps your input in a hardcoded system prompt that reads like a prompt-engineer's job description - "You are a professional prompt engineer for Stable Diffusion XL (SDXL)… Output the prompt as a single comma-separated line, with no explanations." - and it even dictates the tag order: girl, hairstyle, hair color, bangs, eye color, expression, body type, pose, situation.
That's the part worth understanding before you use it. This node is tuned for anime-style SDXL prompting. The example it ships is 1girl, long hair, blonde, straight bangs, blue eyes, smiling…, and the output is a booru-style tag string. That's a feature if your checkpoints are Illustrious/NoobAI/Pony lineage, where comma-separated tags are exactly what the CLIP encoder wants. It's a mismatch if you feed the result into a Flux-era or LLM-encoded model that wants sentences and structure - check what encoder your checkpoint is built on before wiring this up.
For the call itself, the node uses each provider's own SDK - and it's neat how it does it: OpenAI gets the openai client, and Groq and Mistral get the same client pointed at their OpenAI-compatible endpoints via a base_url override. Anthropic uses the anthropic SDK, Google uses google.generativeai. The output is always a single STRING, ready to wire into a CLIP Text Encode node.
The inputs that matter
Five required inputs, and only a few you'll actually touch:
- provider - pick from openai, anthropic, google, groq, mistral.
- model - a dropdown of that provider's models. This is the trap. The list is hardcoded in
llm_node.pyand it dates from early 2024:gemini-pro, Groq's llama2/mixtral era,gpt-4-turbo, Claude 3. Several of those IDs have since been retired or renamed on the provider side, and no new model (GPT-4o-mini, Claude 3.5/4, Gemini 2.x) is in the list. If your chosen model errors out, you'll be editingllm_node.pyto add its current ID - a five-minute job, but know it going in. - api_key - pasted straight into the node. The README is upfront that the standard ComfyUI interface doesn't mask it, and it gets saved into your workflow JSON. Treat shared workflows with this node in them the way you'd treat a pasted password.
- prompt - your scene or tag list. This is the raw material.
- max_tokens - default 300, which is plenty for a prompt line.
Installing it
ComfyUI Manager, search "Universal LLM Node for ComfyUI", or:
cd ComfyUI/custom_nodes
git clone https://github.com/R5-Revo/llm-node-comfyui
cd llm-node-comfyui
pip install -r requirements.txt
Then restart ComfyUI. Dependencies are just openai, anthropic, and google-generativeai - light, and Manager installs them for you. No model files anywhere.
Where people get burned
The failure mode to know: if the API call throws, the node doesn't error out - it returns a normal string like [LLM Error] AuthenticationError: ... straight out of the STRING output. Wire that into a CLIP Text Encode and your prompt box just silently fills with error text. Preview the output with a Show Text node before you commit it to the sampler.
Also keep the API-key leak in mind (workflow JSON, screenshots, streaming a graph on Twitch), and remember the tag-order output is a fixed anime-SDXL opinion - you can't retune the instruction without editing the source. For quick drafts on an anime checkpoint it's genuinely handy; for a general-purpose prompt tool that follows today's models, you'll outgrow it fast.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| provider | COMBO | 5 options: openai, anthropic, google, groq, mistral | |
| model | COMBO | 20 options: gpt-4o, gpt-4-turbo, gpt-4, gpt-3.5-turbo, claude-opus-4-20250514, claude-sonnet-4-20250514, +14 | |
| api_key | STRING | — | |
| prompt | STRING | — | |
| max_tokens | INT | 30050–4096 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |