跳转到主要内容
本文档中的功能需要 PPClaw v1.9.0 及以上版本,请先升级 CLI:macOS / Linux:
curl -fsSL https://ppclaw.ppio.com/install.sh | bash
Windows (PowerShell):
irm https://ppclaw.ppio.com/install.ps1 | iex
或通过 pipx:
pipx install ppclaw
还没部署过 OpenClaw?请先阅读新手快速部署完成首次安装和启动。

导出配置

使用 gateway config export 命令从沙箱导出 OpenClaw Gateway 配置文件。
# 输出到终端
ppclaw gateway config export <sandbox_id>

# 保存到文件
ppclaw gateway config export <sandbox_id> -o config.json

# JSON 模式(供脚本 / Agent 使用)
ppclaw --json gateway config export <sandbox_id>
导出的配置可能包含 API Key,请妥善保管导出文件。

导入配置

使用 gateway config import 命令将本地 JSON 配置全量覆盖写入沙箱。
# 导入并自动重启 Gateway(默认行为)
ppclaw gateway config import <sandbox_id> config.json

# 导入但不重启 Gateway
ppclaw gateway config import <sandbox_id> config.json --no-restart

# 跳过确认提示
ppclaw gateway config import <sandbox_id> config.json --yes
导入时会进行 JSON 合法性校验,非法 JSON 将被拒绝。非 JSON 模式下需要双重确认(显示覆盖警告 + Are you sure? 提示),--yes / -y 可跳过。

典型用法:跨沙箱迁移

# 从源沙箱导出
ppclaw gateway config export <source_id> -o config.json

# 手动编辑(可选)
vim config.json

# 导入到目标沙箱
ppclaw gateway config import <target_id> config.json

命令参考

命令说明
ppclaw gateway config export <id> [-o FILE]导出 OpenClaw 配置
ppclaw gateway config import <id> <FILE> [--no-restart] [--yes]导入 OpenClaw 配置(全量覆盖)