ollama - Publicly Expose API

ollama - Publicly Expose API

Setup

You'll need to modify the ollama.service file.

In Ubuntu the file exists under /etc/systemd/system/ollama.service

Then add the following under the [Service] section:

Environment="OLLAMA_HOST=0.0.0.0:11434"

Then reload and restart systemctl:

sudo systemctl daemon-reload && sudo systemctl restart ollama

Verify

curl http://ollama.lan:11434/api/generate -d '{ "model": "llama3.2", "prompt": "How are you today?", "stream": true}'