AI Danbooru Prompt Generator (OpenAI/OpenRouter)
An LLM that writes Danbooru-ordered prompts — but it needs a key
- generated_prompt
- status
Let's get the one thing that matters out of the way: this is the only node in the whole pack that calls out to the internet, and it needs a paid API key. The rest of the pack is local, dependency-free, and offline-friendly. This one is the odd one out - and it's also the one with the 25 impressions in search, because people are always looking for a way to get an LLM to write their Danbooru prompts for them.
The pitch is simple: you describe what you want, and a language model returns a ready-to-paste prompt in proper Danbooru order - quality tags first, then character count, character, series, artist, and general tags last. That ordering isn't decoration. The KB's notes on the anime ecosystem hammer this home: Danbooru-trained models like Illustrious, NoobAI, and Anima understand real tags far better than invented ones, and the position of a tag in the prompt matters because earlier tokens get stronger attention on CLIP models. This node exists to enforce that discipline so you don't have to.
How it works
It builds a strict system prompt around two templates you can edit, then calls an OpenAI-compatible chat/completions API. The tag_order_template defaults to [quality/meta/year/safety tags] [1girl/1boy/1other etc] [character] [series] [artist] [general tags] - that's the ordering Anima's own model card recommends, which is a nice touch. The general_tag_order template drills into the last bucket: hair color, eye color, hairstyle, clothing, accessories, expression, pose, background, lighting, view angle, and so on.
The model call is routed by provider (openai or openrouter), with model defaulting to gpt-4.1-mini. The api_key input overrides the OPENAI_API_KEY or OPENROUTER_API_KEY environment variable - leave it empty if you've already exported one. And custom_base_url is the escape hatch: point it at any OpenAI-compatible gateway, including a local one, if you'd rather not pay per generation.
Inputs worth setting
- user_requirement and source_prompt - you need at least one of them. The node refuses politely with
missing input: provide user_requirement or source_promptin its status output. The second is optional but recommended: give it your existing prompt and it'll clean and reorder it instead of starting from a description. - target_format - note the constrained menu:
SD,NAI3,NAI4. NoSD(anima)or NewBie here; the AI node stays in the weight-dialect world. - temperature - default 0.2 is the right neighborhood. LLM tag-writing gets sloppy fast when you crank it; you want the same answer for the same input.
Outputs
generated_prompt is your prompt. status is the diagnostic: ok when things worked, or an error string when the API call failed or the model name is empty. This is important - failures don't throw, they come back in the status output. If your generated prompt comes out empty, read status before you blame the node.
Install and gotchas
Install is identical to the rest of the pack - ComfyUI Manager search "ComfyUI-Prompt-Format-Converter", or git clone https://github.com/zisonMyu/ComfyUI-Prompt-Format-Converter into custom_nodes, then restart. No Python deps; the API call uses the standard library.
Where people get burned: they expect magic. A generic GPT model knows Danbooru conventions from training but will still invent tags that aren't real, and it has no idea what your specific NoobAI or Illustrious checkpoint actually responds to. Treat the output as a strong draft to sanity-check, not gospel. And watch your key - putting it in the node's api_key field stores it in the workflow JSON, so if you share workflows, prefer the environment variable instead.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| provider | COMBO | 2 options: openai, openrouter | |
| model | STRING | gpt-4.1-mini | — |
| user_requirement | STRING | — | |
| source_prompt | STRING | — | |
| target_format | COMBO | 3 options: SD, NAI3, NAI4 | |
| tag_order_template | STRING | [quality/meta/year/safety tags] [1girl/1boy/1other etc] [character] [series] [artist] [general tags] | — |
| general_tag_order | STRING | hair color, eye color, hairstyle, topwear, bottomwear, socks/shoes, accessories, expression, action/pose, shared multi-character action, background, lighting, view angle, composition, atmosphere/effects | — |
| temperature | FLOAT | 0.200–1.2 | — |
| max_tokens | INT | 1400200–4000 | — |
| api_key | STRING | — | |
| custom_base_url | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| generated_prompt | STRING | — |
| status | STRING | — |