乐于分享
好东西不私藏

OpenClaw常用命令

OpenClaw常用命令

以下是 OpenClaw 的常用命令汇总,按功能分类整理:

openclaw models status

一、基础控制命令

​​查看状态与健康检查​

openclaw status          # 查看网关状态

openclaw status --deep   # 详细状态(排查问题)

openclaw status --all    # 查看所有信息

openclaw health          # 健康检查

openclaw doctor          # 综合诊断与修复建议

openclaw doctor --yes    # 自动执行修复

服务管理​​

openclaw gateway run     # 前台运行网关

openclaw gateway start   # 启动网关服务

openclaw gateway stop    # 停止网关服务

openclaw gateway restart # 重启网关服务

openclaw gateway status  # 查看网关服务状态

openclaw gateway install # 安装系统服务(开机自启)

openclaw gateway uninstall # 卸载系统服务

​​日志管理​​

openclaw logs            # 查看日志

openclaw logs --follow   # 实时查看日志(类似 tail -f)

openclaw logs --limit 500 # 查看最近500条日志

openclaw logs --json     # JSON格式输出

二、配置管理命令

​​配置查看与修改​​

openclaw config get              # 查看完整配置

openclaw config get <path>       # 查看特定配置项

openclaw config set <path> <value> # 设置配置项

openclaw config unset <path>     # 清除配置项

openclaw configure               # 交互式配置向导

openclaw onboard                 # 初始化向导

openclaw onboard --install-daemon # 安装守护进程

​​模型管理​​

openclaw models set <provider/model>      # 设置默认模型

openclaw models fallbacks add <model>     # 添加备用模型

openclaw models fallbacks remove <model>  # 移除备用模型

三、通道与配对管理

​​通道管理​​

openclaw channels list           # 列出已登录通道

openclaw channels login          # 登录新通道账号

​​配对管理​​

openclaw pairing list whatsapp   # 查看WhatsApp待处理配对

openclaw pairing list telegram   # 查看Telegram待处理配对

openclaw pairing approve whatsapp <code> # 批准WhatsApp配对

openclaw pairing deny whatsapp <code>    # 拒绝WhatsApp配对

四、消息与对话管理

​​消息发送​​

openclaw message send --target +15555550123 --message "Hello"  # 发送文本

openclaw message send --target +15555550123 --file /path/to/file.txt # 发送文件

​​代理管理​​

openclaw agents list             # 查看代理列表

openclaw agents add work --workspace ~/.openclaw/work # 添加新代理

openclaw agents status work      # 查看代理状态

​​会话管理​​

openclaw sessions list           # 查看活跃会话

openclaw sessions history <session-key> # 查看会话历史

openclaw sessions reset <session-key>   # 重置会话

五、技能与插件管理

​​技能管理​​

openclaw skills list            # 列出可用技能

openclaw skills info <skill>    # 查看技能详情

​​插件管理​​

openclaw plugins list           # 列出已安装插件

openclaw plugins install <id>   # 安装插件(如 @openclaw/voice-call)

openclaw plugins enable <id>   # 启用插件

openclaw plugins disable <id>  # 禁用插件

六、数据与安全管理

​​数据管理​​

openclaw export --format json   # 导出对话历史

openclaw memory clear           # 清理记忆

openclaw backup                 # 备份数据

openclaw directory              # 查看工作区目录

​​安全管理​​

openclaw security audit         # 安全审计

openclaw security audit --deep  # 深度审计

七、其他实用命令

openclaw tui                    # 启动终端聊天界面

openclaw dashboard              # 打开控制面板UI

openclaw update                 # 更新版本

openclaw reset                  # 重置本地配置(保留CLI)

openclaw uninstall              # 卸载网关服务和数据

openclaw --help                 # 查看帮助信息

openclaw --version              # 查看版本号

八、Docker相关命令

docker logs -f openclaw         # 查看容器日志

docker exec -it openclaw sh     # 进入容器

docker exec openclaw openclaw config # 查看容器内配置

docker restart openclaw         # 重启容器

docker stop openclaw && docker rm openclaw # 停止并删除容器

OpenClaw 的模型配置主要通过命令行工具和配置文件两种方式管理,支持云端大模型和本地部署模型。

一、查看当前模型配置

​​查看已配置的模型列表:​​

openclaw models list

​​查看模型状态:​​

openclaw models status

​​查看配置文件中的模型设置:​​

openclaw config get models

配置文件默认位于 ~/.openclaw/openclaw.json(Linux/macOS)或 C:\Users\用户名\.openclaw\openclaw.json(Windows)。

二、配置云端大模型

​​使用交互式配置向导(推荐):​​

openclaw configure

按提示选择模型提供商(如 OpenAI、Anthropic、DeepSeek、Minimax 等),输入 API Key 即可完成配置。

​​手动配置示例(以 DeepSeek 为例):​​

# 设置模型模式为 merge

openclaw config set models.mode merge

# 配置 DeepSeek 提供商

openclaw config set 'models.providers.deepseek' --json '{

  "baseUrl": "https://api.deepseek.com/v1",

  "apiKey": "your-api-key",

  "api": "openai-completions",

  "models": [

    {

      "id": "deepseek-chat",

      "name": "DeepSeek Chat"

    }

  ]

}'

# 设置默认模型

openclaw models set deepseek/deepseek-chat

三、配置本地部署模型

​​方案一:使用 Ollama(推荐)​​

# 配置本地模型提供商

openclaw config set 'models.providers.ollama' --json '{

  "baseUrl": "http://127.0.0.1:11434/v1",

  "api": "openai-completions",

  "models": [

    {

      "id": "qwen2.5-3b",

      "name": "Qwen2.5-3B"

    }

  ]

}'

# 设置默认模型

openclaw models set ollama/qwen2.5-3b

​​方案二:使用 vLLM​​

# 启动 vLLM 服务

docker run -d --gpus all -p 8000:8000 --name vllm-server vaultmaker/gpt-oss-20b-vllm:latest --host 0.0.0.0

# 配置 vLLM 提供商

openclaw config set 'models.providers.vllm' --json '{

  "baseUrl": "http://127.0.0.1:8000/v1",

  "api": "openai-completions",

  "models": [

    {

      "id": "gpt-oss-20b",

      "name": "GPT-OSS-20B"

    }

  ]

}'

# 设置默认模型

openclaw models set vllm/gpt-oss-20b

四、配置 NVIDIA 模型

# 配置 NVIDIA 提供商

openclaw config set 'models.providers.nvidia' --json '{

  "baseUrl": "https://integrate.api.nvidia.com/v1",

  "apiKey": "your-nvidia-api-key",

  "api": "openai-completions",

  "models": [

    {

      "id": "z-ai/glm4.7",

      "name": "Z-AI GLM4.7"

    },

    {

      "id": "minimaxai/minimax-m2.1",

      "name": "Minimax M2.1"

    }

  ]

}'

# 设置默认模型

openclaw models set nvidia/minimaxai/minimax-m2.1

五、通用配置模板

对于任何兼容 OpenAI/Anthropic 协议的模型,可以使用以下模板:

{

  "provider": "provider_name",

  "baseUrl": "base_url",

  "api": "openai-completions",  // 或 "anthropic-messages"

  "apiKey": "your-api-key",

  "models": [

    {

      "id": "model_id",

      "name": "model_name"

    }

  ]

}

六、配置生效与验证

​​重启服务使配置生效:​​

openclaw gateway restart

​​验证配置:​​

openclaw models list        # 查看模型列表

openclaw models status      # 检查模型状态

openclaw models probe <model-name>  # 测试模型连接

配置完成后,OpenClaw 即可使用指定的模型进行推理和对话。