Run OpenClaw with Ollama: Local AI Agent in 30 Minutes
What you get from OpenClaw plus Ollama
OpenClaw is an open-source personal AI agent that lives on your own machine. It is a gateway, not another chat window: it takes messages from apps you already use, hands them to a language model, and lets that model run tools, read files, and take real actions. Most people point it at a hosted model and pay per token. Point it at Ollama instead and the whole setup runs locally, with every prompt, file, and tool result on hardware you control and zero per-message cost.
The trade is capability. A model that fits on one GPU is weakest at the skill an agent needs most: picking the right tool and producing a well-formed call. With the right model, a local OpenClaw agent can handle daily work like triaging files and drafting messages without touching a cloud API.
OpenClaw running on a local Ollama model in the terminal. Source: Gongjiyun (gongjiyun.com).
What you need
Three pieces, in this order: Ollama with a tool-capable model, Node.js 22 or newer (24 is recommended), and OpenClaw itself. OpenClaw runs on macOS, Linux, and Windows through WSL2, and the commands below are for Linux and macOS. Model choice depends on your GPU. NVIDIA's guide suggests Qwen3.5 4B for 6–8 GB cards, Qwen3.5 9B or Gemma 4 12B for 12–16 GB cards, and Qwen3.6 27B for 24 GB cards and up. Pick a model with tool support and at least 32K tokens of context; 64K or more is safer, because agent sessions with tool output eat context fast.
Step 1: Install Ollama and pull a tool-capable model
On Linux, the official installer sets Ollama up as a service on port 11434:
curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen3.5:9b
curl http://localhost:11434/api/tags
The last command lists the models on disk. If it answers, the daemon is up. On macOS, download Ollama from ollama.com and pull the same model. Check the model supports tools first: one without them chats fine, then fails silently the moment OpenClaw asks it to run something. Stick to models Ollama marks with tools support, such as qwen3.5 or gemma4.
Step 2: Install OpenClaw
The one-line installer works on macOS, Linux, and WSL2:
curl -fsSL https://openclaw.ai/install.sh | bash
If you already manage Node yourself, the package-manager route does the same job:
npm install -g openclaw@latest
openclaw --version
Confirm the version prints before moving on.
Step 3: Run onboarding and skip the hosted provider
Start the interactive setup:
openclaw onboard --install-daemon
On Linux, --install-daemon creates a systemd service so the gateway keeps running in the background. Pick Quick start, then One agent. When the wizard asks for a model provider, choose Skip for now. You will point OpenClaw at Ollama by hand next, which avoids entering a hosted API key you do not need.
Step 4: Point OpenClaw at Ollama
Ollama does not need a real API key, but OpenClaw wants a value before it will talk to it. Any placeholder works for a local host:
export OLLAMA_API_KEY="ollama-local"
With that variable set and no explicit Ollama entry in your config, OpenClaw auto-discovers your models at http://127.0.0.1:11434, keeping only the ones that report tool support. Then select the model:
openclaw models list
openclaw models set ollama/qwen3.5:9b
openclaw models status
If your model is missing from the list, Ollama usually does not report tool support for it, or Ollama is not running. Pull a tool-capable model and try again.
One gotcha deserves a warning of its own: do not point OpenClaw at Ollama's OpenAI-compatible URL, http://127.0.0.1:11434/v1. That path breaks tool calling, and the model prints raw tool-call JSON as plain text instead of running tools. Use the native Ollama endpoint with no /v1 suffix. If Ollama runs on another host, declare the provider explicitly in ~/.openclaw/openclaw.json.
Step 5: Start the gateway and give it a first job
Start the gateway and check that it is alive:
openclaw gateway start
openclaw gateway status
openclaw status
The dashboard listens at http://127.0.0.1:18789. Open it and send the agent a small job with a visible result: ask it to list the files in a folder you point it at, then summarize the largest one. If it reports back with real file names, the model, gateway, and tool calling are all wired up. If it answers in plain text without touching the folder, check Step 4 again: the model probably lacks tool support.
Lock it down before you connect a channel
OpenClaw can read your files, run shell commands, and reach the services you connect to it. That is the point, and also the risk. Keep the gateway bound to 127.0.0.1 and never expose port 18789 to the public internet. Publicly exposed gateways have already been hijacked in the wild, so treat the gateway token like a password.
Small models deserve extra caution: OpenClaw's own status output warns that models under a few billion parameters need sandboxing with web tools disabled, because they are easier to steer into unsafe actions. Start with the tools you actually need, add channels like Telegram one at a time, and run openclaw doctor when something feels off.
OpenClaw gateway connected to a local Ollama server. Source: TalkingTech (talkingtech.io).
Troubleshooting
Model not listed. Run ollama list, then openclaw models list. If Ollama shows it and OpenClaw does not, it likely lacks tool support. Pull qwen3.5:9b or gemma4 instead.
Agent prints tool JSON as text. You are on the /v1 URL. Switch to the native Ollama endpoint and restart the gateway.
Replies get cut off. The context window is too small. Move to a model with 64K context, or start a fresh session.
Gateway will not start. Run openclaw doctor, and openclaw config validate after any hand edit of openclaw.json. The config schema is strict: one unknown key stops the gateway.
What to do next
A local OpenClaw agent is a base to build on, not a finished product. Connect one messaging channel so you can reach it from your phone, add a skill for the task you repeat most, and give it memory so it stops relearning your preferences. Our earlier guides cover the neighboring pieces: running an open model locally with Ollama, giving your AI agent memory with Mem0 and Ollama, and OpenClaw vs Linger vs OpenMausBot compared. The agent is free, the model is free, and the only bill left is the electricity.


Comments
Post a Comment