Nodes/comfyui-lmstudio-flux2-prompt-generator-simple/LM Studio FLUX.2 Prompt Generator
ComfyUI Node

LM Studio FLUX.2 Prompt Generator

FLUX.2 reads prompts like sentences — let a local LLM write them

By Slartibart23·Created 4 months ago·Updated 4 months ago· 2
LM Studio FLUX.2 Prompt Generator
    • enhanced_prompt
    server_urlhttp://127.0.0.1:1234/v1/chat/completions
    modelqwen3.5-35b-a3b-uncensored-hauhaucs-aggressive
    base_promptA cinematic portrait of a person in a softly lit room.
    target_word_count170
    prompt_modephotoreal
    extra_requirements
    avoidtext, watermark, logo, extra fingers, deformed hands, low quality
    seed_modefixed
    seed42
    temperature0.30
    max_tokens4096

    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 to photoreal, 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 with Invoke-RestMethod http://127.0.0.1:1234/v1/models | ConvertTo-Json -Depth 10 and paste the id verbatim.
    • 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__.py exists, 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_tokens and 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.

    CategoryLM Studio/FLUX.2

    Inputs (11)

    NameTypeDefaultDescription
    server_urlSTRINGhttp://127.0.0.1:1234/v1/chat/completionsLM Studio local chat completions endpoint.
    modelSTRINGqwen3.5-35b-a3b-uncensored-hauhaucs-aggressiveExact LM Studio model ID from /v1/models.
    base_promptSTRINGA 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_countINT17020–300Approximate prompt length in words. LLMs do not count exactly.
    prompt_modeCOMBOphotorealOverall prompt style.
    extra_requirementsSTRINGOptional details that should be included or respected.
    avoidSTRINGtext, watermark, logo, extra fingers, deformed hands, low qualityThings the generated prompt should avoid mentioning or should discourage.
    seed_modeCOMBOfixedfixed uses the seed below; random creates a new seed on each run.
    seedINT420–2147483647Seed sent to LM Studio.
    temperatureFLOAT0.300–1.5Creativity/randomness. 0.2-0.4 is recommended.
    max_tokensINT4096512–262144LM Studio output token budget. Increase this if prompts are incomplete or not clean.

    Outputs (1)

    NameTypeDescription
    enhanced_promptSTRING