Ollama Text To Text
Run your LLM prompt-engineer locally, no API key, no cloud
- response
- context
Ollama Text To Text is the "no cloud, no key" option in this pack - the one that talks to whatever LLM you already have running in Ollama on your own machine. The author adapted it from the ComfyUi-Ollama-YN and ComfyUI-Prompt-MZ projects (credited in the README), and it shows: this is the most parameter-heavy chat node here, because it's basically the whole Ollama generate API exposed as a node.
The default system prompt is a tell: "You are creating a prompt for Stable Diffusion to generate an image..." with the output capped under 200 tokens. This node is designed as a local prompt-expander. Drop in "1girl" (the default prompt, cheekily), get a full SD-flavored prompt back, wire the response into your CLIP text encode. It talks to Ollama at http://localhost:11434 via the ollama Python client.
The inputs are the full Ollama sampling kit: model (populated from models you have pulled), extra_model (an override - set it and it replaces the selected model for that run), prompt, system, seed, top_k, top_p, temperature, max_tokens, tfs_z, and keep_alive (how long to hold the model in RAM after a call - 0 unloads, 5m/30m keep it warm). Two outputs: response (the text) and context, which is Ollama's raw context tokens - feed that back into the context input of the same node to carry a multi-turn conversation cheaply, which is a neat trick most chat nodes here don't have.
Installing it
Same pack, plus two extras. First the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/yiwangsimple/ComfyUI_GroqChat
Second, the ollama Python package is not in requirements.txt, so install it yourself:
pip install ollama
Third - the big one - you need an Ollama server running with a model pulled. The README's install of Ollama is up to you; the node assumes it's already at localhost:11434 when ComfyUI starts.
The gotcha that everyone hits
The model dropdown is populated once, at import time, by querying http://localhost:11434/api/tags. If Ollama isn't running when ComfyUI boots, the dropdown reads "No models found" and stays that way until you restart ComfyUI. Restart order matters: start Ollama first, then ComfyUI, and pull your model (ollama pull llava for vision, or any text model) before the restart. This trips up more people than any other issue in this pack, and it's purely a timing thing.
One more honest note: tfs_z and top_k default tuning barely matters for prompt expansion - leave them alone. The single lever that changes your results is which model you pulled and the system prompt.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | 1girl | — |
| model | COMBO | 1 options: No models found | |
| extra_model | STRING | none | — |
| system | STRING | You are creating a prompt for Stable Diffusion to generate an image. First step: understand the input and generate a text prompt for the input. Second step: only respond in English with the prompt itself in phrase, but embellish it as needed but keep it under 200 tokens. | — |
| seed | INT | 00–18446744073709550000 | — |
| top_k | FLOAT | 400–100 | — |
| top_p | FLOAT | 0.900–1 | — |
| temperature | FLOAT | 0.500–1 | — |
| max_tokens | INT | 1001–1024 | — |
| tfs_z | FLOAT | 1.001–1000 | — |
| keep_alive | COMBO | 6 options: 0, 5m, 10m, 15m, 30m, 60m | |
| contextopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |
| context | STRING | — |