ComfyUI Node

Ollama Load Model

Preload your Ollama model so the first answer isn't slow

By darth-veitcher·Created 10 months ago·Updated 10 months ago· 2
Ollama Load Model
  • client
  • dependencies
  • client
  • result
  • dependencies
model
keep_alive-1

Ollama Load Model is the node that tells your local Ollama "get this model into memory now." You'll often see it placed between the Model Selector and the Chat Completion, and for once the name isn't a lie: run the workflow and it loads the model so the first chat response doesn't have to wait for a multi-gigabyte model to be read off disk.

Honest take before you overuse it: Ollama already loads models on demand - your first chat call would load it anyway. The node earns its keep in two situations. First, when you want that load to happen at a predictable point, not buried inside a chat call mid-pipeline. Second, and more important, when you want control over how long the model stays resident via keep_alive. That's the real lever here.

How it works

The node sends a load request to your endpoint, trying Ollama's /api/load first and falling back to /api/generate with an empty prompt (with the -1 case converted to a ~999-year keep_alive for that fallback, because the generate endpoint wants a duration). Either way you get back a JSON result you can inspect. The client connection passes through untouched so the rest of your graph keeps working.

The inputs and outputs that matter

  • client (required) - the OLLAMA_CLIENT connection from a Client or Model Selector.
  • model (required) - the model name; wire it from the Selector's model output.
  • keep_alive (required) - a STRING, default -1. This is the one you actually set. -1 means keep loaded indefinitely; 5m / 1h are self-explanatory; 0 unloads immediately. If you want the model out of VRAM after a while without adding an Unload node, this is your timer.
  • dependencies (optional) - wildcard passthrough for forcing execution order.

Outputs: client (passthrough), result (JSON response as a STRING), and dependencies (passthrough).

Installing it

Same shared install: ComfyUI Manager → search "Ollama Manager" → Install → restart, or clone https://github.com/darth-veitcher/comfyui-ollama-model-manager into ComfyUI/custom_nodes and run python install.py. Needs Python 3.12+ plus httpx, loguru, rich (auto-installed). The model itself comes from Ollama - pull it first, or the load just fails with a 404.

Where people get burned

Two gotchas. The first is expecting a "load" to work for a model Ollama doesn't have - pull it first (ollama pull llama3.2), or you'll get an error straight from the Ollama API. The second is that keep_alive is a string, not a number: typing 5 instead of 5m won't mean "five minutes," and a malformed value gets passed to Ollama as-is. And if you're on a single GPU sharing between the LLM and the sampler, remember the default -1 means the model parks in VRAM until you unload it - pair this node with the Unload node for the full memory dance.

CategoryOllama

Inputs (4)

NameTypeDefaultDescription
clientOLLAMA_CLIENT
modelSTRING
keep_aliveSTRING-1
dependenciesopt*

Outputs (3)

NameTypeDescription
clientOLLAMA_CLIENT
resultSTRING
dependencies*