ComfyUI Node

LlamaCPP Chat

The LlamaCPP Chat workhorse

By pointave·Created 6 months ago·Updated 3 months ago· 2
LlamaCPP Chat
  • connectivity
  • options
  • images
  • video
  • audio
  • viz_settings
  • result
  • thinking
  • html_image
systemYou are an AI assistant.
promptHello!
thinkfalse
format
reset_sessiontrue
media_modenone
visualizationdisabled

This is the node the pack exists for. LlamaCPP Chat is a full chat client for a running llama.cpp server, and it does more than text: images in, video in, audio in, multi-turn session memory, a reasoning/thinking mode, and the party trick - it can make the model generate a full HTML page and render it to an image right in your workflow.

The architecture is the thing to understand first. This pack does not run the model. No llama-cpp-python, no CUDA wheels, no compile flags. That's a blessing, honestly - "install llama.cpp in ComfyUI" is a known misery in the community, all mismatched precompiled wheels and MSVC errors. Instead, LlamaCPP Chat just makes HTTP calls to the OpenAI-compatible endpoint of a llama-server you run separately. If you can load a GGUF model in llama.cpp, this node talks to it.

The inputs that matter

  • system and prompt - system message and the current user message. Unsurprising.
  • think - enables a reasoning pass for models that support it (Gemma 3 / Gemma 4, QwQ and friends). It sets chat_template_kwargs.enable_thinking and extracts the model's chain of thought into a separate output instead of leaving raw <think> tags in the text.
  • format - text or json. JSON asks the server for a json_object response via grammar. Note the code's own warning: if think is on and format is json, the JSON request is silently skipped because the grammar conflicts with the thinking template. Pick one.
  • reset_session - every node in ComfyUI has an ID, and this pack keeps the chat history per node ID in ComfyUI's memory. reset_session wipes it. Turn it off and the model remembers previous turns - that's how you get a real conversation. Remember it's in-memory only: restart ComfyUI and the history is gone.
  • media_mode - none / image / video / audio. This is the switch that decides which media socket is active. The clever bit from the README: set none and you can leave images/video/audio wired up without anything being sent - handy when you share a workflow that should work either way.
  • visualization - disabled or html. In html mode the node replaces your system prompt with a "you are a data visualization assistant" one, forces the model to output a single complete HTML document, then renders it to the html_image output.

The optional sockets: connectivity (required in practice - the node raises "Connect a LlamaCPP Connectivity node" without it), options (the sampling bundle), images, video (an IMAGE batch treated as temporal frames, capped at 60), audio (Gemma 4 E2B/E4B only, 30-second cap), and viz_settings (render size/delay for the HTML output).

Outputs

  • result - the model's answer as a string.
  • thinking - the reasoning text when think is on.
  • html_image - the Playwright-rendered screenshot of the HTML output when visualization=html. Blank gray placeholder otherwise.

Getting it running

Install the pack (Manager, search "comfyui-llamacpp-plus", or clone into custom_nodes), then make sure a server is actually up. The connectivity node defaults to http://127.0.0.1:8081:

llama-server -m path/to/model.gguf --jinja --port 8081

--jinja matters: the code literally warns that if you enable think and get no reasoning_content back, your server wasn't started with --jinja.

For the HTML render, you need the optional browser stack:

pip install playwright && playwright install chromium

Without it, html_image comes back as a flat gray placeholder and the error lands in the console. Two more quirks from the source worth knowing: video mode downsamples your frame batch (via the video_frame_step/video_max_frames options) and sends frames as base64 data URLs, so "60 frames max" is a hard budget, not a suggestion - and the keep_alive setting on the connectivity node controls whether the model gets unloaded from VRAM after each run.

This is a small, personal pack, so set expectations: it's a client, and it's happiest when the server is healthy and the model is a solid GGUF quant. But as an in-graph LLM with vision, video, and HTML output, there's not much else this cheap.

CategoryLlamaCPP API

Inputs (13)

NameTypeDefaultDescription
systemSTRINGYou are an AI assistant.
promptSTRINGHello!
thinkBOOLEANfalse
formatCOMBO2 options: text, json
reset_sessionBOOLEANtrue
media_modeCOMBOnoneWhich optional media socket to process. none=text only (inputs ignored even if wired), image=still frames, video=temporal batch, audio=AUDIO input (Gemma4 E2B/E4B only)
visualizationCOMBOdisabledhtml: forces full HTML document output and renders the result to html_image via Playwright.
connectivityoptLLAMACPP_CONNECTIVITY
optionsoptLLAMACPP_OPTIONS
imagesoptIMAGEActive when media_mode=image
videooptIMAGEActive when media_mode=video. Batch treated as temporal frames. Max 60 frames.
audiooptAUDIOActive when media_mode=audio. Gemma4 E2B/E4B only. Max 30 s.
viz_settingsoptLLAMACPP_VIZ_SETTINGSWire a LlamaCPP Visualizer HTML node to control render width/height/delay. Optional — defaults to 800x600.

Outputs (3)

NameTypeDescription
resultSTRING
thinkingSTRING
html_imageIMAGE