APNext Universal Generator
One node, any LLM, to write your prompts
- generated_prompt
- model_used
- seed_used
Most nodes in this pack build prompts from random word lists offline. This one is the opposite: it hands your idea to an actual large language model and asks it to write the prompt for you. Point it at GPT, Gemini, Claude, Grok or Groq, type a rough idea into input_text, and it returns a fleshed-out prompt. It's the pack's take on LLM-assisted prompting, which has gone from a curiosity to a mainstream habit - the community now reaches for "have an LLM write the prompt" constantly, and this bakes it into the graph.
The reason it fits so well: on modern models the text encoder is an LLM reading your prompt as an instruction. Having another LLM write that instruction is a translation between two things that speak the same language. That's why this approach clicks on Flux, Z-Image and the rest, and why it's worth a node.
The one thing to get right first: it needs an API key
This node calls a paid, remote API. It will not work until you set the matching key as an environment variable before launching ComfyUI - OPENAI_API_KEY, GEMINI_API_KEY, ANTHROPIC_API_KEY (or CLAUDE_API_KEY), XAI_API_KEY, or GROQ_API_KEY. The default model is auto-detect, which picks whichever provider it finds a key for. No key, no output. And yes - your prompt text leaves your machine and goes to that provider, which is worth knowing if you care about that.
Inputs and outputs that matter
- input_text (multiline, required) - your rough idea. "a lonely lighthouse in a storm" becomes a paragraph.
- model -
auto-detect, or pin a specific one likegpt:gpt-5-miniorgemini:gemini-2.5-flash. The mini/flash tiers are cheap and plenty for prompt-writing. - generation_mode -
Creative,Balanced,Focused, orCustom. Balanced is the sane default; Creative wanders more. - randomize_each_run (default on) - gives you a different variation every execution, which is the point for exploration. Turn it off (and set a fixed
seed) when you want the same prompt back. - Optional: style_preference (Cinematic, Photorealistic, etc.), detail_level (Brief → Very Detailed), variation_instruction to steer how it varies, and temperature (leave at -1 for the model default).
Three outputs: generated_prompt (wire this into your CLIP Text Encode), model_used (which provider actually answered - handy with auto-detect), and seed_used.
Installing it
ComfyUI Manager: search comfyui_dagthomas, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/dagthomas/comfyui_dagthomas
cd comfyui_dagthomas
pip install -r requirements.txt
Those requirements matter here - openai, anthropic, google-generativeai are the SDKs this node actually uses. If the install skipped them, the provider you want will error at runtime.
Common issues
By far the most common failure is "the node does nothing" or an auth error, and it's almost always the API key: not set, set in the wrong shell, or set after ComfyUI was already running. Set it in the environment that launches ComfyUI, then restart ComfyUI fully - not just the node. Auto-detect erroring? It found no key at all.
Second: an invalid or renamed model string throws a provider error. The model dropdown reflects the pack's config files (gpt_models.json, claude_models.json, etc.); providers rename and retire models constantly, so if a specific one 404s, switch to another or update the pack. For pure prompt-writing you don't need a flagship - a mini/flash model is faster, cheaper, and indistinguishable in output. And remember every run costs a few fractions of a cent against your own account; leaving randomize_each_run on in a big batch will quietly rack up calls.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | STRING | — | |
| model | COMBO | auto-detect | 42 options: auto-detect, gpt:gpt-5, gpt:gpt-5-mini, gpt:gpt-5-nano, gpt:gpt-4.1, gpt:gpt-4.1-mini, +36 |
| generation_mode | COMBO | Balanced | 4 options: Creative, Balanced, Focused, Custom |
| seed | INT | -1-1–18446744073709550000 | — |
| randomize_each_run | BOOLEAN | true | — |
| custom_promptopt | STRING | — | |
| variation_instructionopt | STRING | Generate different creative variations each time while maintaining the core concept and style. | — |
| style_preferenceopt | COMBO | Any | 7 options: Any, Cinematic, Photorealistic, Artistic, Abstract, Vintage, +1 |
| detail_levelopt | COMBO | Detailed | 4 options: Brief, Moderate, Detailed, Very Detailed |
| temperatureopt | FLOAT | -1.0-1–2 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| generated_prompt | STRING | — |
| model_used | STRING | — |
| seed_used | STRING | — |