A lot of agent harnesses can talk to anything that speaks the OpenAI API. Ollama exposes one on your own machine, so you can try a local model without sending code anywhere. Here’s how I set it up and make sure it stays local.
1. Pick a model you already have
ollama list
# pull one if the list is empty:
# ollama pull <model>
2. Confirm the OpenAI-compatible endpoint answers
curl -s http://localhost:11434/v1/models | jq '.data[].id'
curl -s http://localhost:11434/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"<model>","messages":[{"role":"user","content":"Say hi in five words."}]}' \
| jq -r '.choices[0].message.content'
3. Make sure it’s only listening locally
Ollama has no login on that port, so it should be bound to loopback unless you mean otherwise:
ss -ltnp | grep 11434
# good: 127.0.0.1:11434 risky: 0.0.0.0:11434 or *:11434
If it shows 0.0.0.0, check whether OLLAMA_HOST is set in the service, and remove it or set it to 127.0.0.1:11434.
4. Point the agent at it
Many tools read the standard OpenAI variables. The key can be any placeholder, since Ollama ignores it:
export OPENAI_BASE_URL=http://localhost:11434/v1
export OPENAI_API_KEY=ollama
# then pick <model> in your agent's model setting
Check your harness’s docs for its exact setting names. Some want a provider entry in a config file instead. Start with a small task and watch speed and quality before you hand a local model anything big.
God Bless, and May the Source Be with You!