Prompt Generator Kill Switch
A node that turns your LLM server off for you
- value
- value
If you've ever run a local LLM prompt generator, you know the problem this node solves: the model stays loaded in memory after it's done. The llama-server process keeps eating RAM and VRAM, and your next image generation - the thing you actually wanted to do - has less room to breathe. Prompt Generator Kill Switch (class PromptGeneratorKillSwitch) is a pass-through node that also shuts the server down as it passes.
How it works
The mechanics are exactly what the name says, split across two inputs:
- value - any input, passed through unchanged. You can string this node anywhere in a graph and it won't alter the data; it's a "stop the server when this point in the workflow runs" marker.
- ollama_model - an optional model name to unload from Ollama. Leave it empty and it uses the preferred model from the pack's settings; if you're on the llama.cpp backend it just kills the llama-server process.
On execution it stops the Prompt Generator's llama-server (and kills any stray llama-server processes), optionally unloads the Ollama model from memory, and returns your value untouched. It's a one-shot cleanup: place it late in the workflow, after the prompt generation has happened, so the memory is freed before the sampler starts.
Why it's useful
Local LLM prompt generation and diffusion sampling compete for the same scarce resources. A 9B Q4 GGUF model sitting in memory while you try to run SDXL or Flux is a real loss of headroom, and on a modest card it can push you into OOM territory mid-generation. Instead of manually killing llama-server from a terminal between runs, you wire the kill switch into the end of the prompt-generation segment of your workflow and let it clean up automatically. The pass-through means it also works as a structural marker - you can drop it at a logical boundary (say, after the prompt is finalized) without adding any actual data flow.
Wiring and install
Connect whatever you want to survive (a prompt string, an options payload, anything) to value, route value out to where it needs to go, and run the workflow. It's part of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/FranckyB/ComfyUI-Prompt-Manager.git
cd ComfyUI-Prompt-Manager
pip install -r requirements.txt
Or ComfyUI Manager → search "Prompt Manager", then restart ComfyUI.
Gotchas
The trade-off is that it's destructive in the "can't use the LLM again this session" sense: once the server is stopped, the next prompt generation has to relaunch llama-server and reload the model, which takes time. So don't put it in a loop or at the start of a workflow that generates prompts repeatedly - put it at the end, once. Also, "kills llama-server" is blunt: if you have other llama.cpp processes you care about, this will kill them too. And it only makes sense if you're actually using the Prompt Generator - for the prompt library and recipe features alone, there's nothing running to stop, so the node is a no-op.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | * | Any input value to pass through unchanged. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | * | — |