Ollama
Ollama is a local LLM runtime that makes it easy to run open-source models on your machine. OpenClaw integrates with Ollama’s native API (/api/chat), supports streaming and tool calling, and can auto-discover local Ollama models when you opt in with OLLAMA_API_KEY (or an auth profile) and do not define an explicit models.providers.ollama entry.
Quick start
Onboarding (recommended)
The fastest way to set up Ollama is through onboarding:- Ask for the Ollama base URL where your instance can be reached (default
http://127.0.0.1:11434). - Let you choose Cloud + Local (cloud models and local models) or Local (local models only).
- Open a browser sign-in flow if you choose Cloud + Local and are not signed in to ollama.com.
- Discover available models and suggest defaults.
- Auto-pull the selected model if it is not available locally.
Manual setup
- Install Ollama: https://ollama.com/download
- Pull a local model if you want local inference:
- If you want cloud models too, sign in:
- Run onboarding and choose
Ollama:
Local: local models onlyCloud + Local: local models plus cloud models- Cloud models such as
kimi-k2.5:cloud,minimax-m2.5:cloud, andglm-5:clouddo not require a localollama pull
- local default:
glm-4.7-flash - cloud defaults:
kimi-k2.5:cloud,minimax-m2.5:cloud,glm-5:cloud
- If you prefer manual setup, enable Ollama for OpenClaw directly (any value works; Ollama doesn’t require a real key):
- Inspect or switch models:
- Or set the default in config:
Model discovery (implicit provider)
When you setOLLAMA_API_KEY (or an auth profile) and do not define models.providers.ollama, OpenClaw discovers models from the local Ollama instance at http://127.0.0.1:11434:
- Queries
/api/tags - Uses best-effort
/api/showlookups to readcontextWindowwhen available - Marks
reasoningwith a model-name heuristic (r1,reasoning,think) - Sets
maxTokensto the default Ollama max-token cap used by OpenClaw - Sets all costs to
0
models.providers.ollama explicitly, auto-discovery is skipped and you must define models manually (see below).
Configuration
Basic setup (implicit discovery)
The simplest way to enable Ollama is via environment variable:Explicit setup (manual models)
Use explicit config when:- Ollama runs on another host/port.
- You want to force specific context windows or model lists.
- You want fully manual model definitions.
OLLAMA_API_KEY is set, you can omit apiKey in the provider entry and OpenClaw will fill it for availability checks.
Custom base URL (explicit config)
If Ollama is running on a different host or port (explicit config disables auto-discovery, so define models manually):Model selection
Once configured, all your Ollama models are available:Cloud models
Cloud models let you run cloud-hosted models (for examplekimi-k2.5:cloud, minimax-m2.5:cloud, glm-5:cloud) alongside your local models.
To use cloud models, select Cloud + Local mode during setup. The wizard checks whether you are signed in and opens a browser sign-in flow when needed. If authentication cannot be verified, the wizard falls back to local model defaults.
You can also sign in directly at ollama.com/signin.
Advanced
Reasoning models
OpenClaw treats models with names such asdeepseek-r1, reasoning, or think as reasoning-capable by default:
Model Costs
Ollama is free and runs locally, so all model costs are set to $0.Streaming Configuration
OpenClaw’s Ollama integration uses the native Ollama API (/api/chat) by default, which fully supports streaming and tool calling simultaneously. No special configuration is needed.
Legacy OpenAI-Compatible Mode
If you need to use the OpenAI-compatible endpoint instead (e.g., behind a proxy that only supports OpenAI format), setapi: "openai-completions" explicitly:
params: { streaming: false } in model config.
When api: "openai-completions" is used with Ollama, OpenClaw injects options.num_ctx by default so Ollama does not silently fall back to a 4096 context window. If your proxy/upstream rejects unknown options fields, disable this behavior:
Context windows
For auto-discovered models, OpenClaw uses the context window reported by Ollama when available, otherwise it falls back to the default Ollama context window used by OpenClaw. You can overridecontextWindow and maxTokens in explicit provider config.
Troubleshooting
Ollama not detected
Make sure Ollama is running and that you setOLLAMA_API_KEY (or an auth profile), and that you did not define an explicit models.providers.ollama entry:
No models available
If your model is not listed, either:- Pull the model locally, or
- Define the model explicitly in
models.providers.ollama.
Connection refused
Check that Ollama is running on the correct port:See Also
- Model Providers - Overview of all providers
- Model Selection - How to choose models
- Configuration - Full config reference
This page is sourced from openclaw/openclaw.