Nodes/LLM Widget/LLM Widget
ComfyUI Node

LLM Widget

The LLM Widget answers your questions before you even hit Queue

By id-fa·Created about a month ago·Updated 29 days ago· 1
LLM Widget
  • image
  • video
  • text
system_promptYou are a helpful assistant. Reply with the answer only: no preamble, no explanation, no commentary.
generate_on_executefalse
answer
question

Most LLM nodes in ComfyUI are prompt enhancers: text goes in, fancier text comes out, and it feeds your sampler on the next run. This one is the opposite. ComfyUI-LLM-Widget's LLM Widget is a chat window that lives on your canvas - you type a question, press the ✦ button, and the answer appears on the node without anything being queued. No graph execution, no other node moves. The author's framing is exact: it's a tool, not a step, meant to sit in your workflow permanently bypassed or muted.

Why bother? Because the LLM you bolt into a workflow mostly works on the text around generation - drafting a prompt, rewriting one for a specific checkpoint, translating it, or describing a reference image before you decide what to do with it. That's the whole editorial case for LLM-in-the-graph tools. The trick here is that you never have to run the graph to get the help: the widget does its job in the editor, between drafts, and the graph stays a graph.

How it actually works

The node itself is deliberately thin. It's not an OUTPUT_NODE - the source says so explicitly, because an output node would get pulled into every queued prompt even when nobody reads its text, which is the opposite of a widget you keep muted. With generate_on_execute off (the default), running the graph just hands the stored answer to the text output. Everything interesting happens over HTTP, in the editor.

The backend is chosen once in the ⚙ settings dialog, and that setting is global to the whole install - all LLM Widget nodes share one backend. Your choices, from the README:

  • OpenAI-compatible - anything that speaks /v1/chat/completions: LM Studio, Ollama, llama.cpp server, or a cloud proxy. The URL path is auto-completed, so http://host:1234 alone works.
  • Gemini - Google's native generateContent. Paste a key, pick a model, done.
  • GGUF - a local model loaded in-process through llama-cpp-python. This is the fully-offline path.

Settings live in llm_widget.json next to nodes.py, and it holds your API key in plaintext - gitignored, but treat it like a password file. For the paranoid (justified in this category), this one is unusually clean: no Python deps for the API paths, no model downloads, and it only reaches the endpoint you configure. Given what an "LLM vision" node once did to this ecosystem, that's a real point in its favor.

The inputs and outputs that matter

Most of the work happens in widgets, not wires. The fields that matter:

  • system_prompt - free text, saved with the workflow. The only "template" the node has.
  • question - what you're asking. It sits right above the ✦ button, like a chat input.
  • image / video (optional) - wire a loader in and the media goes along with the question.
  • answer - editable text where the reply lands. The single text (STRING) output carries the reply.

Here's the gotcha with media, and it's a good one: the editor can only send media that already exists as a file in ComfyUI's input/, output/, or temp/ folders. Wiring a Load Image works; wiring a VAE Decode output doesn't, because that image has no file until the graph runs. Toolbar chips show what will actually be sent - a struck-through red chip means it's skipped, and the node warns you rather than silently hallucinating a description.

Videos get sampled into stills for the OpenAI and GGUF formats (chat messages have no video channel): one candidate per second, first and last frames always kept, and the rest of the budget goes to the frames that changed most - so a held shot doesn't eat all four slots while the cut in the middle goes unseen. Timestamps go into the request so the model doesn't read it as slow motion. Gemini just gets the whole file.

Installing it

Search "LLM Widget" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/id-fa/ComfyUI-LLM-Widget

Restart ComfyUI. No Python dependencies are added for the OpenAI/Gemini paths. The GGUF path is the heavy one: you need llama-cpp-python in ComfyUI's environment plus a .gguf under models/text_encoders/ or models/LLM/. Reading an image through a GGUF requires a build that ships the multimodal chat handlers - and the upstream PyPI wheel usually doesn't have them, so you install the JamePeng fork's release wheel instead. The pack's tools/install_helper.py prints the exact pip install line for your environment (CUDA version, Python, platform); it installs nothing unless you pass --run.

Common issues

  • cannot load ggml.dll with the file right there - the CUDA wheel's build tag (cu121, cu130, …) doesn't match your actual CUDA runtime. Pick the matching wheel, or take the CPU build if unsure.
  • GGUF answers from text alone - the wheel lacks vision handlers. Verify with from llama_cpp.llama_chat_format import Qwen3VLChatHandler; if it fails, wrong wheel, or it went into a different Python than ComfyUI's.
  • The editor seems frozen mid-answer on GGUF - llama-cpp's prompt evaluation can't be interrupted, so a big multimodal prompt stalls the UI briefly. Describe each media in its own pass breaks it into smaller steps and lets cancellation land between them.
  • Workflows saved with v0.1.1 or earlier load with question and answer swapped. Swap them once and re-save.
  • The model stays in VRAM - GGUFs stay resident between questions. The ⏏ button unloads it (it auto-detects LM Studio vs Ollama), or set Unload after answering.

Even in conversation-continue mode, the text output only ever emits the last <llm> reply, never the whole log, so you can wire it downstream without leaking chat history. Small pack, one node, one job - but if you've ever wanted to ask your reference image a question without burning a queue slot, this is exactly the shape of the answer.

CategoryLLM Widget

Inputs (6)

NameTypeDefaultDescription
system_promptSTRINGYou are a helpful assistant. Reply with the answer only: no preamble, no explanation, no commentary.
generate_on_executeBOOLEANfalse
answerSTRING
questionSTRING
imageoptIMAGE
videooptVIDEO

Outputs (1)

NameTypeDescription
textSTRING