Nodes/ComfyUI Ollama/Ollama Chat
ComfyUI Node

Ollama Chat

Multi-turn conversations with a local LLM, not just one-shot generations

By stavsap·Created 2 years ago·Updated 10 months ago· 853
Ollama Chat
  • connectivity
  • options
  • images
  • meta
  • history
  • result
  • thinking
  • meta
  • history
systemYou are an AI artist.
promptWhat is art?
thinkfalse
format
reset_sessionfalse

OllamaGenerateV2 handles a single ask-and-answer well. OllamaChat is for when you actually want a conversation - several turns, with the model remembering what was said earlier, built on Ollama's dedicated chat endpoint (ollama.chat) rather than the plain generate call. The pack's own description is direct about the split: this one is "designed specifically for multi-turn conversations and cloud models with your Ollama public key," where GenerateV2 is closer to a single structured request.

How it works

The mechanical difference from GenerateV2 is where conversation state lives. GenerateV2 round-trips a context blob through your graph manually. OllamaChat keeps history natively inside the node and hands you a dedicated history socket (OLLAMA_HISTORY type) instead - wire one Chat node's history output into the next one's history input and you've got a continuing thread, or split it to branch two different follow-ups off the same conversation point. reset_session clears the current history on demand. Worth repeating the node's own warning here: if multiple nodes share the same history ID, resetting from any one of them clears it for all of them - not just the node you clicked reset on.

Inputs and outputs that matter

  • system and prompt - same shape as GenerateV2: system sets role/behavior, prompt is the actual turn.
  • think - enables a reasoning pass before answering; only works on models trained to support it, fails outright on ones that aren't.
  • format - text or json.
  • connectivity (optional) - an OllamaConnectivityV2 node; required unless you're supplying meta instead. Same hard rule as GenerateV2: leave both empty and the node can't run.
  • options (optional) - an OllamaOptionsV2 bundle.
  • images (optional) - for vision-in-chat; make sure the model actually supports it, or you'll get a confident, wrong answer instead of an error.
  • meta (optional) - chains connectivity/options from another Chat node, same pattern as GenerateV2.
  • history (optional, OLLAMA_HISTORY) and reset_session (bool) - the conversation state and the clear switch.
  • Outputs: result (the answer), thinking, meta, and history to pass forward.

Installing it

Via ComfyUI Manager: search comfyui-ollama (by Stav Sapir), or ollamastavsap. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/stavsap/comfyui-ollama
pip install -r requirements.txt

then restart ComfyUI. If you're pointing this at an Ollama Cloud model that requires auth, set that up on the Ollama side, not on this node - either run ollama signin, or manually add your public key at ollama.com/settings/keys. The key file itself lives at a fixed path per OS (~/.ollama/id_ed25519.pub on macOS, for example), nothing you paste into ComfyUI directly.

Common issues

Node won't run at all. Check that connectivity or meta is actually plugged in - same requirement as GenerateV2, and just as easy to forget when you're mid-rewire.

think breaks generation. Same story as GenerateV2's version of this field: not every model supports a reasoning step, and forcing it on an unsupported one fails rather than degrading gracefully.

Resetting one node wipes a shared history you didn't mean to touch. If you're building a graph with branching conversations off a shared history ID, reset_session isn't node-local - it clears the whole history everywhere it's used. Give each branch its own history if you need independent resets.

Not sure whether you need this over GenerateV2. If you're doing a single ask, or already round-tripping context manually and it's working, there's no reason to switch. Reach for Chat specifically when you want native multi-turn state without wiring context by hand.

CategoryOllama

Inputs (10)

NameTypeDefaultDescription
systemSTRINGYou are an AI artist.System prompt - use this to set the role and general behavior of the model.
promptSTRINGWhat is art?User prompt - a question or task you want the model to answer or perform. For vision tasks, you can refer to the input image as 'this image', 'photo' etc. like 'Describe this image in detail'
thinkBOOLEANfalseIf enabled, the model will do a thinking process before answering. This can result in more accurate results. The thinking is then available as a separate output for debugging or understanding how the model arrived at its answer. Some models don't support this feature and the generation will fail.
formatCOMBOOutput format of the response. 'text' will return a plain text response, while 'json' will return a structured response in JSON format. This is useful when the model is part of a larger pipeline and you need additional processing on the response. In this case I recommend showing the model example outputs in the system prompt. Some models are not trained to perform well in structured output.
connectivityoptOLLAMA_CONNECTIVITYSet an ollama provider for the generation. If this input is empty, the 'meta' input must be set.
optionsoptOLLAMA_OPTIONSConnect an Ollama Options node for advanced inference configuration.
imagesoptIMAGEProvide an image or a batch of images for vision tasks. Make sure that the selected model supports vision, otherwise it may hallucinate the response.
metaoptOLLAMA_METAUse this input to chain multiple 'Ollama Generate' nodes. In this case the connectivity and options inputs are passed along.
historyoptOLLAMA_HISTORYOptionally set an existing model history, useful for multi-turn conversations, follow-up questions.
reset_sessionoptBOOLEANfalseClear the conversation history. WARNING: If using shared history, this will affect all nodes using the same history ID.

Outputs (4)

NameTypeDescription
resultSTRING
thinkingSTRING
metaOLLAMA_META
historyOLLAMA_HISTORY