Nodes/comfyui-OreX/🤖 LMStudio (OreX)
ComfyUI Node

🤖 LMStudio (OreX)

A local LLM node with a GUI and a chat, minus the cloud

By orex2121·Created about a year ago·Updated about 15 hours ago· 34
🤖 LMStudio (OreX)
  • image
  • Generated Text
  • Request_lmstudio
text_input
system_prompt
system_preset
model_key
include_reasoningfalse
auto_unload_modeltrue
unload_delay0
clean_vram_beforefalse
seed777
context_length4096
max_tokens0
generation_parametersfalse
temperature0.70
top_k40
top_p0.95
repeat_penalty1.10

If Ollama is the command-line way to run local LLMs, LM Studio is the "install a program, click a button" way - and the OreX pack has a node for it too. LMStudio (OreX) talks to the LM Studio server running on your machine at http://127.0.0.1:1234 and brings whatever model you've loaded there into ComfyUI as a text-generation node. Same shape as the pack's Ollama node, different backend: no API key, no cloud, and a familiar chat interface to pick and manage models on the LM Studio side.

How it works

It's a client for LM Studio's OpenAI-compatible API (/v1/chat/completions). On startup it queries /v1/models and fills the model_key dropdown with what's available, so you pick from the real list rather than typing IDs. When you run the queue it builds a chat request - system prompt plus your text_input - with generation options (temperature, top_p, context_length, max tokens), sends it, and returns the model's reply.

The feature set mirrors the Ollama node almost exactly, which makes sense since they share a codebase family:

  • Vision. Plug an IMAGE into the optional image input and it base64-encodes it (downscaled to ~0.7 MP) as an OpenAI-style image message. Great for "describe this image" or "what's wrong with this render" prompts.
  • Reasoning handling. include_reasoning off (default) strips <think> / [Thinking] blocks and even re-attaches separately-delivered reasoning_content when you do want it - DeepSeek R1-class models in LM Studio produce that field, and the node speaks to both layouts.
  • VRAM management. clean_vram_before unloads ComfyUI's models before inference. auto_unload_model plus unload_delay schedules the LM Studio model to be unloaded when done - it tries the official lmstudio SDK first (the pack's console output will tell you if you should pip install lmstudio), then falls back to LM Studio's unload endpoint. There's even a per-model unload timer so batch queues don't get interrupted mid-run.

Inputs that matter

Same handful as the Ollama node: model_key (live dropdown), text_input, system_prompt / system_preset (a shared preset JSON with translators, short-answer, and image-sysprompt templates), seed for reproducibility, and the optional image input. Outputs are Generated Text (wire this onward) and Request_lmstudio - a JSON log of the exact request, invaluable when output misbehaves.

Install

ComfyUI Manager (search "comfyui-OreX") or:

cd ComfyUI/custom_nodes
git clone https://github.com/orex2121/comfyui-OreX

Restart. Then separately: install LM Studio, start the local server (Developer tab → "Start Server", default port 1234), and load a model in its GUI. The node reads LMSTUDIO_URL if your server is elsewhere. Optionally pip install lmstudio for smoother model unloads.

Common issues

  • "Cannot connect to LM Studio" on run - the server isn't started or isn't on port 1234. Start it, then re-run.
  • "SELECT A MODEL" forever - the dropdown couldn't reach /v1/models at node-load time. Start LM Studio before ComfyUI, or restart ComfyUI after starting the server.
  • Text-only model ignoring your image - the model you loaded isn't vision-capable. Load a multimodal one in LM Studio.
  • OOM with both apps on one GPU - enable clean_vram_before; keep unload_delay at 0 so models free VRAM right after each call.

One honest note: Ollama vs LM Studio is a preference call, not a quality call. If you already run one, don't switch for the sake of this node - but if you like a GUI and per-model settings, LM Studio plus this node is a genuinely pleasant local-LLM setup.

Category🤫OreX/LLM

Inputs (17)

NameTypeDefaultDescription
text_inputSTRING
system_promptSTRING
system_presetCOMBO8 options: None, Image Description, English translator, Translator into Russian, Translation into Chinese, Short answer, +2
model_keyCOMBO1 options: SELECT A MODEL
include_reasoningBOOLEANfalse
auto_unload_modelBOOLEANtrue
unload_delayINT00–3600
clean_vram_beforeBOOLEANfalse
seedINT7770–18446744073709550000
imageoptIMAGE
context_lengthoptINT40960–131072
max_tokensoptINT00–18446744073709550000
generation_parametersoptBOOLEANfalse
temperatureoptFLOAT0.700–2
top_koptINT400–100
top_poptFLOAT0.950–1
repeat_penaltyoptFLOAT1.100–2

Outputs (2)

NameTypeDescription
Generated TextSTRING
Request_lmstudioSTRING