龙虾OpenClaw 实用命令大全(最终完整版)
**`OPENCLAW_LOG_LEVEL=debug openclaw models list --all`** | **调试模式查看所有模型** || **`/model dashscope/qwen3.5-plus`** | **(在TUI中)临时切换模型** || `openclaw chat --model <模型ID> --prompt "你好"` | 直接对话测试 || `openc
## 📋 **OpenClaw 实用命令大全(最终完整版)**
### 1️⃣ **模型配置与查看**
| 命令 | 用途 |
| :--- | :--- |
| `openclaw models list` | 查看默认模型列表 |
| `openclaw models list --all` | **查看所有已加载模型**(包括自定义) |
| `openclaw models list --providers` | 查看默认提供商模型 |
| `openclaw models status` | 查看模型认证状态 |
| `openclaw models status --probe` | 测试模型连通性 |
### 2️⃣ **添加自定义模型(DashScope示例)**
```bash
openclaw config set models.providers.dashscope '{
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"apiKey": "你的密钥",
"api": "openai-completions",
"models": [
{"id": "qwen3.5-plus"},
{"id": "qwen-image-2.0-pro"}
]
}'
```
注意龙虾版本不一样其中参数可能不一样
openclaw config set models.providers.dashscope '{
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"apiKey": "你的key",
"api": "openai-completions",
"models": [
{
"id": "qwen3.5-plus",
"name": "通义千问3.5-Plus",
"api": "openai-completions",
"contextWindow": 200000,
"maxTokens": 8192,
"input": ["text"]
},
{
"id": "qwen-image-2.0-pro",
"name": "通义千问图像2.0-Pro",
"api": "openai-completions",
"contextWindow": 128000,
"maxTokens": 4096,
"input": ["text", "image"]
}
]
}'
### 3️⃣ **配置管理与修复**
| 命令 | 用途 |
| :--- | :--- |
| `openclaw config get agents.defaults` | 查看默认agent配置 |
| `openclaw config delete agents.defaults.models` | 删除模型白名单 |
| `openclaw doctor` | 全面诊断 |
| `openclaw doctor --fix` | 自动修复问题 |
### 4️⃣ **网关控制**
| 命令 | 用途 |
| :--- | :--- |
| `openclaw gateway status` | 查看网关状态 |
| `openclaw gateway restart` | 重启网关 |
| `openclaw gateway stop` | 停止网关 |
| `openclaw gateway start` | 启动网关 |
| `openclaw gateway service install --force` | 重新安装systemd服务 |
### 5️⃣ **缓存清理**
```bash
rm -rf ~/.openclaw/agents/main/agent/models.json
rm -rf ~/.openclaw/cache/
rm -rf ~/.openclaw/agents/main/agent/catalog.json
```
### 6️⃣ **设备管理**
| 命令 | 用途 |
| :--- | :--- |
| `openclaw devices list` | 查看已配对设备 |
| `openclaw devices approve <ID>` | 批准设备连接 |
### 7️⃣ **聊天与测试**
| 命令 | 用途 |
| :--- | :--- |
| `openclaw tui` | 进入终端交互界面 |
| **`/model dashscope/qwen3.5-plus`** | **(在TUI中)临时切换模型** |
| `openclaw chat --model <模型ID> --prompt "你好"` | 直接对话测试 |
| `openclaw logs --tail 50` | 查看最近日志 |
### 8️⃣ **永久切换默认模型**
| 命令 | 用途 |
| :--- | :--- |
| `openclaw config set agents.list[0].model 'dashscope/qwen3.5-plus'` | **永久切换 main agent 的默认模型** |
| `openclaw config set agents.defaults.model.primary 'dashscope/qwen3.5-plus'` | **设置全局默认模型(所有新建agent)** |
*修改后必须重启网关:`openclaw gateway restart`*
### 9️⃣ **调试模式**
| 命令 | 用途 |
| :--- | :--- |
| **`OPENCLAW_LOG_LEVEL=debug openclaw models list --all`** | **调试模式查看所有模型** |
| `OPENCLAW_LOG_LEVEL=debug openclaw models list --all 2>&1 \| grep "关键词"` | 带过滤的调试输出 |
### 🔟 **Node环境修复**
```bash
# 查看node版本
node --version
which node
# 卸载系统旧版node
sudo apt remove --purge nodejs npm
sudo apt autoremove
```
### 📌 **最常用组合拳**
```bash
# 模型不显示时的标准排查流程
openclaw gateway restart
rm -rf ~/.openclaw/agents/main/agent/models.json
openclaw models list --all
```
### 💡 **小技巧**
- 用 `--all` 参数查看所有模型,不要只依赖默认列表
- 修改配置后必须 `openclaw gateway restart`
- `openclaw doctor` 是最强大的诊断工具
- 在TUI中随时可以用 `/model <模型ID>` 临时切换模型
- **永久切换用 `config set agents.list[0].model`,重启后一直生效**
这下完整了!包含了**临时切换**和**永久切换**两种方式,覆盖所有使用场景。
更多推荐



所有评论(0)