📡 LMStudio Request
The node that actually talks to your LM Studio LLM
- api_config
- message
- 上一步
- message_out
- output_text
This is the node the whole pack exists for. Every other LMS_* node - API Config, Select Model, System Prompt, User Prompt - is just plumbing that feeds this one. 📡 LMStudio Request takes the conversation you've built up, posts it to your locally running LM Studio server, and returns the model's reply as plain text. If you've ever wanted to have an actual LLM write your prompts, caption your training images, or critique your composition inside ComfyUI instead of in a separate browser tab, this is where that happens.
Why local, by the way? Two reasons people actually give up the cloud for this: privacy (nothing leaves the machine) and cost (no API bill). The trade is that you're now running a language model next to your diffusion models, and they fight over the same VRAM - more on that under troubleshooting. If you're on a 16GB card you already know the dance: load LLM, generate prompts, unload, switch to ComfyUI, run them, repeat. Putting the LLM in the graph is how you stop doing that by hand.
How it works
The node builds an OpenAI-shaped payload and POSTs it to {api_address}/chat/completions on your LM Studio server (default http://127.0.0.1:1234/v1). LM Studio's Local Server is an OpenAI-compatible endpoint, which is why the whole pack feels like talking to ChatGPT's API - because it literally is that API shape, pointed at a model on your own disk. The conversation (messages) comes from the MESSAGE object wired into it, and the reply text is what you get out.
The request blocks until the model answers - up to a 300-second timeout. One nice touch: when the request fails, it doesn't crash the graph. It returns the error message as the output text, so your workflow keeps running and you can read what went wrong in a Preview node.
The inputs that matter
- api_config - the
API_CONFIGobject from⚙️ API Config. Non-negotiable. - model - the model identifier string from
🏷️ Select Model. Has to match what's actually loaded in LM Studio. - message - the
MESSAGEconversation from System/User Prompt nodes. - seed - default
-1means random. Set it to a fixed number and the same prompt gives you the same reply, which is handy when you're comparing prompts. - context_length - default
4096. Here's the quirk worth knowing: the source sends this asmax_tokens, so it caps the length of the reply, not the context window. 4096 is plenty for captions and prompts; you don't need to push it to 100k. - temperature (default
0.7) and top_p (default0.95) - the usual creativity knobs. Lower temperature for captioning where you want consistency, higher for brainstorming. - The optional 上一步 ("previous step") input is a wildcard that does nothing but enforce execution order - a wiring trick for when the LLM needs to run before something else.
What comes out
- message_out - the full conversation with the assistant's reply appended. Feed this into another
👤 User Promptto keep the chat going across turns. - output_text - just the plain-text reply. This is the one you'll wire into a Preview node, a text output, or anywhere else a string needs to go.
Install
Grab it with ComfyUI Manager (search "LM Studio Tools" - the pack is Hazukiaoi/ComfyUI-LM_Studio_Tools), or:
cd ComfyUI/custom_nodes
git clone https://github.com/Hazukiaoi/ComfyUI-LM_Studio_Tools
Then restart ComfyUI. That's the whole install: the pack's only Python dependency is requests, and it downloads no models - the models live in LM Studio, which you'll also need running with its Local Server tab switched on.
When it breaks
- "API Request Failed: Connection refused" - LM Studio's server isn't running, or it's on a different port than your API Config says. Check the Local Server tab.
- "API Request Failed: ... 404 / model not found" - the identifier in Select Model doesn't match a loaded model. Copy the exact id from the Local Server dropdown.
- OOM or glacial generation - your LLM and diffusion models are sharing one GPU. That's what the pack's
🗑️ Unload All Modelsnode exists to fix; run the LLM part first, unload, then do the diffusion.
The author (Hazukiaoi) specced this whole pack with an LLM in a single prompt, and it shows in how consistent the nodes are. It's a small pack with a narrow job - but for "run a local LLM inside a workflow," it's one of the cleanest ways to do it.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| api_config | API_CONFIG | — | |
| model | STRING | — | |
| message | MESSAGE | — | |
| seed | INT | -1-1–18446744073709550000 | — |
| context_length | INT | 409610–100000 | — |
| temperature | FLOAT | 0.700–2 | — |
| top_p | FLOAT | 0.950–1 | — |
| 上一步opt | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| message_out | MESSAGE | — |
| output_text | STRING | — |