Running OpenClaw with Ollama: A Complete Setup Guide

OpenClaw bridges local Ollama models to messaging apps like WhatsApp and Telegram. This guide covers installation, context configuration, and Docker deployment.

Running OpenClaw with Ollama: A Complete Setup Guide

Running OpenClaw with Ollama

Introduction

You have successfully set up Ollama, pulled a capable model, run a few queries in the terminal, and it worked. The responses were sharp. The latency was real. The whole thing ran on your own hardware with no API key and no cloud.

Then you closed the terminal and walked away. The AI was gone. That is the gap OpenClaw fills. It is a personal AI assistant that runs on your hardware and stays running, bridging your local Ollama models to the messaging apps you already use: WhatsApp, Telegram, Slack, Discord, iMessage.

OpenClaw was created by Peter Steinberger, a macOS developer known for Apple tooling, and released in late 2025 under the name Clawdbot. The project passed 60,000 GitHub stars within weeks. As of Ollama 0.17, the entire setup collapses to a single command.

This article covers the full path from zero to a running private research assistant on Telegram, including configuring the context length correctly, connecting the channel, enabling web search, and deploying it headlessly in Docker.

What OpenClaw Is and How It Works

Before running any commands, it helps to understand what is actually happening under the hood, because the architecture explains several decisions you will make during setup.

Everything flows through a single daemon called the Gateway. It stays running in the background, holds your messaging connections open, and coordinates the AI agent. When you send a message from WhatsApp or Telegram, here is the actual sequence: your text arrives through the messaging platform’s protocol (WhatsApp uses Baileys, Telegram uses the Bot API), travels to the Gateway, which routes it to your model via Ollama’s local API, and delivers the response back through the same channel. You see a reply in the messaging app. Nothing else happens on your device visibly.

This three-layer design is what makes OpenClaw different from just running a chatbot in a terminal:

  1. The messaging layer is the channel you send messages through: your phone, a desktop Telegram client, a Slack workspace. You do not need to be at the machine running Ollama. You just need to be connected to the messaging service.
  2. The Gateway daemon is the coordination layer. It persists even when you are not actively using it, holds connections open, and manages multi-step agent tasks. This is what makes OpenClaw useful, rather than just interactive; tasks that take multiple tool calls can run in the background and deliver results when complete.
  3. The model layer is Ollama. This can be a fully local model running on your GPU, or a cloud-backed model routed through Ollama’s cloud service. The Gateway does not care which; it talks to Ollama’s API either way.

Architecture diagram showing the three-layer flow

One naming note worth covering upfront: OpenClaw was previously known as Moltbot and, before that, Clawdbot. It was renamed in early 2026. All old command aliases still work: ollama launch clawdbot still functions, so nothing breaks if you have those stored in scripts or documentation.

System Requirements and Prerequisites

The 64k context window requirement shapes everything else in your hardware and model selection decisions, so understand this before choosing a model.

Ollama defaults to context lengths based on available VRAM: under 24 GB gets 4k context, 24–48 GB gets 32k, and 48 GB or more gets 256k. The default for most consumer hardware is 4k, which is not enough for an agent doing multi-step tasks. You will need to set context explicitly, which the next section covers.

Hardware requirements:

FeatureMinimumRecommended
OSmacOS 12+, Linux, Windows (WSL)macOS 14+, Ubuntu 22.04+
RAM16 GB32 GB
GPU VRAM (local model)25 GB (for qwen3-coder or glm-4.7-flash)48 GB+
GPU VRAM (cloud model)None, runs on Ollama’s cloudGPU optional
Disk5 GB (OpenClaw + deps)30 GB+ if pulling local models

Software prerequisites:

  • Ollama 0.17 or later is required; this is the version that introduced ollama launch. Check your version with ollama --version and download the latest from ollama.com/download if needed.
  • Node.js 18 or later is required because OpenClaw installs via npm. Ollama detects and prompts for this automatically, but it is worth having it installed before you start.
  • An Ollama account is required for cloud models and for web search on local models. Create one at ollama.com and sign in with:
ollama signin

Model recommendations:

ModelTypeVRAMBest for
kimi-k2.5:cloudCloudNoneMultimodal reasoning and sub-agents
qwen3.5:cloudCloudNoneReasoning, coding, vision
minimax-m2.7:cloudCloudNoneFast productivity tasks
glm-5.1:cloudCloudNoneReasoning and code generation
qwen3-coderLocal~25 GBCoding tasks, full privacy
gemma4Local~16 GBReasoning locally

Cloud models have full context length automatically and include web search support without any additional configuration. For most users starting out, kimi-k2.5:cloud is the right pick; it is free to start, handles agentic tasks well, and requires no VRAM.

One-Command Installation with ollama launch

With Ollama 0.17+, you do not manually install OpenClaw, configure a Gateway, or manage npm packages. Ollama handles the entire bootstrap sequence.

Open a terminal and run:

ollama launch openclaw

Or, to go directly to a specific model and skip the selector:

ollama launch openclaw --model kimi-k2.5:cloud

Ollama then handles five things automatically, in this order:

  1. Install check: If OpenClaw is not already on your system, Ollama detects this and prompts you to install it via npm. Confirm, and it installs without you touching npm directly.
  2. Security notice: Before anything else runs, OpenClaw displays a security warning: the agent has the ability to read files and execute actions on your machine when tools are enabled. This is not boilerplate. An agent with file access that receives a malicious instruction can cause real damage. Read it. Run OpenClaw in an isolated environment if you are not certain about what it can reach. The OpenClaw security documentation covers this in detail.
  3. Model selector: A list of recommended models appears. Select one, or press Enter to use the model you specified with --model. The selector shows both cloud and local models with context window notes.
  4. Onboarding: Ollama configures your provider, installs the Gateway daemon, sets the selected model as primary, and, if you chose a cloud model, enables OpenClaw’s bundled Ollama web search automatically.
  5. Gateway starts: The Gateway launches in the background. The OpenClaw terminal user interface (TUI) opens, and you can start chatting immediately.

If you only want to change the configuration without starting the Gateway and TUI:

# Reconfigure without starting the agent
ollama launch openclaw --config

If the Gateway is already running when you do this, it restarts automatically to pick up the new settings. No manual restart needed.

Configuring Context Length for Agent Workloads

This is the step most tutorials skip, and it is the most common reason OpenClaw underperforms on real tasks.

The official docs state the minimum is 64k tokens, but understand what “minimum” means here. An agent doing a multi-step research task (web search → read page → extract information → summarize → respond) accumulates context across every step. At 64k, you have enough for a few turns with tool calls. For longer conversations or tasks with many tool invocations, you want more headroom. Cloud models are set to their maximum context length automatically and do not need this configuration.

For local models, set context length before launching by using the OLLAMA_NUM_CTX environment variable or by creating a custom Modelfile with the PARAMETER num_ctx directive set to at least 65536. Once configured, verify the setting took effect by checking the model info with ollama show and confirming the context length before running agent workloads.