ComfyUI Node

LM Studio Model

The node that talks to LM Studio for you

By WASasquatch·Created 11 months ago·Updated 6 months ago· 19
LM Studio Model
    • model
    model<no models found>
    manual_model_id
    unload_after_usetrue
    temperature0.15
    max_tokens-1
    seed0
    image_max_size1024
    use_rest_apifalse

    This is the node you drop first, because every other node in the WAS LMStudio Easy-Query pack wants its model input wired to what this one outputs. If you're used to ComfyUI loaders that yank weights into your own VRAM, adjust your expectations: LM Studio Model doesn't load anything. It points the rest of the pack at a model that's already running inside the LM Studio app on your machine, and bundles the sampling defaults for that model into one wire.

    The name is a small lie. There's no API key, no cloud call, no huggingface.co download here. This pack talks to LM Studio through its official Python SDK, over localhost, to a server you're running on the same box. That's the whole trick that makes a vision-language model usable from inside ComfyUI without fighting it for VRAM - LM Studio owns the model, ComfyUI just sends prompts and gets text back. It's the same pattern the community has been wiring together by hand for a while now: a Qwen3-VL-class model captioning images so you can feed the results to Z-Image or Flux or whatever you're actually generating.

    The inputs that matter:

    • model - a dropdown populated at graph load by asking LM Studio's SDK which models you've downloaded. If it shows <no models found>, LM Studio isn't running or has nothing installed yet; the pack defaults to qwen/qwen2.5-vl-3b, a good small vision model to start with.
    • manual_model_id - the escape hatch. If your instance isn't returning models via /models, or runs on a different base URL, type the identifier here (e.g. qwen/qwen2.5-vl-7b) and it overrides the dropdown.
    • temperature / max_tokens / seed - your baseline sampling. Set max_tokens to -1 for unlimited, which the tooltip recommends for thinking models. seed 0 disables it.
    • image_max_size - the longest edge images get downscaled to before they're encoded and shipped to LM Studio. 1024 is a sane default; drop to 512 if you're on a small context window.
    • unload_after_use (default on) - unloads the model after each query. On a single GPU this is the setting that lets you caption a batch, then immediately generate images without an OOM.
    • use_rest_api - flips the backend from the SDK to LM Studio's OpenAI-compatible REST endpoint. Required for proper thinking-model support, because it separates the reasoning text from the actual content.

    The single output, model of type LMSTUDIO_MODEL, is a dict carrying model_id, temperature, max_tokens, seed, image size, and the unload flag - everything the Query, Caption, Chat, and dataset nodes need. Think of it as a config object, not a loaded model.

    Install it the usual way: ComfyUI Manager, search "WAS LMStudio Easy-Query", or

    cd ComfyUI/custom_nodes
    git clone https://github.com/WASasquatch/ComfyUI_LMStudio_EasyQuery
    

    then restart ComfyUI. The pack needs LM Studio's Python SDK plus numpy and Pillow:

    pip install lmstudio numpy Pillow
    

    and, separately, the LM Studio app running with at least one model downloaded inside it - the pack won't fetch models for you.

    If the dropdown comes up empty, check that LM Studio is actually running and serving, then try manual_model_id. And remember the pack reads lmstudio_config.json in its own folder - you can set a default_model and the image_max_sizes list there, but you must restart ComfyUI after editing. Those SDK websocket shutdown messages you'll see in the console when ComfyUI closes are normal, not an error.

    CategoryLM Studio

    Inputs (8)

    NameTypeDefaultDescription
    modelCOMBO<no models found>Model key discovered from the LM Studio SDK. Pick a listed model or use manual_model_id.
    manual_model_idSTRINGOptional manual model identifier if your LM Studio instance is not returning it via /models or runs on a different base URL.
    unload_after_useBOOLEANtrueUnload the model after queries to free up memory. Uses LM Studio SDK for proper model management.
    temperatureFLOAT0.150–2Sampling temperature. Higher is more random; lower is more deterministic.
    max_tokensINT-1-1–32768Maximum new tokens to generate for the assistant reply. Use -1 for unlimited (recommended for thinking models).
    seedINT00–2147483647Optional seed for deterministic sampling if supported by LM Studio. Use 0 to disable.
    image_max_sizeCOMBO1024Maximum edge size for input images (keeps aspect ratio). Images larger than this are downscaled before encoding and sending to LM Studio.
    use_rest_apiBOOLEANfalseUse the OpenAI-compatible REST API instead of the LM Studio SDK for predictions. Required for proper thinking model support (separates reasoning from content).

    Outputs (1)

    NameTypeDescription
    modelLMSTUDIO_MODEL