Prompt Rewriter
A Local LLM That Turns Your Rough Idea Into a Grown-Up Prompt
- options
- output
You know the feeling: you've got a rough idea - "woman drinking wine in a neon bar, moody" - and you're staring at the prompt box hoping the model fills in the rest. This node is that fill-in-the-rest step, except a real LLM does the writing, entirely on your machine. No API key, no subscription, no censored front door. Type the rough idea, get back a structured, detailed prompt.
PromptRewriterZ is the main node in the ComfyUI-Prompt-Rewriter pack, a community fork of FranckyB's ComfyUI-Prompt-Manager with a pile of enhancements folded in. It belongs to the "local LLM as a ComfyUI node" pattern that went from fringe to routine recently: keep a small language model around not to generate images, but to write the text that conditions them. That fits 2026's models especially well. If your checkpoint's encoder is itself an LLM reading an instruction (Qwen3 on Z-Image, the T5-class encoders on Flux), then having a second LLM write that instruction is just translation between two things that speak the same language.
How it works
Under the hood it's not magic, it's llama.cpp. When you run the node it spawns a llama-server subprocess on localhost:8080, loads your chosen GGUF, sends it your prompt wrapped in a fixed system prompt, and returns the rewritten text. The default system prompt is the interesting part: it tells the model to lock in your core elements (subject, quantity, actions, any named characters or colors), then flesh out composition, lighting, materials, color, and spatial depth - and to output only the finished prompt, no preamble, no "here's your enhanced prompt:", no meta tags like "8K" or "masterpiece". That hard constraining is exactly what separates a usable enhancer from one that dumps chat scaffolding into your conditioning. It caches the last result keyed on prompt + seed + options, so identical reruns are instant.
The inputs that matter
The node itself is deliberately thin - model and sampling live in the Options node it ships with. Four required inputs:
- prompt - your rough idea. Multiline, so paste as much as you like.
- seed - set it once and the rewrite is reproducible, same as anywhere else in ComfyUI.
- backend -
CUDAorVulkan. CUDA uses a llama.cpp build bundled into allama_binaries_*folder; Vulkan uses allama-serveron your system PATH and works on any GPU, AMD and Intel included. - options - wire this to a Prompt Rewriter Options node. Technically required, and nearly useless without it, because model selection lives there.
Optional flags worth knowing: show_everything_in_console prints the system prompt, your prompt, the thinking trace, and the raw model response to your console - the first thing you'll switch on when a rewrite goes sideways. keep_mmproj_loaded and stop_server_after are VRAM-versus-speed dials for vision models.
The output is a single STRING named output. Wire it into a text display (rgthree's Display Any is the usual choice) to see what it wrote, or feed it straight into the positive prompt / text encode of your sampler. On an LLM-encoded checkpoint a rewritten natural-language prompt slots right in. People reach for it for video too, enhancing prompts for Wan and LTX workflows.
Install
ComfyUI Manager (search "ComfyUI-Prompt-Rewriter"), or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/BigStationW/ComfyUI-Prompt-Rewriter
Then install the Python deps - it's a light requirements file, just requests, huggingface_hub, and psutil:
..\..\..\python_embeded\python.exe -s -m pip install -r "requirements.txt"
The heavier step is the backend. On Windows, winget install llama.cpp gets you the Vulkan build (works on everything); for NVIDIA there's an "Install llama.cpp (CUDA).bat" in the repo that grabs the official release and unpacks it. Finally, drop a GGUF model into ComfyUI/models/LLM/gguf (the node creates that folder if it doesn't exist). Qwen3-4B instruct or its thinking variant are the README's suggestions; any instruct or reasoning GGUF works.
Where people get burned
Most common failure is a missing llama-server: if the backend can't find one, you get an error pointing back at the install instructions - the node does not bundle a server for you. The first run is also slow, because it loads a multi-gigabyte model before your first rewrite, and it holds port 8080, so if something else is already squatting there, shut it down. Be honest about the VRAM math too: the LLM shares your card with the diffusion model, so on 8GB you're picking a small quant, not the 8B. One quirk worth knowing: the "models with ⬇ auto-download" behavior the tooltip mentions isn't active in the current code, so treat the model list as "whatever you put in the folder." And since this node runs a downloaded binary and arbitrary GGUF weights, it's the exact category of thing worth getting from a repo you trust - the bat pulls from official ggml-org/llama.cpp releases, the right source, but skim it anyway.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Enter the prompt you want to embellish | |
| seed | INT | 00–18446744073709550000 | Seed for reproducible generation. |
| backend | COMBO | CUDA | Backend: CUDA (local llama_binaries) or Vulkan (system PATH llama-server) |
| options | OPTIONS | Connect options node to control model and parameters | |
| show_everything_in_consoleopt | BOOLEAN | false | Print system prompt, user prompt, thinking process, and raw model response to the console. |
| keep_mmproj_loadedopt | BOOLEAN | true | Keep mmproj loaded between runs to avoid server restarts (uses more VRAM) |
| stop_server_afteropt | BOOLEAN | false | Stop the llama.cpp server after each prompt (for resource saving, but slower). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | STRING | — |