Skip to content

OpenClaw 配置教程

OpenClaw 是一个本地优先的个人 AI agent / Gateway。通过 PrimeRouter 接入 OpenClaw,推荐使用一键脚本,按提示选择 Anthropic(Claude)或 OpenAI(Codex)通道——所有请求都走你的 PrimeRouter 令牌、余额与调用日志。

两条通道,二选一

通道基础地址示例模型
Anthropic(Claude)https://primerouter.aiclaude-opus-4-8
OpenAI(Codex)https://primerouter.ai/v1gpt-5.5

Claude / Anthropic 接口不要/v1;OpenAI / Codex 接口必须/v1

推荐方式:交互式一键脚本

运行后选择通道、输入 API Key、从实时模型列表中选择模型,脚本会装好 OpenClaw 并写入配置。

bash
curl -fsSL https://primerouter.ai/install/openclaw.sh | bash
powershell
irm https://primerouter.ai/install/openclaw.ps1 | iex

💡 脚本执行后会提示输入 API Key。请先在 控制台 → 令牌 获取对应分组的 API Key,再按提示粘贴。

跑完先单发一句验证(单发消息必须用 --agent main 指定目标 agent,否则会报 No target session selected):

bash
openclaw agent --agent main --message "你好,介绍一下你自己"

交互模式直接启动:

bash
openclaw

备用方式:手动安装与配置 OpenClaw

需要审查命令、或一键脚本不可用时再展开

第一步:安装 OpenClaw

OpenClaw 要求 Node.js v22.19+

bash
npm install -g openclaw@latest

第二步:选择接入通道

YOUR_API_KEY 换成你的 PrimeRouter 令牌,按通道执行其中一条:

bash
openclaw onboard --auth-choice custom-api-key \
  --custom-base-url https://primerouter.ai \
  --custom-api-key YOUR_API_KEY \
  --custom-compatibility anthropic \
  --custom-model-id claude-opus-4-8
bash
openclaw onboard --auth-choice custom-api-key \
  --custom-base-url https://primerouter.ai/v1 \
  --custom-api-key YOUR_API_KEY \
  --custom-compatibility openai \
  --custom-model-id gpt-5.5

Anthropic(Claude)通道使用根地址,不要加 /v1;OpenAI(Codex)通道使用 /v1 地址。其余可用模型见 可用模型

第三步:开始使用

单发一句验证(单发消息必须用 --agent main 指定目标 agent):

bash
openclaw agent --agent main --message "你好,介绍一下你自己"

交互模式:

bash
openclaw

更完整的图文步骤——含各平台 Gateway 后台服务、Control UI、聊天频道接入与安全建议——见 编程工具 → OpenClaw