Ollama API
Run a local LLM in ComfyUI, free and offline
- image1
- image2
- image3
- image4
- image5
- video
- audio
- text
This is the one node in the pack with no API key, no bill, and no data leaving your machine. It talks to Ollama, the local LLM runner, so a language model runs on your own hardware and answers from inside your ComfyUI graph. Text and images in, a string out. If the OpenAI and Claude nodes are the "pay per call" options and Gemini is the "free tier with a catch," Ollama is the actually-free, actually-private one - provided you're willing to run the model yourself.
What it needs before it works
Here's the part the node can't do for you: Ollama has to be installed and running separately. ComfyUI-OllamaGemini does not bundle it. You install Ollama from ollama.com, pull a model (ollama pull llama3, or a vision model like ollama pull llava), and leave the Ollama server running. Only then does this node have something to talk to. The ollama_model dropdown is populated from whatever models you've actually pulled locally - the lone "llama2" you might see is just a placeholder sample, not the only option. If the dropdown is empty or stale, you haven't pulled a model, or the Ollama server isn't up.
One consequence worth stating plainly: on a cloud or serverless ComfyUI, there is no local Ollama unless the host is running one for you. This node shines on your own PC, where you control the machine.
The two jobs
Local chat and vision. Set input_type to image and wire a picture into an image1–image5 slot with a vision model like LLaVA, and it captions or analyzes the image entirely offline. Great for bulk dataset captioning where you don't want to pay per image or ship your renders to a cloud API. It also lists video and audio input types for models that handle them.
Prompt optimization. Turn structure_output on, pick a prompt_structure template (FLUX.1-dev, SDXL, Imagen4, VideoGen, FLUXKontext, GeminiNanaBananaEdit), and the local model rewrites your idea into a prompt shaped for that target. Same logic as the cloud nodes - prompting is encoder-specific, so translating your intent into the right dialect matters - except here it's free and private. The tradeoff is quality: a 7B local model writes a rougher prompt than GPT-4o or Claude. For a lot of work that's fine; for the finicky stuff it isn't.
The inputs and outputs that matter
prompt- your instruction or seed.ollama_model- pick from your locally pulled models. This is the field that trips people up; see above.input_type-text/image/video/audio. Match it to what you're feeding.keep_alive(0–60) - how long, in minutes, Ollama keeps the model loaded in memory after the call. Bump it if you're running many generations in a row so the model doesn't reload every time; leave it low to free VRAM between runs.structure_output+prompt_structure- optimizer switch and target template.
Output: text, a string, into a CLIP Text Encode, a Save Text node, or the next node.
Installing the node
The Ollama server you install separately (above). The node comes with the pack - ComfyUI Manager: search ComfyUI-OllamaGemini, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/al-swaiti/ComfyUI-OllamaGemini
pip install -r requirements.txt
then restart. If your Ollama server runs somewhere other than the default http://localhost:11434, set OLLAMA_URL in the pack's config to point at it.
Where people get burned
Almost every "it doesn't work" here is the server, not the node. Symptoms and causes: empty model dropdown → you haven't pulled a model, or Ollama isn't running. Connection errors → wrong OLLAMA_URL, or the server's down. Image input ignored → you loaded a text-only model; pull a vision model like llava and select it. VRAM pressure → a big local LLM competes with your diffusion model for the same GPU, so a high keep_alive plus a large checkpoint can OOM you; drop keep_alive or run a smaller model. Get the server sorted first, and the node just works.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | What is the meaning of life? | — |
| input_type | COMBO | text | 4 options: text, image, video, audio |
| ollama_model | COMBO | 1 options: llama2 | |
| keep_alive | INT | 00–60 | — |
| structure_output | BOOLEAN | false | — |
| prompt_structure | COMBO | Custom | 7 options: Custom, VideoGen, FLUX.1-dev, SDXL, FLUXKontext, Imagen4, +1 |
| structure_format | STRING | Return only the prompt text itself. No explanations or formatting. | — |
| output_format | COMBO | raw_text | 2 options: raw_text, json |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| image4opt | IMAGE | — | |
| image5opt | IMAGE | — | |
| videoopt | IMAGE | — | |
| audioopt | AUDIO | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |