LlamaCPP Chat
The LlamaCPP Chat workhorse
- connectivity
- options
- images
- video
- audio
- viz_settings
- result
- thinking
- html_image
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_thinkingand extracts the model's chain of thought into a separate output instead of leaving raw<think>tags in the text. - format -
textorjson. JSON asks the server for ajson_objectresponse via grammar. Note the code's own warning: ifthinkis on andformatis 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_sessionwipes 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: setnoneand you can leaveimages/video/audiowired up without anything being sent - handy when you share a workflow that should work either way. - visualization -
disabledorhtml. Inhtmlmode 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
thinkis 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.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| system | STRING | You are an AI assistant. | — |
| prompt | STRING | Hello! | — |
| think | BOOLEAN | false | — |
| format | COMBO | 2 options: text, json | |
| reset_session | BOOLEAN | true | — |
| media_mode | COMBO | none | Which 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) |
| visualization | COMBO | disabled | html: forces full HTML document output and renders the result to html_image via Playwright. |
| connectivityopt | LLAMACPP_CONNECTIVITY | — | |
| optionsopt | LLAMACPP_OPTIONS | — | |
| imagesopt | IMAGE | Active when media_mode=image | |
| videoopt | IMAGE | Active when media_mode=video. Batch treated as temporal frames. Max 60 frames. | |
| audioopt | AUDIO | Active when media_mode=audio. Gemma4 E2B/E4B only. Max 30 s. | |
| viz_settingsopt | LLAMACPP_VIZ_SETTINGS | Wire a LlamaCPP Visualizer HTML node to control render width/height/delay. Optional — defaults to 800x600. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| result | STRING | — |
| thinking | STRING | — |
| html_image | IMAGE | — |