617100dbe665df817e4fb4da19724b2d5bf0cde8
- coerce_seed("") returns None, not ValueError; move "" out of the
invalid-values parametrize and give it its own explicit assertion
- strip_think_content tests used \\n (literal backslash-n) instead of
real newlines; .strip() cannot remove backslash or 'n' so the dangling-
tag test always failed. Replace with actual \n to match real LLM output.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ComfyUI LMStudio Remote Nodes
ComfyUI custom nodes to connect to a remote LMStudio server through the OpenAI API v1-compatible interface.
Included nodes
-
LMStudio - Connect
- Server URL (example:
http://10.168.168.7:1234) - API token (
-placeholder supported) - Model dropdown (populated by Refresh Models button)
- Test Connection button
- Reasoning toggle
- Advanced options (collapsed by default): max tokens, temperature, timeout, tooling/MCP toggle
- Outputs a reusable
LMSTUDIO_CONNECTIONpayload
- Server URL (example:
-
LMStudio - Text Gen
Connectioninput from LMStudio - Connect- System prompt (
LM Soulsstyle) - User prompt
- Seed (
-1= secure random)
-
LMStudio - Image To Text
Connectioninput from LMStudio - Connect- Image input
- System prompt (
LM Soulsstyle) - User prompt
- Seed (
-1= secure random)
Project structure
comfyui-lmstudio-node/
├── __init__.py # Comfy extension entrypoint
├── connect_node.py # Connection node schema + payload builder
├── text_gen_node.py # Text generation node
├── image_to_text_node.py # Image-to-text node
├── client.py # OpenAI SDK client + shared helpers
├── models.py # Dataclasses for connection payload
├── iotypes.py # Custom Comfy IO types
├── routes.py # Backend routes for model list + connectivity test
├── web/
│ └── lmstudio_connect.js # Frontend buttons for refresh/test and dropdown update
├── tests/ # Unit tests
├── requirements.txt
└── pyproject.toml
Behavior and reliability notes
- Uses only the
openaiPython SDK. No legacy HTTP fallback path. - Seed handling is sanitized and deterministic-safe; no
random.seed()calls are used. - Text and image nodes use
responsesendpoint first, then fallback tochat.completionsif needed. - MCP/tooling toggle is preserved in connection payload. It is useful only when your LMStudio model/session is configured for tool-capable responses.
Installation
- Place this folder under
ComfyUI/custom_nodes/. - Install dependencies:
pip install -r requirements.txt - Restart ComfyUI.
LMStudio compatibility references
Languages
Python
94.8%
JavaScript
5.2%