OpenClaw DMXAPI 一键配置工具
纯 Go 终端 TUI 工具,零 CGO,支持多平台一键直接运行与 5 平台交叉编译
OpenClaw Config 是一个简洁易用的终端配置工具,帮助用户快速配置 OpenClaw 的 DMXAPI 设置,无需手动编辑配置文件。
使用本工具前,请确保已安装 OpenClaw。本工具会修改 OpenClaw 的配置文件;默认情况下,大多数 agent/model 变更会被 OpenClaw 自动热加载。
curl -fsSL https://cnb.cool/dmxapi/openclaw_config/-/git/raw/main/run.sh | sh
指定版本运行:
curl -fsSL https://cnb.cool/dmxapi/openclaw_config/-/git/raw/main/run.sh | env OPENCLAW_CONFIG_VERSION=vX.Y.Z sh
irm https://cnb.cool/dmxapi/openclaw_config/-/git/raw/main/run.ps1 | iex
指定版本运行:
$env:OPENCLAW_CONFIG_VERSION = "vX.Y.Z"; irm https://cnb.cool/dmxapi/openclaw_config/-/git/raw/main/run.ps1 | iex
curl.exe -fsSL https://cnb.cool/dmxapi/openclaw_config/-/git/raw/main/run.cmd | cmd
指定版本运行:
set OPENCLAW_CONFIG_VERSION=vX.Y.Z && curl.exe -fsSL https://cnb.cool/dmxapi/openclaw_config/-/git/raw/main/run.cmd | cmd
将 vX.Y.Z 替换为目标 Release Tag,例如 v1.2.3。以上命令都会临时下载对应平台的二进制,直接启动程序,并在退出后自动清理。
前往 Releases 页面下载对应平台的版本:
| 平台 | 架构 | 文件 |
|---|---|---|
| Linux | x64 | openclaw-config-linux-amd64 |
| Linux | ARM64 | openclaw-config-linux-arm64 |
| Windows | x64 | openclaw-config-windows-amd64.exe |
| macOS | Intel | openclaw-config-macos-amd64 |
| macOS | Apple Silicon | openclaw-config-macos-arm64 |
上面的命令会直接启动交互界面;程序退出后,临时下载的二进制会自动删除。
Linux / macOS 如需只查看版本:
curl -fsSL https://cnb.cool/dmxapi/openclaw_config/-/git/raw/main/run.sh | sh -s -- --version
# x64
chmod +x openclaw-config-linux-amd64
./openclaw-config-linux-amd64
# ARM64
chmod +x openclaw-config-linux-arm64
./openclaw-config-linux-arm64
# Intel
chmod +x openclaw-config-macos-amd64
./openclaw-config-macos-amd64
# Apple Silicon
chmod +x openclaw-config-macos-arm64
./openclaw-config-macos-arm64
注意:首次运行时 macOS 可能提示"无法验证开发者"。解决方法:
方法一:右键点击文件 → 选择"打开" → 在弹出对话框中再次点击"打开"
方法二:在终端执行以下命令清除隔离标记,然后再运行:
xattr -rd com.apple.quarantine ./openclaw-config-macos-arm64
在文件所在目录按住 Shift 并右键,选择"在此处打开 PowerShell 窗口",然后执行:
.\openclaw-config-windows-amd64.exe
./openclaw-config-<平台> --version
# 例:./openclaw-config-macos-arm64 --version
启动工具后,按顺序填写以下字段:
| 字段 | 说明 |
|---|---|
| Base URL | DMXAPI 的 API 接入地址,默认为 https://www.dmxapi.cn/v1,通常无需修改 |
| API Key | 在 dmxapi.cn 申请的 API 密钥,格式为 sk-... |
| 模型 | 从预设列表中选择,或选择"自定义模型..."后输入模型名称 |
配置保存后,默认依赖 OpenClaw 的 gateway.reload.mode=hybrid 自动生效,大多数 agent/model 变更无需手动重启。
当你修改的是网关级配置(如 gateway、plugins、discovery、canvasHost),或怀疑当前运行实例没有及时拾取配置时,再手动执行:
# 需要手动重启网关时执行:
openclaw gateway restart
| 命令 | 说明 |
|---|---|
openclaw gateway restart | 手动重启后台网关服务 |
/model | 在聊天中查看/切换模型 |
openclaw models list | 列出所有可用模型 |
openclaw-cn tui | 打开终端聊天助手 |
配置保存在以下文件中,可手动查看或备份:
~/.openclaw/openclaw.json~/.openclaw/agents/main/agent/auth-profiles.json~/.openclaw/agents/main/agent/models.jsongit clone https://cnb.cool/dmxapi/openclaw_config
cd openclaw_config
go run .
# 构建当前平台
go build -o openclaw-config .
# 交叉编译(5 平台)
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o dist/openclaw-config-linux-amd64 .
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o dist/openclaw-config-linux-arm64 .
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o dist/openclaw-config-windows-amd64.exe .
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o dist/openclaw-config-macos-amd64 .
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o dist/openclaw-config-macos-arm64 .
go test ./...
sh ./run_test.sh
openclaw_config/ ├── app.go # TUI 表单逻辑 ├── main.go # 程序入口(参数解析) ├── run.sh # macOS / Linux 直接运行脚本 ├── run.ps1 # Windows PowerShell 直接运行脚本 ├── run.cmd # Windows cmd 直接运行入口 ├── run_test.sh # 直接运行脚本测试 ├── internal/ │ ├── config/ │ │ ├── manager.go # 配置管理器 │ │ └── types.go # 配置类型定义 │ └── models/ │ └── presets.go # 预设模型列表 └── .cnb.yml # CNB 云原生构建配置
项目配置了自动化构建和发布:
yesongyun - yesongyun@foxmail.com
MIT