Nodes/ComfyUI-AusBoss/LM Studio Chat πŸ†Ž
ComfyUI Node

LM Studio Chat πŸ†Ž

Sends a prompt - and optionally an image - to a local LM Studio server and returns the reply as text. Works with any OpenAI-compatible endpoint. Reasoning-model <think> blocks come out on their own output, so the text output stays clean for wiring into a conditioning prompt. Chain the history output into another chat node's history input for a multi-turn conversation, and fill json_schema to force a structured JSON reply. Caches like any node; change the seed to re-roll the same inputs.

By ausbossΒ·Created about a month agoΒ·Updated 7 days agoΒ· 2
LM Studio Chat πŸ†Ž
  • image
  • history
  • text
  • thinking
  • history
β—„promptβ–Ί
β—„system_promptβ–Ί
β—„endpointhttp://127.0.0.1:1234/v1β–Ί
β—„modelβ–Ί
β—„temperature0.70β–Ί
β—„max_tokens512β–Ί
β—„seed0β–Ί
β—„timeout_seconds120β–Ί
β—„image_max_edge1024β–Ί
β—„top_p1.00β–Ί
β—„top_k0β–Ί
β—„repeat_penalty1.00β–Ί
β—„min_p0.00β–Ί
β—„presence_penalty0.00β–Ί
β—„thinking_modemodel defaultβ–Ί
β—„reasoning_open_tag<think>β–Ί
β—„reasoning_close_tag</think>β–Ί
β—„idle_unload_seconds0β–Ί
β—„free_comfy_vramfalseβ–Ί
β—„unload_llmfalseβ–Ί
β—„json_schemaβ–Ί
CategoryπŸ†Ž AusBoss/Text

Inputs (23)

NameTypeDefaultDescription
promptSTRINGWhat to ask. Required unless an image is connected - an image with an empty prompt asks for a plain description.
system_promptSTRINGOptional role and rules for the model, e.g. 'You write single-paragraph Stable Diffusion prompts, no preamble.' Empty sends no system message.
endpointSTRINGhttp://127.0.0.1:1234/v1The server's base URL - LM Studio shows it on its Developer tab. A bare host:port or a full /v1 path both work; any OpenAI-compatible server is fine.
modelSTRINGModel identifier as LM Studio lists it. Empty uses whatever the server has loaded, which is the everyday case.
temperatureFLOAT0.700–2Sampling randomness: 0 is near-deterministic, 0.7 balanced, higher wanders. Captioning likes 0.2-0.5.
max_tokensINT512-1–131072Longest allowed reply, in tokens. -1 leaves the length to the server. Reasoning models spend tokens thinking before answering, so give them room.
seedINT00–18446744073709550000Sent to the server, and either way a changed seed re-runs the node instead of replaying the cached reply - the re-roll knob.
timeout_secondsINT1205–3600How long to wait for the reply. Cold-loading a big model or a long think can need minutes.
image_max_edgeINT10240–8192Downscale a connected image so its longest edge fits this before sending; 0 sends full size. Vision models resize internally anyway, and a smaller upload prefills much faster.
imageoptIMAGEOptional image for vision models. Only the FIRST frame of a batch is sent - pick one with Select Frame πŸ†Ž for video. A text-only model errors server-side if an image arrives.
top_poptFLOAT1.000–1Nucleus sampling cap; 1 sends nothing and the server default applies.
top_koptINT00–1000Top-k sampling cutoff; 0 sends nothing.
repeat_penaltyoptFLOAT1.000–4Repetition penalty; 1 sends nothing.
min_poptFLOAT0.000–1Minimum token probability; 0 sends nothing.
presence_penaltyoptFLOAT0.00-2–2Presence penalty; 0 sends nothing.
thinking_modeoptCOMBOmodel defaultForce a hybrid reasoning model to think or not via chat_template_kwargs (Qwen-style templates honor it; others ignore it).
reasoning_open_tagoptSTRING<think>Tag that opens a reasoning block in the reply; the block moves to the thinking output.
reasoning_close_tagoptSTRING</think>Tag that closes a reasoning block.
idle_unload_secondsoptINT00–86400LM Studio JIT TTL: unload the model after idling this many seconds. 0 sends nothing.
free_comfy_vramoptBOOLEANfalseUnload ComfyUI's cached models before the request so a big LLM fits alongside a big diffusion model on one GPU.
unload_llmoptBOOLEANfalseUnload the language model right after the reply (LM Studio JIT ttl) so its VRAM is free for the diffusion models and text encoders that run next. Overrides the gear menu's idle-unload timer.
historyoptAUSBOSS_CHAT_HISTORYPrior turns from another LM Studio Chat πŸ†Ž node's history output; they replay before this prompt so the model remembers the conversation. Images are not carried between turns.
json_schemaoptSTRINGPaste a JSON Schema to force the reply into that exact structure (LM Studio structured output). {"type": "object"} allows any JSON; empty replies as plain text.

Outputs (3)

NameTypeDescription
textSTRINGThe model's reply with any <think> blocks removed - safe to wire straight into a text encoder.
thinkingSTRINGThe reasoning a thinking model emitted, empty for ordinary models. Useful for a preview node while tuning prompts.
historyAUSBOSS_CHAT_HISTORYThe conversation including this exchange - wire into another chat node's history input to continue the thread.