对于已经存在的模型提供商,使用 下面的命令就可以配置
openclaw configure --section model
如果要使用如siliconflow等,那么,可以使用如下面的操作
在openclaw终端执行
openclaw config set models.providers.siliconflow '{
"baseUrl": "https://api.siliconflow.cn/v1",
"apiKey": "sk-123456783333",
"api": "openai-completions",
"models": [
{
"id": "Qwen/Qwen3.5-9B",
"name": "通义千问 3.5 9B"
},
{
"id": "deepseek-ai/DeepSeek-V3.2",
"name": "DeepSeek-V3.2"
}
]
}'
models中可以配置多组模型,这里为了演示配置了两组,模型id在硅基流动模型广场获取,name可以自定义 设置默认主模型:
openclaw config set agents.defaults.model.primary "siliconflow/deepseek-ai/DeepSeek-V3.2"
设置备用模型,当主模型不可用时,OpenClaw自动切换为备用模型:
openclaw config set agents.defaults.model.fallbacks '["siliconflow/Qwen/Qwen3.5-9B"]'
为添加的模型设置别名:
openclaw models aliases add 别名 "模型id"
以本文演示的两个模型为例:
openclaw models aliases add qwen "siliconflow/Qwen/Qwen3-8B"
openclaw models aliases add deepseek "siliconflow/Pro/deepseek-ai/DeepSeek-V3.2"
重启OpenClaw网关(按需):
openclaw gateway restart
在聊天中,使用以下命令可以切换模型:
/model 别名
使用cnd内置的大模型
"cnb": {
"baseUrl": "${CNB_API_ENDPOINT}/${CNB_REPO_SLUG}/-/ai/",
"apiKey": "${CNB_TOKEN}",
"api": "openai-completions",
"models": [
{
"id": "auto",
"name": "CNB-Models",
"reasoning": true,
"input": [
"text"
],
"contextWindow": 131072,
"maxTokens": 16384
}
]
},
"codebuddy": {
"baseUrl": "${CNB_API_ENDPOINT}/${CNB_REPO_SLUG}/-/ai-ide/v2",
"apiKey": "${CNB_TOKEN}",
"api": "openai-completions",
"models": [
{
"id": "glm-4.6v",
"name": "CNB-Models",
"reasoning": true,
"input": [
"text",
"image"
]
}
]
}
docker-compose.yml
version: '3.8'
services:
openclaw:
image: docker.cnb.cool/sflyhero/openclaw:latest
container_name: openclaw
ports:
- "8080:8080"
- "18789:18789"
volumes:
- ./openclaw_data:/root/.openclaw
environment:
- CNB_API_ENDPOINT=${CNB_API_ENDPOINT}
- CNB_REPO_SLUG=${CNB_REPO_SLUG}
- CNB_TOKEN=${CNB_TOKEN}
restart: unless-stopped

评论