Anima LLM Prompt Rewriter
A local LLM that turns Danbooru tags into the prose Anima actually wants
- final_prompt
- char_1_raw
- char_2_raw
- background_raw
If you've ever watched two anime characters come out with each other's hair colors, you know the exact problem this node exists to solve. Danbooru tags are precise but dumb - blue_hair, red_hair, witch_hat gives the model no way to know which attribute belongs to which character, so during denoising the features compete and bleed across both figures. Anima, being built on Cosmos-Predict2 with a Qwen3 text encoder instead of CLIP, actually understands natural language and can bind attributes to characters in a sentence. The catch: your WD14 tagger and every workflow you've copied still hand you tags.
Anima LLM Prompt Rewriter is the translator between those two worlds. You feed it booru-style tags split into character 1, character 2, background, and scene-and-action, and it uses a local LLM to rewrite them into a natural English prose prompt with clear subjects and verbs - the format Anima's encoder is genuinely good at. The name is not a lie: it really does run an LLM, no API key, no cloud call. But the honest framing is that it's a bridge for people already fluent in tags, not a magic prompt box.
How it actually works
The node splits your input into labeled buckets and builds a user message like Character 1 Tags: ... / Character 2 Tags: ... / Background Tags: ... / Scene & Action Tags: ..., then sends it to the LLM with a default system prompt casting the model as a strict prompt translator.
The clever part is the hybrid execution. On every run it pings 127.0.0.1:8080/health. If a llama-server is already running there, it goes API mode and talks to it over HTTP - and this is the gotcha to know about: even if you picked a local GGUF in the dropdown, a live server wins and the node overrides to API mode. Its stated reason is VRAM safety, and it's right. If no server is up, it goes standalone mode, loading your chosen GGUF in-process via llama-cpp-python (n_gpu_layers=-1, 2048 context), translating, then immediately del-ing the model and clearing the CUDA cache so the image model gets the VRAM back.
Everything is designed to fail soft. Flip enable_llm off and it just passes through your manual_prompt (or the raw tags, comma-joined) untouched. The LLM errors out, the model file is corrupt, the server's down? Same fallback. Nothing stops your workflow mid-run.
The inputs and outputs that matter
enable_llm- the on/off bypass. Off means pass-through, no model loaded.model_choice- dropdown listing[API] LLAMA-SERVER (127.0.0.1:8080)plus every.ggufit finds inComfyUI/models/LLM/(auto-created on first run).char_1_tags,char_2_tags,background_tags,scene_and_action- the raw tag inputs; fill as many as you have.temperature- default 0.1, and keep it low. This is a translation job, not a brainstorm.manual_prompt- your fallback text when LLM is off or failing.
Outputs: final_prompt (the prose), plus char_1_raw, char_2_raw, background_raw. The trio is the safety valve - blanked when the LLM succeeds so downstream text-combine nodes don't double the prompt, repopulated with originals on fallback. Wire final_prompt into a text combine or straight into CLIP Text Encode.
Installing it
The easy route: ComfyUI Manager → search ComfyUI-Anima-Prompt-Rewriter → install, then restart. The not-so-easy part is the LLM itself, because this is a tool for people who already have a local-LLM setup. You need:
- A small GGUF (4B–8B, Q4–Q8, e.g. Gemma-2-9B or Llama-3-8B) in
ComfyUI/models/LLM/. llama-cpp-python. Manager installs the plain pip package, which is CPU-only in practice. For GPU, do it manually in the VS Native Tools prompt:
set CMAKE_ARGS=-DGGML_CUDA=on
.\python_embeded\python.exe -m pip install --no-cache-dir --force-reinstall "llama-cpp-python>=0.3.23"
That needs CUDA Toolkit and CMake installed. If you'd rather keep the LLM entirely out of ComfyUI's VRAM, run llama-server.exe -m <model.gguf> -c 2048 -ngl 99 --port 8080 in its own terminal and select the API entry. Heads up: the README is in Korean, so if you hit it raw, that's why half the page is emoji-logs.
Common issues
- Empty model dropdown - the file isn't a lowercase
.ggufinsidemodels/LLM/. Double-check the extension. - OOM during standalone use - an 8B Q8 alongside your image model is a lot. Go smaller/Q4, or switch to API mode where the LLM lives in its own process.
- "API server is off" fallback when you picked the API option -
llama-serverisn't actually listening on 8080, or the firewall is eating localhost. - Silent mode override - a server you forgot about on 8080 will hijack your chosen local model. It's intentional, but it can look like the dropdown is lying.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| enable_llm | BOOLEAN | true | — |
| manual_prompt | STRING | — | |
| model_choice | COMBO | 1 options: [API] LLAMA-SERVER (127.0.0.1:8080) | |
| temperature | FLOAT | 0.100–2 | — |
| top_p | FLOAT | 0.900–1 | — |
| system_prompt | STRING | You are a strict prompt translator... | — |
| char_1_tags | STRING | — | |
| char_2_tags | STRING | — | |
| background_tags | STRING | — | |
| scene_and_action | STRING | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| final_prompt | STRING | — |
| char_1_raw | STRING | — |
| char_2_raw | STRING | — |
| background_raw | STRING | — |