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 2 years agoΒ·Updated 2 days agoΒ· 66
πŸ€– 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.

CategoryOreX/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β€”