AI Prompt Generator
Call an LLM to write your prompt
- ai_prompt
This node hands your idea to a large language model and gets back a full image prompt. You type something rough - a character, a scene, a vibe - and the LLM expands it into the kind of tag-heavy or descriptive prompt your checkpoint wants, then feeds that text straight into the rest of your graph. It's the "let the robot write the booru tags" button, and it lives in the WAI Character Select corner of ComfyUI_Mira, mirabarukaso's toolkit, where it pairs with the pack's anime/character selection nodes.
The important thing to be clear-eyed about: this one actually calls an external API, and you need a key. Plenty of "AI prompt" nodes run a local model or are glorified templating. This isn't - it hits a remote chat-completions endpoint. The default is Groq, whose API is fast and has a free tier, with the default model set to llama-3.3-70b-versatile. It speaks the OpenAI-compatible chat format, so you can point it at other providers too, but out of the box it's Groq, and nothing happens until you supply credentials.
How it works
It sends your prompt (plus an optional system prompt) to the endpoint at url using the named model, and returns the model's reply as ai_prompt. The random_action_seed nudges variety between runs so you don't get the same expansion every time, and timeout caps how long it waits on the network. The key itself does not go in a node field - per the pack docs you add your private API key to custom_nodes/ComfyUI_Mira/json/settings.json.
The inputs and outputs that matter
- url - the chat-completions endpoint (default Groq's).
- model - the model name (default
llama-3.3-70b-versatile). - prompt - your idea/instruction for the LLM.
- random_action_seed - varies the output run to run.
- timeout - seconds to wait before giving up (1–300, default 30).
- optional_system_prompt - set the LLM's role/style/rules (great for "output danbooru tags only, comma-separated").
- ai_prompt (output) - the generated text, into your CLIP Text Encode or a text combiner.
Installing it
ComfyUI Manager: search ComfyUI_Mira, install, restart. Or clone:
cd ComfyUI/custom_nodes && git clone https://github.com/mirabarukaso/ComfyUI_Mira.git
then restart. If it errors on load, run pip install -r requirements.txt in the ComfyUI_Mira folder. It's under Mira/WAI_Character_Select. Then add your API key to custom_nodes/ComfyUI_Mira/json/settings.json before using it.
Common issues
- No key, no output. The most common failure is simply not having set the key in
settings.json. If the node errors or returns nothing, check that first. - It needs the internet. This is a remote call. On an offline or firewalled machine - or a locked-down cloud runner that blocks outbound requests - it won't reach the endpoint. That's environmental, not a node bug. Raise
timeoutif the endpoint is just slow. - A system prompt is the difference between usable and useless. Without one you'll get chatty prose, not tags. Use
optional_system_promptto pin the format your model expects (comma-separated tags, no explanations, etc.). - Mind what a key in a JSON file means. Your credential sits in plaintext inside the custom-node folder. Don't paste that settings file into a shared workflow or screenshot, and remember that installing any custom node means running its code - Groq keys are cheap to rotate if you ever suspect one leaked.
- Model names drift. Providers rename and retire models; if you get a 404-style error, the
modelstring is probably stale. Check the provider's current model list and update it.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| url | STRING | https://api.groq.com/openai/v1/chat/completions | — |
| model | STRING | llama-3.3-70b-versatile | — |
| prompt | STRING | — | |
| random_action_seed | INT | 10240–18446744073709550000 | — |
| timeout | INT | 301–300 | — |
| optional_system_promptopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| ai_prompt | STRING | — |