OpenClaw, in conjunction with Ollama's local deployment, super simple!

OpenClaw with Ollama local deployment, super simple!
Are you still worried about the cost of calling a big cloud model? Still worried about data privacy?
I'll teach you how to use it today. OpenClaw + Ollama Create a fully localized AI assistant, all data running locally, safe and cost-effective!
What's Ollama?
Ollama is a tool for you to run large language models locally. It supports many open-source models such as Llama 2, Llama 3, Mistral, Gemma, which can be run without GPU.
Official website: https://ollama.com
Preparations
1. Installation of Ollama
MacOS/ Linux:
curl -fsSL https://ollama.com/install.sh | bash
Windows:
Go straight to https://ollama.com to download the installation package
Download models
After installation, download the model you need:
# 推荐:下载 Llama 3(8B 参数,一般配置够用)
ollama pull llama3
# 或者下载 Mistral(性能不错)
ollama pull mistral
# 配置低的可以选 qwen(阿里开源,中文效果好)
ollama pull qwen:7b
3. Validation of Ollama run
# 启动 Ollama 服务(一般安装后自动启动)
ollama serve
# 测试模型
ollama run llama3
Okay!
OpenClaw Configuration
1. Find Profile
OpenClaw profile in ~/.openclaw/openclaw.json
2. Add Ollama as Custom
Add the following to the profile:
{
models: {
providers: {
ollama: {
type: "openai", // Ollama 兼容 OpenAI API
baseUrl: "http://localhost:11434/v1",
api: "key",
defaultHeaders: {
"Content-Type": "application/json"
}
}
}
},
agents: {
defaults: {
model: {
primary: "ollama/llama3"
},
models: {
"ollama/llama3": {
// 支持的参数
},
"ollama/mistral": {},
"ollama/qwen:7b": {}
}
}
}
}
3. Examples of full configuration
{
models: {
providers: {
ollama: {
type: "openai",
baseUrl: "http://localhost:11434/v1"
}
}
},
agents: {
defaults: {
model: {
primary: "ollama/llama3",
fallbacks: ["ollama/mistral"]
},
models: {
"ollama/llama3": {
description: "Meta Llama 3, 8B 参数"
},
"ollama/mistral": {
description: "Mistral 7B, 性能强劲"
},
"ollama/qwen:7b": {
description: "阿里 Qwen 7B, 中文效果好"
}
}
}
}
}
4. Restart OpenClaw
# 重启 Gateway
openclaw gateway restart
# 查看模型状态
openclaw models status
Common problems
Q1: What about slow-loading?
The initial loading of the model will be slower because of the need to download the model file. You can keep Ollama running in the backstage, avoiding every restart.
# 让 Ollama 保持运行
nohup ollama serve &
Q2: What if there's not enough?
Select the smeller model:
– I'm sorry. llama3:8b ~ Need about 8GB visible
– I'm sorry. mistral:7b ~ Need about 8GB visible
– I'm sorry. qwen:7b ~ Need about 8GB visible
– I'm sorry. llama3:70b ~ It takes about 40 GB to be visible.
Q3: How do we look at the models?
ollama list
Q4: Slow response?
Local model response rates depend on:
– Model size
– Visibility/RAM speed
– CPU Performance
Quantified models recommended (band) :q4_K_M Wait, wait, wait.
Q5: OpenClaw cannot find a model?
Ensure that:
Ollama is running:ollama serve
2. The configured model has been downloaded:ollama list
3. BaseUrl Correct:http://localhost:11434/v1
Progress: Multimodel switching
Configure multiple fallbacks:
{
agents: {
defaults: {
model: {
primary: "ollama/llama3",
fallbacks: ["ollama/qwen:7b", "ollama/mistral"]
}
}
}
}
So if llama3 is not available, it will automatically switch to the next model.
Summary
Through Ollama local deployment, you can:
- Zenium Cost savings: Total free, no API Key
- Zenium Privacy: Data not available locally
- Zenium Customise: Free choice of model
- Zenium More stable.: Not dependent on the network
Go ahead and try. Ask me any questions.

Make friends, add me to the group, and share A.I. and cyber security technology.