The most common Ollama–OpenClaw failures are not simply “the model is too small.” They are usually a wrong port, an OpenAI-compatible URL used with the native provider, a Gateway in another network namespace, or excessive tool permissions. Validate the native Ollama provider first, let OpenClaw discover the model second, and enable memory and automation last.
This guide assumes localhost or a private LAN. It does not expose Ollama or the OpenClaw Gateway to the public internet.
Choose the Model: Chat Is Not the Same as Agent Work
Confirm four things before selecting a model:
- Ollama has pulled the model and can generate a response.
- Time to first token and sustained throughput are acceptable on your hardware.
- A minimal tool task works; a “hello” prompt is not enough.
- Long tasks have enough context and RAM/VRAM without constant model eviction.
Small models can handle summaries, classification, and fixed workflows. For complex tools, repository understanding, or multi-turn work, test the real task before choosing a larger model or cloud fallback.
|
|
Do not troubleshoot OpenClaw until the second request returns ok.
Connect OpenClaw to the Native Ollama API
The native provider needs the native URL. Do not append /v1 to baseUrl; an OpenAI-compatible route can break tool calls or make the model emit tool JSON as plain text.
For a local setup, define a local marker:
|
|
Use local Ollama during onboarding or configure it explicitly:
|
|
baseUrl is the current key; baseURL remains only for older examples. A local marker is acceptable for loopback, private ranges, .local, or bare hostnames. Public Ollama hosts and Ollama Cloud require real credentials.
Gemma 4 Example
Do not copy an assumed tag such as gemma4:12b. Read the exact local tag:
|
|
Only after this succeeds should the same tag be written into OpenClaw. The name must exactly match ollama list.
Verify That OpenClaw Uses the Model
|
|
If /api/tags works but models list is empty, the provider may be disabled, the Gateway service account may not inherit the environment variable, or the Gateway may run in a container or remote host. Fix the process and network boundary before renaming models at random.
Ports and Containers: localhost Changes Meaning
Ollama normally binds to 127.0.0.1:11434. That is safest when both programs run on the same host, but Docker, WSL, systemd, and remote Gateways change what localhost points to.
| Scenario | Verify |
|---|---|
| Both on the host | The same user can reach 127.0.0.1:11434 |
| OpenClaw in Docker | Container localhost is the container; use a restricted host-reachable address |
| OpenClaw on another host | Private binding, firewall allowlist, and real authentication |
| WSL plus Windows | Run /api/tags from both sides and record the actual route |
Do not bind port 11434 to every public interface merely to make it connect. Prefer a private network or controlled tunnel.
Restrict Permissions Before Enabling Tools
Local inference does not make tool execution safe. Risk comes from what OpenClaw can read, execute, publish, or send.
- Run it as a normal user, not Administrator or root.
- Limit the workspace to a dedicated project or sandbox.
- Require approval for deletion, publishing, outbound messages, credentials, and production access.
- Keep secrets out of prompts, memory, logs, and Git.
- Review every Skill or plugin before installation.
Separate “the agent can execute this” from “the agent may execute this automatically.”
Tune Slow Local Models
Prefer provider-level timeouts and model residency over one oversized global Agent timeout:
|
|
timeoutSeconds covers connection, streaming, and total model-request time. keep_alive reduces repeated cold starts. A shorter Agent-wide timeout can still terminate the task first.
Add a Memory Plugin Only After Inference Works
Use this order for TencentDB Agent Memory:
|
|
|
|
If memory fails, check whether the plugin is enabled, storage is writable, and a genuinely new session was created. If offload hides full logs, inspect the context-engine slot and after-tool-call patch. See the TencentDB Agent Memory guide.
Quick Failure Map
| Symptom | Check first |
|---|---|
connection refused |
Ollama process, port 11434, and network namespace |
| Models list but tools fail | /v1 mistakenly used, or model lacks the tested tool capability |
| Missing API key | OLLAMA_API_KEY=ollama-local and Gateway service environment |
| Frequent timeout | Hardware load, model size, provider timeout, Agent timeout, and keep_alive |
| Memory plugin slows or loses context | Disable offload, validate memory alone, then inspect node_id recovery |
Summary
A stable Ollama–OpenClaw deployment begins with the native API: validate 127.0.0.1:11434/api and the model, configure the native non-/v1 provider, then grant the smallest necessary tool and memory permissions. Testing the model, port, process boundary, and plugin separately is faster and safer than repeatedly reinstalling everything.