View all articles
OpenClawOllamaAI AgentsTutorial

Run Your Own AI Agent Gateway with OpenClaw and Ollama in One Command

JG
Jacobo Gonzalez Jaspe
|

By the end of this post you will have OpenClaw’s gateway running on a machine you own, answering through a model served by Ollama on the same machine, with one scheduled job doing something useful every morning. Cheapest place to start: a 16 GB laptop and a 9B model. Comfortable: 24 to 32 GB and a 26B model.

OpenClaw is an open-source personal assistant gateway. It connects chat apps you already use (WhatsApp, Telegram, Slack, Discord, iMessage) to an agent that can read files, run tools and follow a schedule. Ollama’s own tutorial, The simplest and fastest way to set up OpenClaw, shows the one-command path with a cloud model. This post follows the same path with a local model only, so no account and no API key are involved.

What you need

  • Ollama 0.17 or newer (ollama --version). We used 0.30.10.
  • Node.js 24.16+ or 26.1+, per the OpenClaw install docs. We run 24.17.0.
  • macOS or Linux. Windows works through WSL2 or the native installer.
  • Memory for the model plus about 1 GB for the gateway itself (measured below).
  • 20 minutes. No credit card, no cloud key.

Step 1: Pull a local model that can call tools

Agents need models that return structured tool calls, and OpenClaw’s Ollama docs recommend a 64k-token context for local models. The Ollama integration page names two local options: gemma4 (about 16 GB of GPU memory) and qwen3.5 (about 11 GB).

ollama pull gemma4          # 24 GB machines and up
ollama pull qwen3.5:9b      # 16 GB laptops: 6.6 GB download
ollama show gemma4          # confirm "tools" appears under Capabilities

If ollama show does not list tools, pick another model. Tool calling is the whole point of an agent.

Step 2: Install and launch with one command

ollama launch openclaw --model gemma4

Ollama detects that OpenClaw is missing, asks to install it, writes the provider configuration, installs the background daemon and opens the OpenClaw terminal. Add --config to configure without launching, or --yes for a headless install. Both flags are documented on the same integration page.

Prefer the manual route? The OpenClaw installer is:

curl -fsSL https://openclaw.ai/install.sh | bash
openclaw onboard --install-daemon   # choose Ollama, then "Local only"
openclaw gateway status

Expected output of the last command: Runtime: running and a gateway on port 18789. If you see a Node version error, upgrade Node first; nothing else usually goes wrong at this stage.

Step 3: Check the provider configuration

OpenClaw must talk to Ollama’s native /api/chat endpoint, not the OpenAI-compatible /v1 route. The provider docs are explicit: the /v1 route breaks tool calling and models start printing raw JSON as text. Open ~/.openclaw/openclaw.json and look for this shape:

{
  models: {
    providers: {
      ollama: {
        baseUrl: "http://127.0.0.1:11434",
        apiKey: "ollama-local",      // marker for a local host, not a secret
        api: "ollama",
        models: [
          { id: "gemma4", name: "gemma4", input: ["text"],
            contextTokens: 32768, params: { num_ctx: 32768 } }
        ]
      }
    }
  }
}

Keep contextTokens and num_ctx equal. Local model discovery caps the context at 32,768 tokens so nothing is silently truncated. Our own gateway on the workstation uses exactly this shape, and openclaw models list shows the entry as ollama/gemma4:latest. Models are always referenced as ollama/<name>.

Step 4: Schedule the first useful automation

The fastest win is a scheduled digest. This job runs on weekday mornings, uses only the local model and delivers to a chat channel you have connected:

openclaw cron add --name "Morning notes digest" \
  --cron "0 8 * * 1-5" \
  --message "Read the files in ~/notes changed in the last 24 hours. Reply with three bullets and one action for today." \
  --model ollama/gemma4 --announce --channel telegram
openclaw cron list
openclaw cron run <job-id>     # run it now to test

We created the equivalent job on our gateway (disabled, then removed) and the command returned a JSON record with payload.kind: "agentTurn" and model: "ollama/gemma4:latest", which is what you should see too. To connect a channel, run openclaw configure --section channels, as the Ollama tutorial suggests. Flags such as --every 30m, --webhook <url> and --command <shell> are in the cron reference.

Ask your assistant to draft the prompt for the job. A good instruction: “Write a cron message for an agent that reads a folder of markdown notes and returns three bullets and one action, in under 80 words.”

What we measured

All numbers from our NVIDIA GB10 workstation (128 GB unified memory), 2026-09-09, via ollama ps and /api/generate.

ItemMeasuredNotes
OpenClaw gateway process893 MB residentNode 24.17, systemd user unit, 10 days uptime
gemma4:26b51.2 tokens/s, 17 GB resident32k context, first load 116 s from disk
qwen3.6:35b51.4 tokens/s, 23 GB resident32k context; 29 GB when loaded at 262k context
qwen2.5-coder:7b34.1 tokens/s, 6.6 GB resident32k context, warm load 0.19 s
llama3.1:8b33.3 tokens/sfirst load 13.2 s

Two lessons for sizing. The context window costs memory: the same 35B model needed 6 GB more at full context than at 32k. And the first load of a large model from disk is slow; after that, Ollama keeps it warm for 30 minutes by default.

Your machineModel to start withWhat to expect
16 GB laptopqwen3.5:9bChat, summaries, simple tool calls
Mac mini M4 24 GB, about EUR 920 (Compute Market)gemma4:12b or qwen3.5:9bRoom for the gateway and 32k context
32 GB and upgemma4:26b or qwen3.5:27bMulti-step agent jobs

Where this fits, and the limits

OpenClaw replaces the “someone checks this every morning” tasks: inbox and notes digests, folder watching, reminders that arrive in the chat app you already open. With a local model the content of those files never leaves the building.

Honest limits. Small models call tools less reliably than the 30B class; if a job fails, try a bigger model before rewriting the prompt. Web search inside OpenClaw uses Ollama’s hosted search and requires ollama signin; skip it if your policy is strictly local. Messages still travel through WhatsApp’s or Telegram’s servers, so the transport is not private even when the model is. And the Ollama tutorial itself says to run OpenClaw in an isolated environment, because an agent with tools can read files and execute actions. A dedicated user account or a small VM is enough.

Next steps

Work with us

We run an OpenClaw gateway on our own hardware with 18 scheduled jobs, and we set up the same thing for clients on machines they own. If you want the first automation running in your office, get in touch or read how our consulting works.

Share: LinkedIn X
Newsletter

Access exclusive resources

Subscribe to unlock 230+ workflows, 43 agents, and 26 professional templates. Weekly insights, no spam.

Bonus: Free EU AI Act checklist when you subscribe
Once a week No spam Unsubscribe anytime
EU AI Act is now in effect — Is your organization compliant?

Tell us what you want to run

Tell us what you want to run and on what budget. We will tell you which hardware you need, which model fits, and what to expect from it — before you spend anything.

Self-service Local-first Open-source toolkits

136 pages of free resources · 26 compliance templates · 22 certified devices