LM Studio FLUX.2 Prompt Generator
FLUX.2 reads prompts like sentences — let a local LLM write them
- enhanced_prompt
The dirty secret about FLUX.2 Klein is that it's a bad fit for the way most people learned to prompt. Its text encoder is a Qwen3 LLM, so it reads your prompt like a chat message, not a tag list. beach, woman, black dress does almost nothing; "A realistic photo of a woman sitting on a beach. She is wearing a black dress." works. Writing that flowing-prose style by hand for every image is real work, which is exactly what this node offloads to a local LLM.
LM Studio FLUX.2 Prompt Generator is the text-in node of a small two-node pack. You type a short idea, pick a style, and it hands back a long, FLUX.2-ready prompt that you wire straight into Klein's text encoder. No API key, no billing, nothing leaves your machine - it talks to LM Studio's local server on port 1234.
How it works
When you run it, the node builds an instruction (the source literally says "Write one final English image-generation prompt for FLUX.2 [klein] 9B", prefixed with /no_think) and POSTs it to http://127.0.0.1:1234/v1/chat/completions - the OpenAI-compatible endpoint LM Studio serves from its Developer tab. The auth header is Bearer lm-studio, which is LM Studio's built-in placeholder key. That's why there's no key field anywhere. The prompt also gets your mode guide, your avoid list, and an ordering hint (subject, pose, environment, lighting, colors, camera view, style, mood), which matches how Klein actually wants to be fed.
The clever part is the cleanup. Reasoning models love to narrate before answering, so the node strips markdown fences, "Thinking Process:" blocks, numbered lists, and label-prefixed lines, then checks whether what's left even looks like a real prompt. If it still reads like reasoning, it fires a second "repair" call asking the model to clean up its own draft. The "simple" in the pack name is deliberate: the fuller version of this generator exposes fallback mode, thinking mode, and prompt-focus controls that the author says cause bad output. This one just does the right thing automatically.
The inputs that actually matter
base_prompt- your one-line idea or draft. This is the whole job: give it a seed sentence and it expands.prompt_mode-neutral,cinematic,photoreal,illustration,product,character,NSFW,Strong NSFW. Defaults tophotoreal, and photoreal/cinematic are the sweet spots.target_word_count- 20–300, default 170. The tooltip is refreshingly honest: "LLMs do not count exactly."model- the exact model ID from LM Studio. Grab it withInvoke-RestMethod http://127.0.0.1:1234/v1/models | ConvertTo-Json -Depth 10and paste theidverbatim.temperature- 0.2–0.4 recommended, default 0.3.max_tokens- default 4096; push to 8192 if output comes back truncated or sloppy.
The avoid field defaults to "text, watermark, logo, extra fingers, deformed hands, low quality" - the usual quality worries, baked in so you don't retype them. seed_mode fixed/random just controls the seed passed to LM Studio so you can reproduce a phrasing.
Output
A single enhanced_prompt STRING. Wire it into the FLUX.2 text encoder, or into a Show Text node while you're tuning the LLM side.
Installing it
ComfyUI Manager → search comfyui-lmstudio-flux2-prompt-generator-simple, or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/Slartibart23/comfyui-lmstudio-flux2-prompt-generator-simple
Restart ComfyUI completely. requirements.txt is literally just requests - torch, numpy and Pillow already ship with ComfyUI, so there's no dependency hell here. Then the real setup happens in LM Studio: load a model, open the Developer area, start the local server, and paste the model ID into the node.
The README recommends HauhauCS/Qwen3.5-35B-A3B-Uncensored-HauhauCS-Aggressive and warns it wants an RTX 5090-class card. Don't take that personally. For text-only prompting a smaller GGUF instruct model is fine - the troubleshooting section itself admits a dedicated non-reasoning model gives cleaner output, since it sidesteps the thinking-process problem entirely.
Troubleshooting
- Node doesn't appear - check
ComfyUI/custom_nodes/comfyui-lmstudio-flux2-prompt-generator-simple/__init__.pyexists, then restart. - "LM Studio error 401/404" - server not running, or the model ID doesn't match. Re-check it against
/v1/models. - Output starts with "Thinking Process:" - the auto-cleaner can't catch everything. Raise
max_tokensand LM Studio context length (16384+ if your hardware allows), or switch to a non-reasoning model.
Honest take: this node isn't a necessity. Klein prompting is learnable, and the modidex notes that correct prompting fixes most of Klein's anatomy complaints. What it buys you is speed and consistency while iterating, plus a fully offline workflow. The NSFW modes exist - the README's "legal, consenting-adult workflows only" line isn't boilerplate, read it.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| server_url | STRING | http://127.0.0.1:1234/v1/chat/completions | LM Studio local chat completions endpoint. |
| model | STRING | qwen3.5-35b-a3b-uncensored-hauhaucs-aggressive | Exact LM Studio model ID from /v1/models. |
| base_prompt | STRING | A cinematic portrait of a person in a softly lit room. | Your short idea or draft prompt. The node will rewrite it as a FLUX.2 prompt. |
| target_word_count | INT | 17020–300 | Approximate prompt length in words. LLMs do not count exactly. |
| prompt_mode | COMBO | photoreal | Overall prompt style. |
| extra_requirements | STRING | Optional details that should be included or respected. | |
| avoid | STRING | text, watermark, logo, extra fingers, deformed hands, low quality | Things the generated prompt should avoid mentioning or should discourage. |
| seed_mode | COMBO | fixed | fixed uses the seed below; random creates a new seed on each run. |
| seed | INT | 420–2147483647 | Seed sent to LM Studio. |
| temperature | FLOAT | 0.300–1.5 | Creativity/randomness. 0.2-0.4 is recommended. |
| max_tokens | INT | 4096512–262144 | LM Studio output token budget. Increase this if prompts are incomplete or not clean. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| enhanced_prompt | STRING | — |