ComfyUI-Ollama-ImageList
ComfyUI Ollama node for image list
Nodes (18)
ComfyUI Ollama Image List
ComfyUI V3 custom nodes that send a single stateless Ollama /api/chat request containing all supplied images. Image batches, ComfyUI data lists, nested lists, and lists of batches are flattened deterministically while each image keeps its original width, height, channels, and order.
Nodes
- Ollama Image List Connectivity — fetches available models from an Ollama server and outputs the selected URL and model name.
- Ollama Image List Options — builds Generate-compatible options dictionary and JSON outputs from individually enabled Ollama runtime parameters.
- Ollama Generate (Image List) — sends the system prompt, user prompt, and all normalized images in one non-streaming request.
Install
Clone this repository into ComfyUI/custom_nodes. Runtime dependencies are provided by ComfyUI.
To run the development tests, sync the development environment:
uv sync --locked --group dev
Ollama and llama-cpp-python Python packages are not required. The node uses Python's standard HTTP client and expects an Ollama server, which defaults to http://127.0.0.1:11434.
Input semantics
A ComfyUI IMAGE batch and a data list are different:
- A batch is one tensor shaped
[B,H,W,C]; all entries normally share H×W. - A data list is a list of independent values and may contain tensors with different H×W.
The nodes declare V3 is_input_list=True, so ComfyUI passes the complete data list to one execution instead of mapping the node over each item. The normalizer recursively splits every batch and preserves traversal order. Each image is independently encoded as PNG; it is never resized, cropped, padded, letterboxed, or combined into a montage.
The implementation follows ComfyUI's official data list semantics and V3 migration/schema reference.
All scalar inputs (url, model, prompts, and options) must resolve to exactly one value. Supplying a data list of multiple prompts is an error rather than silently choosing one.
Ollama connectivity
The connectivity node contains url, available_models, and editable model widgets plus a Fetch button. It requests the model list when the node is created and whenever Fetch is pressed. Choosing an entry in available_models copies the exact name into model; the model field remains editable for names that are not currently reported by the server.
Model discovery is proxied through the ComfyUI server to Ollama's GET /api/tags endpoint, avoiding browser CORS restrictions. The node outputs independent URL and model strings that can be connected directly to the generate node.
Ollama options
The options node exposes an Include/Ignore toggle followed by a typed value widget for each documented parameter. Disabled parameters are omitted rather than being sent with their displayed defaults. The inputs are ordered as num_ctx, num_predict, temperature, top_p, top_k, min_p, repeat_penalty, repeat_last_n, seed, stop, and draft_num_predict.
Connect the first options output directly to the generate node's options input for normal use. The second options_json output is provided for debugging, manual inspection, and string-based utility nodes. A selected stop string is encoded as the one-item array required by Ollama's HTTP API.
Ollama request
The generate node creates one request with this logical structure:
system message + user message + images[] -> POST /api/chat -> response/thinking/metrics
system is placed in a system-role message and prompt is placed in the current user-role message without trimming or rewriting. Images belong only to that request; this node does not create a persistent session or preserve them in later history.
Use the options dictionary input for Ollama generation options such as temperature, top_p, top_k, min_p, seed, num_ctx, num_predict, repeat_penalty, and stop. The advanced options_json field remains available as a manual fallback. If both are supplied, the connected dictionary takes precedence, including an empty dictionary. format_json accepts an empty value, the literal json, or a JSON Schema object.
Enable unload_after_response to send keep_alive: 0, which tells Ollama to unload the model as soon as the response is complete. This overrides the keep_alive input while enabled; when disabled, the configured keep-alive value is used as before.
To verify that a data list produced one request, enable Ollama server logging and look for one POST /api/chat, or enable the node's debug option and inspect the payload-free request manifest. The manifest includes counts, dimensions, byte sizes, hashes, and prompt character counts, but never base64 payloads or prompt text.
Model support for multiple images varies. If a model or server rejects a request, the node reports the backend error and does not resize, remove, montage, or split images into multiple calls.
Request and response fields follow Ollama's official Chat API.
Public scope
The public Generate node accepts images only. The Media Bundle node is not registered, and media, audio, and audio_transport inputs are intentionally not exposed. Their internal experimental implementation is retained only to make a future opt-in feature possible without expanding the current project scope.
Privacy and limits
Images are transmitted to the configured Ollama URL. A non-loopback or remote URL can therefore receive private images. URL credentials and image payloads are excluded from manifests and backend error summaries.
Default safeguards limit image count, pixels per image, nesting depth, raw tensor size, and encoded payload size. Limit violations fail before the HTTP request; no automatic fallback changes request meaning.
Development
uv run pytest
See testing documentation and implementation status.
To replace the node installed in the local portable ComfyUI instance with the current runtime package, run:
./scripts/deploy-to-portable.ps1
Use -WhatIf to inspect the fixed deployment target without replacing it. Restart ComfyUI after deployment.
Roadmap
v0.1.0 targets Ollama image single/batch/data-list support with non-streaming response, thinking, metrics, unit tests, and a mock-server integration test. Capability diagnostics, real-model compatibility results, optional Media Bundle and audio experiments, and llama-cpp-python support may follow in later milestones described by PLAN.md.
License
MIT