Llama.cpp Generate (Multimodal)
The GGUF node that runs a vision model inside ComfyUI — no Ollama server required
- sampling
- runtime
- ngram_speculative
- images
- audio
- video
- response
- thinking
- raw JSON
- metrics
- media diagnostics
If the Ollama node is the "talk to a server" path, Llama.cpp Generate (Multimodal) is the "run it in my own process" path - and it's the one the community has been asking for since the KB's LLM-in-ComfyUI doc tracked the standing want: "Would be nice if we could use any GGUF llm model without ollama tho." This node loads one GGUF directly inside ComfyUI through llama-cpp-python, does exactly one stateless multimodal chat completion, then closes and releases the model immediately. No model cache, no retained context, no separate server process.
The mechanism is worth being precise about, because it explains both the appeal and the gotchas. Any request with IMAGE, AUDIO, or VIDEO needs a matching mmproj GGUF (the multimodal projector for that exact model family) - without it, media is rejected. The handler input picks the chat template: auto uses model metadata and the fork's generic MTMD path, and you can pin gemma4, qwen3_vl, qwen25_vl, or qwen3_asr when a template requires it. thinking is an explicit boolean request - it doesn't infer a model default, and it can't turn an Instruct-only checkpoint into a thinking checkpoint. All your media becomes one user message (order always IMAGE, then AUDIO, then VIDEO), and it all lands in one completion call.
Model discovery is tidy: the node scans .gguf files recursively from every ComfyUI model path whose category is LLM (including extra_model_paths.yaml entries) plus models/LLM as a fallback. Both model_path and mmproj_path see the full inventory; the projector list just puts names containing mmproj first for convenience.
The inputs you'll touch most: model_path and mmproj_path (pick the GGUF pair), system and prompt, n_ctx (default 8192, and vision models eat context fast), max_tokens, gpu_layers (all/auto/CPU), and the sampling params with defaults tuned low (temperature 0.2, top_p 0.95). The advanced section has real teeth, so read the tooltips: image_max_tokens (default 1120) sets the per-image token ceiling, and n_batch/n_ubatch must be large enough to cover it or you'll fail before the model even loads. Two optional typed inputs clean things up: a Sampling Preset overrides the five sampling floats, and a Gemma 4 Runtime Preset overrides the batch/token overrides. Outputs are response, thinking, raw JSON, metrics, and a media diagnostics receipt you can expand with the pack's diagnostics node.
Now the honest part: the dependency. llama-cpp-python is deliberately not a package requirement, because this targets JamePeng's multimodal fork and a usable wheel must match your OS, CPU architecture, the exact Python ABI of the interpreter that starts ComfyUI, and your native backend (CUDA, ROCm, Vulkan, Metal). The CUDA tag on your PyTorch build does not select the wheel - they're separate native runtimes. Install it into ComfyUI's actual Python environment, not a random system Python:
# Windows portable: use the embedded interpreter, e.g.
.\python_embeded\python.exe -m pip install llama-cpp-python # a JamePeng fork wheel
See the JamePeng releases page and the ComfyUI-ThinkingLLM install notes linked in the error message. VIDEO input additionally requires a wheel built with MTMD_VIDEO support (no separate FFmpeg needed - it uses llama.cpp's native libmtmd helper). Restart ComfyUI after installing the wheel. If the wheel is missing, everything else in the pack still loads; only this node errors, with the install guide in the message.
Getting the pack itself is the usual:
cd ComfyUI/custom_nodes
git clone https://github.com/craftingmod/ComfyUI-Ollama-ImageList
One heads-up for beginners: this detailed node lives under Ollama / llama_cpp / legacy and is marked V3 development-only, so normal ComfyUI sessions hide it from search and the add-node menu - enable developer mode to see it. The pack's compact "Llama.cpp Generate" is the one meant for everyday use. If you're new to GGUF, the KB's format panel is the right primer: Q8 is basically fp16 at half the size, and the projector is not optional for vision. When the backend rejects something, you get its real error - this node never resizes, drops, or silently splits media to force a request through.
Inputs (36)
| Name | Type | Default | Description |
|---|---|---|---|
| model_path | COMBO | [no GGUF models found] | Main model GGUF from ComfyUI's registered LLM paths. The list is not filtered by filename; choose a compatible main model. |
| mmproj_path | COMBO | [none] | Optional multimodal projector GGUF from the same unfiltered list. Choose [none] for text-only requests. |
| handler | COMBO | auto | auto uses the model metadata and the fork's generic MTMD handler. Select a model-specific handler when its template requires one. |
| thinking | BOOLEAN | false | Explicitly request thinking through the selected handler's template control. Gemma 4 uses enable_thinking and Qwen 3 VL uses force_reasoning. A checkpoint that does not support switching may ignore this value. |
| system | STRING | Optional system message sent without trimming or rewriting. | |
| prompt | STRING | User message sent without trimming or rewriting. | |
| n_ctx | INT | 8192512–1048576 | Context window in tokens, including media tokens and output. |
| max_tokens | INT | 5121–131072 | Maximum number of generated tokens. |
| gpu_layers | COMBO | all | Offload all layers, let llama.cpp decide, or use CPU only. |
| temperature | FLOAT | 0.200–5 | — |
| top_p | FLOAT | 0.950–1 | — |
| top_k | INT | 400–10000 | — |
| min_p | FLOAT | 0.050–1 | — |
| repeat_penalty | FLOAT | 1.000–5 | — |
| seed | INT | -1-1–4294967295 | -1 uses llama.cpp's random seed behavior. |
| stop | STRING | Optional single stop string. | |
| n_batch | INT | 5121–65536 | Logical prompt batch size. When an image token limit is overridden, this must be at least the effective limit. |
| override_n_ubatch | BOOLEAN | false | Pass n_ubatch explicitly. Leave disabled to use llama-cpp-python's default. |
| n_ubatch | INT | 5121–65536 | Physical batch size used only when override_n_ubatch is enabled. Gemma 4 vision requires it to cover the selected image token chunk. |
| override_image_max_tokens | BOOLEAN | false | Pass an explicit dynamic-resolution image token ceiling to the MTMD handler. Leave disabled to read the projector's default. |
| image_max_tokens | INT | 11201–65536 | Per-image or per-video-frame token ceiling used only when its override is enabled. n_batch and effective n_ubatch must be at least this value. |
| main_gpu | INT | 00–31 | — |
| n_threads | INT | 00–1024 | 0 lets llama-cpp-python choose the CPU thread count. |
| flash_attention | COMBO | auto | 3 options: auto, enabled, disabled |
| use_mmap | BOOLEAN | true | Memory-map the GGUF while loaded; the mapping is closed after the response. |
| verbose | BOOLEAN | false | Print llama.cpp model, timing, and multimodal chat-handler diagnostics to the ComfyUI console. |
| reasoning_strength | COMBO | auto | Optional reasoning effort hint for templates such as Muse-Glimmer. auto omits the hint so the model template uses its own default. Ignored when thinking is disabled. |
| reasoning_budget | INT | 00–65536 | Maximum reasoning tokens for supported Qwen/Gemma reasoning formats. 0 applies no budget. Ignored when thinking is disabled. |
| override_image_min_tokens | BOOLEAN | false | Pass an explicit dynamic-resolution image token floor to the MTMD handler. Qwen-VL grounding tasks may require 1024 or more. |
| image_min_tokens | INT | 10241–65536 | Per-image or per-video-frame token floor used only when its override is enabled. n_batch and effective n_ubatch must cover this value. |
| samplingopt | OLLAMA_IMAGE_LIST_LLAMA_CPP_SAMPLING | Optional output from Llama.cpp Sampling Preset. When connected, it overrides temperature, top_p, top_k, min_p, and repeat_penalty. | |
| runtimeopt | OLLAMA_IMAGE_LIST_LLAMA_CPP_GEMMA4_RUNTIME | Optional output from Llama.cpp Gemma 4 Runtime Preset. When connected, it overrides the Advanced n_batch, n_ubatch, image_max_tokens, and both override switches. Connect the preset's separate n_ctx and max_tokens outputs to apply those visible values. | |
| ngram_speculativeopt | OLLAMA_IMAGE_LIST_LLAMA_CPP_NGRAM_SPECULATIVE | Optional output from Llama.cpp N-gram Speculative Preset. This model-free mode uses repeated context patterns and no draft GGUF. It is separate from Experimental native DFlash/DSpark decoding. | |
| imagesopt | IMAGE | IMAGE single, batch, list, nested list, or ComfyUI data list. | |
| audioopt | AUDIO | Optional ComfyUI AUDIO single, batch, list, or nested list. Audio is encoded as lossless PCM16 WAV and requires an audio-capable mmproj. | |
| videoopt | VIDEO | Optional ComfyUI VIDEO input. The original encoded stream is passed to llama.cpp's native libmtmd video helper and requires a wheel built with MTMD_VIDEO support plus a compatible mmproj. Embedded audio is not ingested; connect AUDIO separately. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |
| thinking | STRING | — |
| raw JSON | STRING | — |
| metrics | STRING | — |
| media diagnostics | OLLAMA_IMAGE_LIST_LLAMA_CPP_MEDIA_DIAGNOSTICS | — |