test/behavioral-contracts
25 new tests across client.py, routes.py, connect_node.py, and text_gen_node.py. Each test targets a specific behavioral contract that 100% line+branch coverage did not verify and that a realistic mutation would silently break: - normalize_server_url: whitespace-only input, trailing-slash stripping, https acceptance - coerce_seed: whitespace-only string returns None (not ValueError) - resolve_request_seed: seed=0 passes through; large values not clipped - build_responses_input_text: 'type' must be 'input_text' (not 'text') - build_chat_messages: whitespace system prompt omitted; empty user included - list_models: result is sorted AND deduplicated (both invariants checked) - strip_think_content: surrounding text order preserved; block-only → "" - _query_int: negative integers rejected; empty string uses default - _models_handler: empty models → default_model="" not IndexError; error prefix is 'Failed to list models' not 'Connection test failed' - _test_handler: model_count matches actual list length; distinct error prefix - connect_node execute: empty model with test_connectivity=False still probes; no-probe status omits 'Found N model(s)'; probe status includes exact count - _responses_kwargs: 'input' key present with user-role and correct prompt text; temperature/max_tokens forwarded from payload - text_gen_node execute: fallback path status includes resolved seed; user_prompt=None raises clean ValueError Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ComfyUI LMStudio Nodes (Unofficial)
Small ComfyUI custom nodes to connect to a remote LMStudio server through OpenAI-compatible API (/v1).
Nodes
-
LMStudio - Connect
- Connect to a remote LMStudio URL
- Set API token
- Pull/load model list automatically (Refresh Models)
- Test connectivity to server
- Supports LM Reasonning mode toggle
- Supports Tooling / MCP toggle
-
LMStudio - Text Gen
- System prompt + user prompt
- Text generation through the shared connection
<think>...</think>blocks are stripped from response output
-
LMStudio - Image To Text
- System prompt + user prompt + image input
- Image description / caption style generation
<think>...</think>blocks are stripped from response output
Quick start
- Put this folder in
ComfyUI/custom_nodes/ - Install deps:
pip install -r requirements.txt - Restart ComfyUI
Testing
Run the Python unit tests with coverage gate (>=90%):
pytest -q
Notes
- This is not an official LMStudio project.
- Not affiliated with LMStudio.
- It is a quickly vibecoded utility project.
References
Languages
Python
94.8%
JavaScript
5.2%
