LM Studio Prompt Enhancer
Let a Local LLM Write Your Prompts — No API Key, No Cloud
- input_image_1
- input_image_2
- enhanced_prompt
You type "futuristic sports car in the rain," and a local LLM hands back a full cinematic paragraph - camera angle, rim lighting, wet pavement reflections, depth of field - that your image or video model actually renders well. That's the whole job of LM Studio Prompt Enhancer, and it does it without touching the internet.
The name is slightly off, so let's clear that up first: this node doesn't run an LLM. It's a client that talks to LM Studio, the desktop app you already point at local GGUF models, through LM Studio's OpenAI-compatible API at http://127.0.0.1:1234/v1. It needs no key (a dummy lm-studio fallback satisfies local auth), downloads no model weights itself, and sends nothing anywhere unless you point lmstudio_base_url at a remote server. Privacy-wise it's about as clean as an LLM node gets.
This belongs to the pattern the community has thoroughly adopted: an LLM writes the instruction that the checkpoint's own encoder reads. On LLM-encoded bases like FLUX, Z-Image, or FLUX 3 Video, that's one language model translating for another, and prompt enhancer nodes went from a curiosity to a staple for exactly that reason. What distinguishes this one is the video half - it knows the difference between a prompt for an image and a prompt for a video model, which most enhancers still don't.
How it works
Inside, it's a thin wrapper over the official openai Python client pointed at your LM Studio server. model = auto asks LM Studio for its model list and grabs the first one; anything else is treated as an exact model ID. Two optional IMAGE inputs get converted to PNG, downscaled to a max 1024px side, and sent as base64 data URLs - which is why connected images work only if the model you've loaded in LM Studio is actually vision-capable. The node doesn't pre-check that; a text-only model just errors, and the error message is LM Studio's, not the node's.
One honest caveat: unlike the fancier local prompt nodes that hard-stop token IDs to keep chat scaffolding out of your prompt, this one trusts the LLM. The system prompt is where the discipline lives - "return one positive prompt, no markdown, no explanation." Small local models obey that well; some don't. If you see preamble or refusal text bleeding into your render, the model you chose is the problem, not this node.
The inputs that matter
You'll actually touch maybe five of these:
prompt- your rough idea. Real input socket, so ComfyUI's native bypass passes through.generation_mode- Image or Video. Changes what the two image inputs mean: in image modeinput_image_1is the base image andinput_image_2the reference; in video mode they're first frame and last frame.style- 30 presets fromcinematictoFPV action. Some are image-only (portrait photography) or video-only (tracking shot). Pick a conflict and the node errors before calling the LLM, telling you the compatible options.model-autoor an exact ID, if you run several and want determinism.temperature,max_tokens,enable_llm- the knobs. Drop temperature to 0.3 when it over-invents; setenable_llm = falsefor a pure passthrough that returns your original prompt untouched.
Less obvious but genuinely useful: cache_buster. ComfyUI caches node results, so the LLM won't re-run until an input changes - bump this integer to force a fresh completion. It's not sent to the model.
Wiring it up
The single output, enhanced_prompt (STRING), feeds the text-conditioning end of whatever model you're using - a CLIP text encode, a Flux prompt box, a video prompt node. The repo ships ready-made example workflows for FLUX, SDXL, Pony, Z-Image Turbo, KREA2, and FLUX 3 Video, plus model-tuned system prompts for each, which is where I'd start rather than guessing.
Install
In ComfyUI Manager, search "LM Studio Prompt Enhancer" and install, or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/AllenCraigBarnard/comfyui-lmstudio-prompt-enhancer.git
pip install -r requirements.txt # openai>=1.0.0, numpy, Pillow
Restart ComfyUI; the node appears under prompt/LLM. Then the real setup step the README can't do for you: install LM Studio, load a model, and hit Start Server in the Developer tab. No server, no enhancement.
Where people get burned
The classic failure chain is: "it's not working" → LM Studio isn't running or the port changed. Check the server is up and lmstudio_base_url matches. Then: auto grabbed a model you didn't want - type the exact ID. Then: images attached to a text-only model error out - switch to a vision model or unplug the images. And if output drifts from your intent, that's the enhancer being an enhancer; lower the temperature, pick minimal enhancement, or tighten the system prompt. None of these are bugs - they're the three knobs the whole tool is built around.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| generation_mode | COMBO | Image generation prompt | 2 options: Image generation prompt, Video generation prompt |
| system_prompt | STRING | Enhance prompts for image or video generation. The user specifies the mode. Preserve subject, intent, constraints, and visible evidence. Return only one positive prompt as one paragraph. Image: describe subject, composition, framing, camera/lens when useful, lighting, color, materials, texture, environment, depth, mood, and key details. In image mode, input_image_1 is the base image and input_image_2 is the reference image. Video: describe subject and scene, camera framing/movement, subject and environmental motion, timing, pacing, continuity, lighting, atmosphere, and shot evolution. In video mode, input_image_1 is the first frame and input_image_2 is the last frame. Use attached images as visual evidence. Do not contradict them or the user's prompt. No negative prompt, markdown, explanation, or unrelated detail. Do not introduce artist names, celebrities, copyrighted characters, or trademarked IP unless the user supplied them. | — |
| style | COMBO | cinematic | 30 options: cinematic, cinematic anamorphic, cinematic 35mm film, large-format cinematic, cinematic noir, cinematic documentary, +24 |
| lmstudio_base_url | STRING | http://127.0.0.1:1234/v1 | — |
| lmstudio_api_key | STRING | — | |
| model | STRING | auto | — |
| temperature | FLOAT | 0.700–2 | — |
| max_tokens | INT | 50050–10000 | — |
| enable_llm | BOOLEAN | true | — |
| cache_buster | INT | 00–999999 | — |
| input_image_1opt | IMAGE | — | |
| input_image_2opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| enhanced_prompt | STRING | — |