LM Studio Query
Ask your local model anything — text or vision — and get text back
- model
- images
- options
- responses
LM Studio Query is the workhorse of the WAS LMStudio Easy-Query pack: a one-shot question-answering node that sends a prompt to a model running in LM Studio and hands you back a string. No conversation memory, no caption presets - just prompt in, text out. It's the node you reach for when you want to bend a local LLM or VLM to a single task inside a graph.
This is the "prompt engineering as a node" pattern people keep rebuilding by hand: take a Qwen3-VL-class model in LM Studio, ask it to describe an image in detail, then feed that description to your image generator. The community has been raving about exactly this combo for a while - LM Studio captioning an image into a long natural-language prompt, then Z-Image or Flux or a Wan pipeline consuming it. Query is that loop in one node.
Wire a model from the LM Studio Model node, type your prompt, run. The mechanism: images get resized down to image_max_size (set on the Model node) and encoded as PNGs to ComfyUI's temp folder, then sent to LM Studio through its Python SDK - or through the OpenAI-compatible REST API if you flipped use_rest_api on the Model node. The node cleans up those temp images after the call.
Inputs that matter:
- model - required
LMSTUDIO_MODELfrom the Model node; carries the model id plus your baseline temperature, token cap, seed, and image size. - mode -
one-by-one(default) sends one request per image;batchstuffs all images into a single request. One-by-one is more reliable for vision work; batch is faster if your model's context can take it. - system_prompt - optional role-setting instructions; leave blank for none.
- user_prompt - default
Describe the image., which hints at the intended use. It works alone for text-only questions or alongsideimagesfor vision models. A VLM like qwen2.5-vl needs both. - images (optional) - the
IMAGEinput. Give it nothing and you've got a plain local LLM call. - options (optional) - an
LMSTUDIO_OPTIONSwire if you want per-request sampling overrides.
The output, responses, is a list of strings. With one image and one-by-one mode you get one string; with a batch of images in one-by-one mode you get one per image. Wire it into anything that consumes text - a display node, a prompt-prep step, a save node. If you caption a folder of images this way, remember the community's captioning wisdom: describe what you want adjustable, leave what should be fixed undescribed.
Install is the pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/ComfyUI_LMStudio_EasyQuery
restart ComfyUI, and make sure the Python side has lmstudio numpy Pillow installed. The pack itself downloads no models - you grab those inside LM Studio and load one there before you run.
Where people get burned: you wire in images, pick a text-only model, and the model politely ignores the pictures - responses come back looking text-only. Verify a VLM is selected in the Model node and that images are actually reaching the images input. If the Model dropdown is empty, type the id into manual_model_id. And if you get an "Error: Context size" style failure in the output, that's your signal to lower image_max_size - the node will retry with downscaled images automatically, but you'll have a smoother run starting small.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | LMSTUDIO_MODEL | LM Studio model settings produced by the LM Studio Model node. Contains model_id, temperature, max_tokens, seed, and image_max_size. | |
| mode | COMBO | one-by-one | Batch sends all images in a single request; one-by-one sends one request per image using the same prompts. |
| system_prompt | STRING | System role content that sets the assistant's behavior for this request. If blank, no system message is added. | |
| user_prompt | STRING | Describe the image. | User message sent to the model. Works alone for text-only or together with provided images for vision models. |
| imagesopt | IMAGE | Optional IMAGE input. Provide one or more images. Resized to image_max_size before being sent. | |
| optionsopt | LMSTUDIO_OPTIONS | Per-request overrides (temperature, max_tokens, seed, top_p, top_k, penalties, stop). These take precedence over values from the Model node. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| responses | STRING | — |