ComfyUI-Anima-Prompt-Rewriter Introduction
ComfyUI-Anima-Prompt-Rewriter is a custom ComfyUI node that turns lists of character and background tags into a natural-language English image prompt. It uses a local language model, or LLM, to describe who is in a scene, what each character looks like, and what is happening.
This is particularly useful when you work with two characters. A tag list can leave it unclear which hair color, outfit, or action belongs to which person. By giving the rewriter separate inputs for each character, the background, and the scene, you give it a better chance of expressing those relationships clearly. Clearer wording may reduce concept bleeding, where one character picks up another character’s features, although the final image still depends on your image model and workflow.
The node also gives you a way to keep working without a rewrite. When rewriting is switched off, or when it cannot produce a result, it passes your manual prompt and original tags to its outputs.
How ComfyUI-Anima-Prompt-Rewriter Works
Think of the node as a scene-description assistant. You provide the ingredients in separate groups:
- Character 1 tags: What the first person looks like.
- Character 2 tags: What the second person looks like.
- Background tags: Where the scene takes place and what surrounds the characters.
- Scene and action: What is happening and how the characters interact.
For example, separate tags for a red-haired character, a black-haired character, a café, and a shared action give the language model more context than one undivided list. It can then write a sentence that names each character and describes the setting and action. The result is an English text prompt, not an image; you connect that text to the later prompt-processing nodes in your ComfyUI workflow.
The node can obtain the rewrite in two ways:
- Local model: It loads a selected
.gguflanguage-model file within ComfyUI to generate the text. Afterward, it attempts to release the model and clear cached GPU memory so the image-generation steps have more room to run. - Local API server: It sends the request to a running
llama-serverat127.0.0.1:8080and receives the generated text. This keeps the language model outside the ComfyUI process, but the server can still use your computer’s memory and GPU resources.
The node checks for the server and supports a fallback when rewriting is unavailable. Neither approach guarantees that an image will be free of mixed-up attributes or memory errors.
ComfyUI-Anima-Prompt-Rewriter Features
Separate inputs for clearer scenes
The char_1_tags, char_2_tags, background_tags, and scene_and_action inputs keep different parts of your idea distinct. When preparing a two-person scene, put each person’s appearance in their own character input and use scene_and_action for their interaction. This gives the rewriter a clearer basis for assigning details in its prose.
Control over the rewrite
| Input | What it does | When you might change it |
|---|---|---|
enable_llm | Turns language-model rewriting on or off. | Turn it off to use your manual prompt and original tags instead. |
manual_prompt | Supplies the text sent to final_prompt when rewriting is off or falls back. | Write your own detailed description when you want direct control over the wording. |
model_choice | Selects an available .gguf model or the API-server option. | Try a different model if the prose or resource use does not suit your workflow. |
temperature | Adjusts how varied the model’s wording may be. The documented default is 0.1. | Keep it low for more consistent tag-to-prose rewriting; a higher value may produce more variation. |
top_p | Adjusts the range of word choices considered during generation. The documented default is 0.9. | Change it if you are experimenting with how predictable or varied the result feels. |
system_prompt | Gives the language model its overall instructions, such as how to act as a prompt rewriter. | Refine the instructions when you need a different writing approach. |
Changing temperature, top_p, or system_prompt can affect the text the LLM writes, but the exact effect depends on the model you choose.
Model discovery
The node looks for .gguf files in ComfyUI’s models/LLM folder, including its subfolders, and displays discovered files in the model_choice menu using shorter paths such as LLM/gemma.gguf. The original documentation says the folder is created automatically if it does not already exist. A model file must still be present for local rewriting.
Fallback and output routing
The node has four text outputs. Their contents change depending on whether the rewrite succeeds:
| Output | When rewriting succeeds | When rewriting is off or fails |
|---|---|---|
final_prompt | The generated English description. | Your manual_prompt. |
char_1_raw | Empty text (""). | The original Character 1 tags. |
char_2_raw | Empty text (""). | The original Character 2 tags. |
background_raw | Empty text (""). | The original background tags. |
Emptying the raw-tag outputs after a successful rewrite helps prevent those tags from being added a second time later in your workflow. If rewriting cannot run, the fallback preserves those three tag groups for a workflow that combines raw tags. There is no separate scene_and_action raw output in the documented output list, so check how your workflow handles that input when relying on fallback.
ComfyUI-Anima-Prompt-Rewriter Models
The extension does not list bundled models. Instead, model_choice can show the .gguf files available in your ComfyUI models/LLM folder, as well as an API-server choice. The original documentation mentions Gemma-2-9B and Llama-3-8B as examples of model families, not as models included with the extension.
A .gguf file is a format used to run a language model locally. A quantized version, such as a Q4 file, generally uses less memory than a larger version of the same model, though its writing may differ. The original documentation suggests considering models in roughly the 4B–8B size range with Q4–Q8 quantization. Choose according to the memory available on your computer and the quality you prefer in test rewrites.
The [API] LLAMA-SERVER (127.0.0.1:8080) choice uses the model already running in that local server. Selecting it does not choose or start a server model for you. If you compare results between a local-file choice and the API choice, remember that the underlying models may be different.
Troubleshooting ComfyUI-Anima-Prompt-Rewriter
I get an out-of-memory error
- Check whether you are using a local
.ggufmodel while your image-generation model also needs GPU memory. - Try a smaller model file, such as a Q4-quantized version.
- If you use
llama-server, check its GPU memory use as well. Running it separately from ComfyUI does not remove its hardware requirements. - Run the workflow again and watch the ComfyUI console to see which step reports the error.
The node attempts to free resources after a local rewrite, but available memory still depends on the models and other programs you are running.
My model does not appear in model_choice
- Confirm that the file is in
ComfyUI/models/LLMor one of its subfolders. - Check that its filename ends in lowercase
.gguf, as specified in the original documentation. - Reopen or refresh the node’s model choices after placing the file, and check whether the model appears.
The API choice falls back instead of rewriting
- Confirm that the
llama-serverprocess is running and has loaded a model. - Check that it is listening on port
8080, which is the port the node expects. - Check that local connections to
127.0.0.1are not being blocked. - Look at the server and ComfyUI console messages for a more specific error.
The rewrite does not appear in my image prompt
- Check that
enable_llmis on and thatfinal_promptis connected to the part of your workflow that processes the prompt. - Inspect the node’s outputs. If
final_promptcontains yourmanual_promptand the raw-tag outputs contain tags, the node is using its off/fallback route. - Check the ComfyUI console for progress or error messages, then verify the selected model or server.
Frequently asked questions
Can I use the node without an LLM rewrite?
Yes. Set enable_llm to off. The node passes manual_prompt to final_prompt and preserves the documented raw-tag outputs.
Will it prevent every character detail from getting mixed up?
No. Separating character inputs and rewriting them as clear sentences can help, but the image model may still interpret a prompt differently than you intend.
Why are my raw-tag outputs empty?
That is the documented behavior after a successful rewrite. It helps avoid including the same details twice when later nodes combine text.
Does the API option make GPU memory problems impossible?
No. The language model runs outside ComfyUI, but the server may still use the same GPU and compete for its memory.
Learn More about ComfyUI-Anima-Prompt-Rewriter
If you want to understand the separate-server option, the llama.cpp project is the resource linked in the original documentation. For day-to-day art workflows, the most useful way to assess this node is to compare a few rewrites against your original tags: check whether each character keeps the right attributes, whether the action is clear, and whether the resulting image matches your intended scene.
