Skip to content
广告 · 本站推荐广告

openclaw config

读取、写入和管理 OpenClaw 的配置项。支持点分路径符号访问嵌套配置。

命令签名

bash
openclaw config <子命> [选项]

子命令

子命令说明
get读取指定配置项的值
set设置指定配置项的值
list列出所有配置项
edit在编辑器中打开配置文件
reset重置配置项为默认值

openclaw config get

读取指定路径的配置值。

bash
openclaw config get <path>

路径使用点分符号表示嵌套层级:

bash
openclaw config get agents.default.model
# 输出: gpt-4

openclaw config set

设置指定路径的配置值。

bash
openclaw config set <path> <value> [选项]
选项类型说明
--jsonboolean将 value 作为 JSON 解析
bash
# 设置字符串值
openclaw config set agents.default.model gpt-4

# 设置 JSON 值(数组或对象)
openclaw config set agents.default.channels '["whatsapp","telegram"]' --json

openclaw config list

列出所有配置项及其当前值。

bash
openclaw config list [选项]
选项类型说明
--flatboolean平铺显示所有键值对
--jsonbooleanJSON 格式输出

openclaw config edit

在默认编辑器中打开配置文件。

bash
openclaw config edit

使用 $EDITOR 环境变量指定的编辑器,未设置时使用系统默认编辑器。

路径符号

配置路径使用点分隔符访问嵌套字段:

agents.default.model        → agents > default > model
channels.whatsapp.enabled   → channels > whatsapp > enabled
gateway.port                → gateway > port

示例

bash
# 获取配置值
openclaw config get gateway.port

# 设置端口
openclaw config set gateway.port 18789

# 列出所有配置
openclaw config list

# 平铺显示
openclaw config list --flat

# 编辑配置文件
openclaw config edit

# 重置为默认值
openclaw config reset gateway.port

另请参阅

基于MIT协议开源 | 内容翻译自 官方文档,同步更新