Nodes/comfyui-lmstudio/LM Studio Generate
ComfyUI Node

LM Studio Generate

The local LLM prompt-enhancer you'll actually use

By SiegeKeebsOffical·Created 9 months ago·Updated 9 months ago· 4
LM Studio Generate
    • response
    • previous_conv
    • read_conv
    promptWhat is Art?
    debug
    urlhttp://localhost:1234
    model
    temperature0.80
    seed622193251
    filter_thinkingtrue
    previous_conv

    This is the workhorse of the pack - the node you'll reach for 90% of the time. LM Studio Generate takes a text prompt, sends it to whatever LLM you have loaded in LM Studio, and hands the reply back as a string you can feed anywhere a prompt goes. No API key, no cloud, everything local. The author's own framing is the right one: LM Studio is just an alternative to an API LLM or Ollama for enhancing prompts - it does not replace the text encoder of your diffusion model. The text it outputs still goes through whatever encoder your model needs.

    Why you'd reach for it

    Prompt enhancement, mostly. You drop a raw idea in ("a cyberpunk cat in the rain"), the LLM - which can be a much bigger model than anything you'd run as an in-graph encoder - rewrites it into something a text-to-image model actually responds to, and you pipe the result into a CLIP Text Encode. Because it's a separate LM Studio process, you can use a large reasoning model for this without paying for it inside ComfyUI's VRAM footprint at sampling time. It's also just a handy local text generator for anything a workflow needs: building negative prompts, normalizing tags, explaining an error.

    How it works

    It posts an OpenAI-style chat request to {url}/v1/chat/completions on LM Studio and returns choices[0].message.content. The one genuinely modern touch is filter_thinking: reasoning models (Qwen3, DeepSeek, most 2025+ releases) emit their chain of thought inside <think> / <thinking> tags, and with the toggle on (default), the node strips those tags out of the reply before you see it. Leave it off and you'll get the raw scratchpad mixed into your prompt. Set debug to enable once and the ComfyUI console will print the exact request and full response - the fastest way to see what the model actually received.

    The inputs that matter

    • prompt - your message. Multiline.
    • model - picked from a dropdown filled live from LM Studio's /v1/models.
    • filter_thinking - keep it on unless you genuinely want the reasoning text.
    • temperature and seed - passed straight through to the model. 0.8 is the default; for prompt-rewriting I'd run lower, around 0.4, so the rewrite stays faithful.
    • url - http://localhost:1234 unless you changed LM Studio's port.

    The outputs

    • response - the model's reply. This is the one you wire onward.
    • previous_conv - the conversation as JSON.
    • read_conv - the same history formatted for humans.

    The conversation threading is the interesting part: wire one node's previous_conv into the next one's previous_conv input and you get a multi-turn chat running through your graph - each node adds its turn and passes the whole thread along. It's clunky, but it works, and it's how you build "ask a clarifying question, then refine" workflows.

    Installing

    ComfyUI Manager → search "comfyui-lmstudio", or

    cd ComfyUI/custom_nodes
    git clone https://github.com/SiegeKeebsOffical/comfyui-lmstudio
    

    then restart ComfyUI. No model downloads - models live in LM Studio. The pack ships no requirements.txt; if you hit ModuleNotFoundError: No module named 'httpx', pip install httpx and restart. In LM Studio: load a model, start the local server (Developer tab → Local Server), leave the port at 1234.

    Where people get burned

    Empty model dropdown means LM Studio's server isn't running - nothing wrong with the node. A stale workflow that saved a specific model name won't auto-match if you've since loaded a different one; re-pick it. And the VRAM reality: the LLM and your diffusion model share the card, so a 35B model running in LM Studio will make sampling feel slow even when this node isn't doing anything. For enhancement duty, a small quantized model (7–9B) is usually the sweet spot. One last thing - it's worth a skim of the single-file source before you trust it with your workflow, given how many sketchy "LLM in ComfyUI" packs have circulated.

    CategoryLM Studio

    Inputs (8)

    NameTypeDefaultDescription
    promptSTRINGWhat is Art?
    debugCOMBO2 options: enable, disable
    urlSTRINGhttp://localhost:1234
    modelCOMBO0 options:
    temperatureFLOAT0.800–1
    seedINT6221932510–2147483648
    filter_thinkingBOOLEANtrue
    previous_convoptSTRING

    Outputs (3)

    NameTypeDescription
    responseSTRING
    previous_convSTRING
    read_convSTRING