OpenClaw with Ollama
The three modes, the URL mistake that breaks tool calls, discovery rules, and the WSL2 crash loop
Ollama is the docs’ easiest path to a local model, and the page about it opens with a warning rather than a welcome: OpenClaw talks to Ollama’s native API, and pointing it at the OpenAI-compatible URL breaks tool calling. Three modes are supported, cloud plus local through a signed-in host, cloud only against Ollama’s own service, and local only. Here is what onboarding discovers and what it refuses to assume, the auth rules per kind of host, the troubleshooting list, and the rule about small models that does not go away because the model is free.
Do not use the /v1 OpenAI-compatible URL (http://host:11434/v1). It breaks tool calling and models can emit raw tool-call JSON as plain text.
Setup
- Onboarding: select Ollama and pick a mode. On a fresh guided setup OpenClaw checks the default or configured host, and automatic discovery considers only models already loaded in memory, with tool support and at least 16K of context confirmed; a model installed but idle is not a candidate, the route needs a real completion before it is saved, and discovery never pulls or loads anything.
- Cloud only prompts for the API key and suggests hosted defaults; cloud plus local and local only prompt for a base URL and inspect installed models, and if no tools-capable model is found, setup can ask permission to pull a recommended one. A model advertised as embedding-only cannot become the chat default.
- Manual: install Ollama, pull a model, sign in on the same host for hybrid cloud access, set a credential, any value for a local or LAN host and the real key for Ollama’s service, then set the model reference as ollama, slash, the model name.
Auth rules
Loopback, private-network, dot-local and bare-hostname hosts need no real bearer token; OpenClaw uses a local marker for them. Public remote hosts and Ollama’s service need a real credential, and the docs prefer the dedicated cloud provider id for direct hosted use so cloud routing stays separate from a local provider. A bare environment key is treated as the cloud convention and is not sent to local hosts by default, and bearer auth for memory embeddings is scoped to the host it was declared for.
Troubleshooting
- WSL2 crash loop: the official Linux installer creates a service with restart always; on a CUDA setup it can load a model during boot, pin host memory, get the VM terminated by Windows, and restart forever. Disable the service, turn off automatic memory reclaim in the WSL config, or run Ollama by hand with a short keep-alive.
- Not detected: confirm it is running and in the agent’s model scope; ambient localhost discovery needs the key variable or an auth profile, and a nonempty manual model list skips discovery altogether.
- No models: pull one or define it explicitly. Connection refused: check the process and restart. Tool JSON printed as text: the OpenAI-compatible URL, the mistake from the top of the page.
Free models for OpenClaw sets Ollama beside LM Studio, llama.cpp and the other backends, and Install OpenClaw on Windows is where the WSL2 setup begins.
The rule that still applies
The models FAQ says it in one breath with the Ollama quick start: smaller and heavily quantized models are more vulnerable to prompt injection, use large models for any bot with tool access, and if you use small ones anyway, enable sandboxing and strict tool allowlists. OpenClaw and prompt injection explains the attack and OpenClaw sandboxing explained the containment.
On Diali
On Diali there is no Ollama to install: the models are in the managed catalog and paid from included credits. Hosted OpenClaw on Diali is the assistant, and OpenClaw models and providers lists what the catalog covers.
- Native API, never the OpenAI-compatible URL.
- Discovery sees loaded models only; setup pulls nothing without asking.
- Local hosts need a marker, remote hosts a key, small models a sandbox.
Stop reading about it, build one
Set up an agent, pick a channel, and have it working inside the app you already keep open.
