You fell in love with your OpenClaw agent, then you looked at the API bill. Every reply, every cron job, every sub-agent burns tokens, and the meter never stops. The good news is that a huge chunk of what your agent does every day does not need a frontier model at all. Summarizing an email, tagging a note, tidying a JSON file, answering a simple channel message: a model running on your own machine can do that for exactly zero dollars.
This guide is the config-level walkthrough for running OpenClaw on free local models with Ollama. Not the theory version. The version with the real commands, the real openclaw.json blocks, and the parts that broke the first time I tried it. By the end you will know how OpenClaw actually chooses a model, how to route the cheap work to your own hardware, and how to keep the smart (paid) models for the jobs that genuinely need them.
Why Run OpenClaw on Local Models at All?
Short answer: local models make the boring 80 percent of your agent’s work free, private, and instant. There is no per-token bill, no rate limit, no API key to rotate, and nothing leaves your machine. If you run OpenClaw on a Mac mini or a spare desktop, you already own the hardware, so the marginal cost of a request is electricity.
The honest trade-off is quality. A 14B model running on your laptop is not DeepSeek or Claude. It is great at chat, summarizing, rewriting, classifying, and generating embeddings. It is weaker at long multi-step reasoning and, this is the big one, tool calling. OpenClaw is an agent, so most of what it does is tool calls. That single fact is why the winning setup is not “replace the cloud,” it is “route the right work to the right model.”
Here is the mental model I use:
- Local models are perfect for: chat replies, summarizing, drafting, reformatting, embeddings for memory search, and as a last-resort fallback.
- Cloud models are still best for: complex tool chains, multi-step planning, long-context reasoning, and anything that must be reliable every single time.
If you are new to running models on your own machine, start with our guide to running an LLM locally first, then come back here to wire it into OpenClaw.
Level 1: Get Ollama Running and Pull a Model
Ollama is the easiest way to run local models. It downloads the weights, manages the server, and exposes an OpenAI-compatible API on http://localhost:11434, which is exactly what OpenClaw needs.
On macOS, install the app or use Homebrew:
brew install ollama
Then start the server and pull a model. For a 16GB Mac, a 7B or 8B model is the sweet spot. If you have 32GB or more, step up to 14B for noticeably better answers:
ollama serve (in one terminal)
ollama pull qwen2.5:14b
Confirm it landed with ollama list:
That third entry, nomic-embed-text, matters more than it looks. It is the embedding model OpenClaw can use for semantic memory search, so your agent can remember things without paying OpenAI for embeddings. Pull it too:
ollama pull nomic-embed-text
Level 2: Point OpenClaw at Ollama
OpenClaw identifies every model as provider/model. The Ollama provider speaks to the local server on port 11434, so ollama/qwen2.5:14b is a valid model id the moment the model is pulled. Nothing extra to install.
Open ~/.openclaw/openclaw.json and set the agent’s primary model to your local one, and point memory search at the local embedding model:
Then apply the change and restart the gateway so it loads:
openclaw gateway restart
Send your agent a simple message. If it answers, you are now running on free local inference.
How OpenClaw Actually Picks the Model
This is the part the docs skip, and it explains almost every “why did my agent do that” moment. When a message arrives, OpenClaw does not just “use the model.” It builds a request, sends it to the provider behind the model id, and then reads the response back. Concretely:
- The message, the conversation history, and every available tool’s schema are packaged into one chat request.
- That request is posted to the provider’s endpoint. For Ollama, that is
http://localhost:11434/v1/chat/completions. - The model replies. If it wants to use a tool, it must emit a structured
tool_callsblock that OpenClaw can parse. - If the primary model errors, times out, or returns something unparseable, OpenClaw walks down the
fallbackslist and tries the next provider.
Step 3 is where small local models fall over. A model can be brilliant at conversation and still produce a broken tool call, because emitting perfect JSON for a tool schema is a different skill from writing sentences. When that happens you get loops, “tool not found” errors, or the agent silently doing nothing. Keep that in mind for the next section.

Level 3: Hybrid Routing (The Setup That Actually Wins)
Pure local is a fun experiment. Hybrid is what you run in production. The idea: keep a fast cloud model as your primary for heavy agent work, keep the local model for cheap tasks and as a zero-cost safety net, and let the fallback chain do the routing for you.
You can also route by channel or by agent. A notes channel that only summarizes text can run entirely on the local model, while your ops channel stays on the paid model. That is exactly how I keep OpenClaw’s costs boring while still getting reliable tool calls where it counts.
Here is how the request flows once you have a chain in place:
For memory search specifically, set the provider to Ollama and the model to nomic-embed-text. This is the single biggest free win in OpenClaw, because embeddings are what let your agent remember context across sessions without shipping your notes to an API. If your agent has been forgetting things, our memory and context fix guide covers the retrieval side.
What Actually Breaks (And How to Fix It)
1. Tool calls fail or the agent loops
This is the number one issue with local models in an agent. Check whether your model even supports tools with ollama show <model>. Look for tools under Capabilities. If it is missing, that model cannot drive OpenClaw reliably no matter how good it sounds.
2. Context overflows your RAM
You can set a huge context window and still fail, because every token lives in memory. A 128K context on a 14B model can demand more RAM than you have, and Ollama will slow to a crawl or drop the request. Cap it to what you need, 8192 is plenty for most chat and summary work, and leave the long-context jobs to the cloud.
3. Models unload and reload constantly
By default Ollama unloads a model after about five minutes idle, so the next request pays a slow reload. For an always-on agent, set a longer keep-alive or raise it in the server environment so your model stays warm.
4. The silent fallback bill
Remember the flow above. If your local model fails a tool call and the next provider in the chain is a paid cloud model, OpenClaw just uses it. The user sees a normal reply, and you get billed at cloud rates. That is fine as a safety net, but it means “I switched to local models” and “my bill went down” are two different claims. Verify your chain, then verify your bill.
If you want to see exactly where the money goes, our breakdown of OpenClaw token costs walks through the biggest offenders, background sub-agents and heartbeat runs among them.
Common Mistakes
- Going 100 percent local overnight. Keep one reliable cloud model in the chain. The agent exists to get work done, not to prove a point.
- Picking a model by parameter count alone. A 7B model that supports tools beats a 14B model that does not. Always check the Capabilities line.
- Forgetting embeddings. People wire up the chat model and ignore memory search, then wonder why the agent forgets everything. Pull
nomic-embed-textand pointmemorySearchat Ollama. - Assuming local means offline. The first pull downloads gigabytes. Do it on a good connection, once.
- Not backing up before you edit config. A broken
openclaw.jsoncan brick your gateway. Our backup and restore guide shows the fast path back.
One practical note on hardware: running a local model 24/7 for an always-on agent is happiest on a machine that stays on, a Mac mini, a spare desktop, or a small VPS. If the agent’s main job is managing a WordPress site, remember that the site itself still needs fast, reliable hosting underneath it. Kinsta is what I recommend there, and the reason is in the box below.
If your hosting is the bottleneck: Kinsta keeps your site safe with automatic daily backups and one-click restore, so a bad update or a hack is a rollback, not a rebuild. Their support is top tier, and 24/7 live chat is staffed by WordPress engineers who will help fix the actual problem with you, so you are not stuck waiting on your developer to reply. Plans start at $35 per month.
Check out our OpenClaw cost fix guide and cut the biggest drains first, before you touch your models at all.
See Our Cost Fix GuideMostly yes, with one catch. Once a model is pulled, inference runs entirely on your machine, no internet required. The gap is features that depend on external services, like web search, remote image generation, or any channel that talks to a cloud platform. For chat, drafting, summarizing, and memory search, local means offline and free.
On a 16GB machine, stick to a 7B or 8B model like llama3.2 or qwen2.5:7b, which fits comfortably in memory and still supports tool calls. With 32GB or more you can run a 14B model like qwen2.5:14b for noticeably better answers. Bigger is not automatically better for an agent, a model that supports tools beats a larger one that does not.
Tool calling requires the model to emit a perfectly structured tool_calls block, which is a separate skill from conversation. Many small models cannot do it, or do it inconsistently. Run ollama show followed by the model name and check for tools under Capabilities. If it is missing, that model cannot drive an agent reliably, so keep those tasks on a cloud model or pick a local model that lists tool support.
The inference is free, there is no per-token charge and no API key. You pay for the hardware once and for the electricity after that. The one hidden cost is the fallback chain: if a local request fails and your config falls through to a paid cloud model, that request is billed at cloud rates without any obvious warning.
Mix them. The winning setup keeps a fast cloud model as the primary for complex tool chains and multi-step work, uses local models for chat, summarizing, and embeddings, and keeps one local model as a free last-resort fallback. You get the reliability of the cloud where it matters and near-zero cost for the routine work that fills most of a day.
Final Thoughts
You do not have to choose between a smart agent and a cheap one. Point OpenClaw at Ollama, route the routine work to your own hardware, and keep a cloud model in the chain for the jobs that need real reasoning. The result is an agent that stays useful, private, and, for most of its daily work, free.
Start small. Pull one model, switch memory search to nomic-embed-text, and watch a week of your bill. Then decide how far down the local path you want to go. If you are brand new to OpenClaw entirely, our 30-minute setup guide gets you to a working agent first.

