npm install -g openclawopenclaw --version~/.openclaw/openclaw.json。)openclaw setup{
"gateway": {
"port": 18789,
"mode": "local",
"auth": {
"token": "147ai" //替换自己的访问令牌
},
"trustedProxies": ["127.0.0.1"],
"controlUi": {
"allowedOrigins": ["*"],
"allowInsecureAuth": true
}
},
"agents": {
"defaults": {
"model": {
"primary": "claude/claude-opus-4-6-thinking",
"fallbacks": [
"claude/claude-sonnet-4-6-thinking",
"gpt/gpt-5.4",
"gemini/gemini-3.1-pro-preview"
]
},
"imageModel": {
"primary": "gemini-3.1-pro-preview"
},
"compaction": {
"mode": "default"
},
"maxConcurrent": 4,
"subagents": {
"maxConcurrent": 8
}
}
},
"models": {
"mode": "merge",
"providers": {
"claude": {
"baseUrl": "https://147ai.com/v1",
"apiKey": "sk-", //替换自己的key
"api": "anthropic-messages",
"models": [
{
"id": "claude-opus-4-6",
"name": "Claude Opus 4.6",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 200000,
"maxTokens": 16384
},
{
"id": "claude-sonnet-4-6-thinking",
"name": "Claude Sonnet 4.6 思考版",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 200000,
"maxTokens": 8192
}
]
},
"gpt": {
"baseUrl": "https://147ai.com/v1",
"apiKey": "sk-", //替换自己的key
"api": "openai-completions",
"models": [
{
"id": "gpt-5.4",
"name": "GPT-5.4",
"reasoning": false,
"input": ["text", "image"],
"contextWindow": 200000,
"maxTokens": 16384
}
]
},
"gemini": {
"baseUrl": "https://147ai.com/v1",
"apiKey": "sk-", //替换自己的key
"api": "openai-completions",
"models": [
{
"id": "gemini-3.1-pro-preview",
"name": "Gemini 3.1 Pro",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 1048576,
"maxTokens": 65536
},
{
"id": "gemini-3-pro-image-preview",
"name": "Gemini 3 Pro image",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 1048576,
"maxTokens": 65536
}
]
}
}
},
"messages": {
"ackReactionScope": "group-mentions"
},
"commands": {
"native": "auto",
"nativeSkills": "auto",
"restart": true
}
} openclaw config validatenohup openclaw gateway --force > /tmp/openclaw.log 2>&1 &openclaw healthhttp://你的服务器IP:18789/#token=你设置的token令牌值openclaw devices listopenclaw devices approve (Request值)openclaw configopenclaw pairing approve feishu 配对码openclaw configure/model claude/claude-sonnet-4-6-thinkingopenclaw models list # 列出所有可用模型
openclaw models status # 查看当前默认模型
openclaw models set <provider/model> # 设置默认主模型
openclaw models set-image <provider/model> # 设置图像模型
openclaw models scan # 扫描可用模型openclaw config get <key> # 读取配置值
openclaw config set <key> <value> # 写入配置值
openclaw config unset <key> # 删除配置值
openclaw configure # 交互式配置
# 示例
openclaw config set openai.api_key "sk-..."
openclaw config set messages.tts.auto "always"pkill -f "openclaw gateway" && sleep 2 && nohup openclaw gateway --force > /tmp/openclaw.log 2>&1 &| 命令 | 功能 |
|---|---|
/new | 开启全新会话 |
/stop | 中止当前运行的任务 |
/compact | 释放上下文窗口空间 |
/status | 显示健康状态和当前上下文 |
/context list | 列出所有上下文贡献者 |
/subagents list | 列出子智能体 |
/subagents info | 查看子智能体信息 |
/model | 查看当前使用的模型 |
/model list | 列出所有可用模型 |
/model <编号> | 按编号切换模型(如 /model 3) |
/model <provider/model> | 按完整 ID 切换模型 |
/model status | 查看模型详细状态 |
/think | 开启 / 关闭推理模式 |
/reasoning on | 开启深度推理 |
/tts on | 开启文本转语音 |
/tts off | 关闭文本转语音 |
Invalid config 错误claude.api 是否为 anthropic-messages,不能写成 anthropic。function tag mismatch)claude.api 填错导致,改为 anthropic-messages 重启即可。systemctl restart openclaw 失败pkill + nohup 方式手动重启(见上方进程管理)。