Tuesday, 25 August 2026 | Updating Daily AI insight, written for builders

Ollama and OpenClaw: How to Run OpenClaw on a Local Model

  • There is no dedicated Ollama integration. You connect OpenClaw to Ollama through Ollama’s OpenAI-compatible API at http://localhost:11434/v1, treating it as a generic OpenAI-style provider.
  • Model choice is the whole game. OpenClaw is an agent loop that calls tools, so you need a model with native tool-calling support — qwen3, gpt-oss, llama3.1/3.3, mistral-small. A chat-only model will fail silently by describing tool calls instead of making them.
  • Raise the context window. Ollama’s default context is far smaller than OpenClaw’s system prompt plus tool schemas plus conversation. Build a Modelfile with PARAMETER num_ctx 32768 or larger.
  • Expect a real quality drop. Local models under ~30B parameters lose multi-step task chains that frontier models complete. A hybrid setup — local for routine replies, cloud for hard tasks — is the practical answer.

OpenClaw is a self-hosted AI assistant that talks to you over messaging apps and drives tools on your machine. It has no Ollama-specific integration; you connect the two by pointing OpenClaw’s model provider at Ollama’s OpenAI-compatible endpoint, http://localhost:11434/v1. It works, but only with a model that reliably calls tools and a context window well above Ollama’s default.

What OpenClaw actually is

OpenClaw is an open-source personal assistant that runs as a long-lived gateway process on your own hardware. It bridges messaging channels — WhatsApp, Telegram, Discord, Signal, iMessage — to an agent loop with tool access: shell commands, file operations, web fetches, calendar and memory. The project began as Clawdbot, was briefly renamed Moltbot, and settled on OpenClaw. Its default brain was an Anthropic model, but because it speaks the OpenAI chat-completions protocol for third-party providers, anything that serves that protocol can substitute — including Ollama.

One disambiguation: an unrelated project called OpenClaw is a C++ reimplementation of the 1997 platformer Captain Claw. It has nothing to do with LLMs. If you searched “ollama openclaw”, you almost certainly want the assistant.

Why this pairing is harder than a chat UI

Pointing a chat frontend at Ollama is trivial. An agent framework is not, for three reasons:

  • Tool calling must be structurally correct. OpenClaw sends tool definitions and expects JSON tool-call objects back. Models without a tool-aware chat template produce prose like “I’ll now run ls” and the loop stalls.
  • The prompt is large before you type anything. System instructions plus tool schemas routinely consume several thousand tokens. Ollama’s default context truncates that, and truncation at the front of the prompt removes exactly the instructions the agent depends on.
  • Errors compound across turns. A model with 90% per-step tool accuracy completes a six-step task about half the time.

Step 1: Get Ollama serving on a reachable address

If Ollama isn’t installed yet, follow the Ollama installation guide first. Confirm the server responds:

curl http://localhost:11434/api/version
curl http://localhost:11434/v1/models

If OpenClaw runs on the same host and outside a container, the default loopback binding is fine and you can skip to Step 2. If OpenClaw runs in Docker or on another machine, Ollama must bind beyond loopback via OLLAMA_HOST. How you set that differs by platform.

macOS

The menu-bar app does not read your shell profile. Set the variable in the launch environment, then restart the app from the tray icon:

launchctl setenv OLLAMA_HOST "0.0.0.0:11434"

Models live in ~/.ollama/models. Server logs are under ~/.ollama/logs/. From a container on the same Mac, reach the host at http://host.docker.internal:11434.

Linux

The installer registers a systemd unit. Override its environment rather than editing the shipped unit file:

sudo systemctl edit ollama.service

Add:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_KEEP_ALIVE=-1"

Then sudo systemctl daemon-reload && sudo systemctl restart ollama. Logs come from journalctl -u ollama -f. Under the service account, models default to /usr/share/ollama/.ollama/models, not your home directory — a common surprise when ollama list looks empty as root.

Windows

Set the variable through the GUI: Start → “Edit the system environment variables” → Environment VariablesNew under User variables, name OLLAMA_HOST, value 0.0.0.0:11434. Quit Ollama from the system tray and relaunch it; the tray process reads environment variables only at startup. Models sit in %USERPROFILE%.ollamamodels; logs in %LOCALAPPDATA%Ollama.

OpenClaw itself is a Node application and is most reliably run on Linux or macOS. On Windows, run it inside WSL2. In that case Ollama can stay as a native Windows install — WSL2 reaches the Windows host over the mirrored or NAT gateway address, so verify with curl from inside WSL before configuring anything.

Security note: Ollama has no authentication. Binding 0.0.0.0 exposes model inference to every host that can route to that port. Keep it on a trusted LAN or VPN, or front it with a reverse proxy that requires a token. Never expose it to the public internet.

Step 2: Pull a model that can call tools

Tool calling in Ollama depends on the model’s chat template, not on a flag you pass. Sizes below are approximate for common 4-bit tags and shift between releases — check ollama list and the current tag listing for exact figures.

Model tagParamsApprox. downloadPractical VRAM at 32K ctxFit for OpenClaw
llama3.1:8b8B~4.7 GB8–10 GBFloor. Simple single-tool tasks only.
qwen3:8b8B~5 GB8–10 GBBetter tool discipline than Llama 3.1 8B.
qwen3:14b14B~9 GB12–16 GBGood balance on a 16 GB card.
gpt-oss:20b20B MoE~14 GB16 GBStrong tool use; fast due to sparse activation.
mistral-small24B~14 GB16–20 GBReliable function calling.
qwen3:32b32B~20 GB24 GB+Best realistic local experience.

Pull one and verify it accepts tools before touching OpenClaw:

ollama pull qwen3:14b

For a wider comparison of candidates and their behaviour under agent workloads, see the best local models for Ollama.

Step 3: Raise the context window

This is the step people skip, and it is the most common cause of an OpenClaw-on-Ollama setup that “almost works”. Ollama applies a modest default context (historically 2048, raised in later releases) regardless of what the model supports. Recent versions accept a server-wide OLLAMA_CONTEXT_LENGTH environment variable, but the version-independent method is to bake it into a derived model:

FROM qwen3:14b
PARAMETER num_ctx 32768

Save as Modelfile, then:

ollama create qwen3-14b-32k -f Modelfile

Use qwen3-14b-32k as the model name in OpenClaw. Larger contexts cost VRAM for the KV cache, which is separate from the weights — use the VRAM calculator to see what a given model and context length actually needs before you find out by OOM. On recent Ollama builds, OLLAMA_FLASH_ATTENTION=1 and a quantized KV cache (OLLAMA_KV_CACHE_TYPE=q8_0) meaningfully reduce that overhead.

Step 4: Point OpenClaw at Ollama

OpenClaw stores configuration in a dot-directory under your home (~/.openclaw/) and allows environment-variable overrides. The three values you need are always the same in substance:

SettingValue
Base URLhttp://localhost:11434/v1 — the /v1 suffix is mandatory
API keyAny non-empty string, e.g. ollama. The value is ignored but many clients reject an empty one.
ModelExact tag from ollama list, including the :tag portion

The exact config key names have moved across the project’s renames and its fast release cadence. Rather than copying a config blob from a blog post, run the CLI’s help output and inspect the generated config file on your installed version:

openclaw --help

Practically, you are looking for the generic OpenAI-compatible provider block — the same one used for OpenRouter, vLLM or LM Studio — and setting base URL, key and model there. If OpenClaw exposes provider selection during onboarding, choose the OpenAI-compatible option rather than a named vendor.

Before debugging OpenClaw, confirm the endpoint answers a tool-calling request directly with curl against /v1/chat/completions. If that fails, the problem is Ollama, not OpenClaw.

Hardware reality check

OpenClaw is a background service. The model gets loaded and reloaded as messages arrive, and every reload costs seconds of latency, so you want the weights resident permanently — hence OLLAMA_KEEP_ALIVE=-1. That means the VRAM is committed for as long as the assistant is running, not just during a request. Budget accordingly: a 24 GB card running qwen3:32b at 32K context has essentially nothing left for anything else.

A 16 GB GPU is the sensible entry point for a 14B–20B model at usable context. Below 12 GB you are restricted to 8B models, where multi-step reliability drops sharply. Apple Silicon with 32 GB or more unified memory works well because the memory is shared, though prompt processing is slower than on a discrete NVIDIA card. See the GPU guide for local LLMs for the specific cards worth buying at each tier.

The hybrid setup most people end up with

The honest outcome: a local 14B model handles routine messages, summaries, reminders and single-tool lookups perfectly well. Long research chains, code changes across several files, and anything requiring careful instruction-following degrade noticeably. Many OpenClaw users therefore keep a cloud provider configured for the main agent loop and use Ollama for high-volume, low-stakes work, or for privacy-sensitive content that shouldn’t leave the machine.

Whether that split saves money depends on your message volume and electricity cost. Run your numbers through the self-hosting vs API break-even calculator before buying a GPU specifically for this; at low volumes the API is usually cheaper than the hardware amortisation.

Troubleshooting

SymptomCause and fix
ECONNREFUSED / connection refusedServer not running, or bound to loopback while OpenClaw is in a container. Test curl http://localhost:11434/api/version from inside the container’s network namespace.
404 on requestsBase URL missing /v1, or pointed at Ollama’s native /api/chat path instead of the OpenAI-compatible one.
401 / missing API keySet the key field to any non-empty string.
model not foundTag mismatch. Copy the name verbatim from ollama list.
Agent narrates tool use instead of executing itModel has no tool-calling template. Switch to one from the table above.
Agent forgets its instructions mid-taskContext truncation. Rebuild with a larger num_ctx.
First reply after idle takes 30+ secondsModel was unloaded after the keep-alive timeout. Set OLLAMA_KEEP_ALIVE=-1.

Frequently asked questions

Does OpenClaw officially support Ollama?

Not as a named integration. Support is indirect: OpenClaw can use any OpenAI-compatible chat-completions endpoint, and Ollama serves one at /v1. That path is stable and unlikely to change, but OpenClaw’s own configuration schema evolves quickly, so check its current docs for the exact provider keys rather than assuming.

What is the smallest model that genuinely works?

An 8B model with tool-calling support such as qwen3:8b is the realistic floor, and only for short, single-tool interactions. Below that, tool arguments become malformed often enough that the agent loop is more frustrating than useful. 14B is where it starts feeling dependable.

Can I run this on Windows?

Yes, with OpenClaw inside WSL2 and Ollama installed natively on Windows so it uses your GPU driver directly. Verify connectivity from the WSL shell with curl before configuring OpenClaw. Note that the iMessage channel is macOS-only regardless of platform, since it depends on the local Messages database.

Why is local OpenClaw so much worse than the cloud-backed version?

Two compounding factors. First, tool-call accuracy per step is lower, and errors multiply across a multi-step task. Second, local models degrade faster as the context fills, and OpenClaw’s prompt is large before your message is added. Both are model-capability limits, not configuration problems.

Can Ollama run on a different machine from OpenClaw?

Yes, and it’s a good pattern — put Ollama on the box with the GPU and run the gateway on something always-on and low-power. Set OLLAMA_HOST=0.0.0.0:11434 on the GPU host and use its LAN address in OpenClaw’s base URL. Because Ollama has no authentication, restrict this to a trusted network or a VPN.

Is this the same OpenClaw as the Captain Claw game project?

No. That OpenClaw is an unrelated C++ reimplementation of a 1997 DOS platformer and shares only the name. If a search result discusses level files or sprite rendering, you’ve landed on the game project.

Bottom line

The Ollama–OpenClaw connection is a five-minute configuration job: the OpenAI-compatible endpoint, a non-empty key, and an exact model tag. The work that determines whether it’s usable is upstream of that — picking a model with real tool-calling support, giving it a context window large enough for the agent’s prompt, and having enough VRAM to keep it resident. Compare candidate models in the models database, and if you’re new to Ollama’s configuration surface, the complete Ollama guide covers the environment variables and Modelfile mechanics in more depth.

Written by Mustafa Ihsan

Mustafa Ihsan is the founder and editor of Convly.ai. He built and maintains the site's live AI models database, its price-performance index, and its free calculators for VRAM requirements, API costs and self-hosting economics. He writes about model pricing, benchmark results and the hardware needed to run AI models locally, and consistently prefers measured numbers to vendor claims.

Scroll to Top
Featured on There's An AI For That