在 Linux 或 macOS 上一条命令部署 OpenClaw AI 网关,使用 Crazyrouter 作为 AI API 后端,支持 300+ 模型。
curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bash或者下载后运行:
wget https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh
bash install.sh脚本会自动安装 Node.js,但需要 Homebrew 作为包管理器。如果你的 Mac 还没有安装 Homebrew:
打开终端(Terminal),运行:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"安装完成后,按照终端提示把 Homebrew 添加到 PATH。通常会提示你运行类似这两条命令:
# Apple Silicon (M1/M2/M3/M4)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# Intel Mac
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/usr/local/bin/brew shellenv)"验证安装:
brew --version脚本会自动通过 Homebrew 安装 Node.js,但如果你想提前安装:
brew install node@22
brew link --overwrite node@22
node -v # 应显示 v22.x.xcurl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bash- Crazyrouter API Key — 在 crazyrouter.com 注册并获取
- Telegram Bot Token(可选)— 在 Telegram 找 @BotFather 创建 Bot 后获取
脚本会自动完成以下步骤:
- 检测系统环境(Linux/macOS, x64/arm64)
- 安装 Node.js 22+(如未安装)
- 安装 OpenClaw npm 包
- 收集 API Key 并生成配置
- 预配置 15+ 热门 AI 模型
- 应用稳定性补丁
- 安装 IM 插件(钉钉、企业微信、QQ Bot)
- 配置系统服务(systemd/launchd)自动启动
- 启动 OpenClaw 网关
- 交互式 Telegram Bot 设置与自动配对
| Provider | 模型 |
|---|---|
| Claude | Opus 4.8(默认), Sonnet 4.6 |
| GPT | 5.5(默认备用), 5.2, 5.3 Codex, 5 Mini, 4.1, 4.1 Mini, 4o Mini |
| Gemini | 3.1 Pro, 3 Flash |
| DeepSeek | R1, V3.2 |
| 其他 | Kimi K2.5, GLM-5, Grok 4.1, MiniMax M2.1 |
| 变量 | 说明 | 默认值 |
|---|---|---|
CRAZYROUTER_API_KEY |
预设 API Key,跳过交互输入 | — |
GATEWAY_PORT |
网关端口 | 18789 |
INSTALLER_LANG |
安装语言 (zh/en) |
交互选择 |
非交互安装示例:
CRAZYROUTER_API_KEY=sk-xxx curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bashsystemctl --user status openclaw # 查看状态
journalctl --user -u openclaw -f # 查看日志
systemctl --user restart openclaw # 重启
systemctl --user stop openclaw # 停止tail -f ~/.openclaw/openclaw.log # 查看日志
launchctl stop com.crazyrouter.openclaw && launchctl start com.crazyrouter.openclaw # 重启
launchctl stop com.crazyrouter.openclaw # 停止macOS: "command not found: brew"
Homebrew 未安装或未添加到 PATH。请先安装 Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"然后按终端提示添加到 PATH,或重新打开终端窗口。
macOS: "command not found: node"(安装后)
Node.js 通过 Homebrew 安装后可能需要 link:
brew link --overwrite node@22或重新打开终端窗口。
端口 18789 被占用
修改端口:
GATEWAY_PORT=28789 curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bash或编辑 ~/.openclaw/openclaw.json 中的 gateway.port。
如何卸载?
# 停止服务
# Linux:
systemctl --user stop openclaw && systemctl --user disable openclaw
# macOS:
launchctl stop com.crazyrouter.openclaw
rm ~/Library/LaunchAgents/com.crazyrouter.openclaw.plist
# 删除数据和配置
rm -rf ~/.openclaw
# 卸载 npm 包
npm uninstall -g openclaw- Telegram(安装时交互式设置)
- Discord
- Slack
- 飞书
- 钉钉
- 企业微信
- QQ Bot
- Linux (x64/arm64) 或 macOS (x64/arm64)
- 1-2 GB 内存
- 可访问互联网
- Crazyrouter API Key
Deploy an OpenClaw AI gateway on Linux or macOS with a single command, powered by Crazyrouter as the AI API backend with 300+ models.
curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bashOr download and run:
wget https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh
bash install.shThe installer supports both Chinese and English — you'll be prompted to choose a language at startup.
The script auto-installs Node.js, but requires Homebrew as the package manager. If you don't have Homebrew yet:
Open Terminal and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"After installation, follow the terminal instructions to add Homebrew to your PATH. You'll typically need to run something like:
# Apple Silicon (M1/M2/M3/M4)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# Intel Mac
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/usr/local/bin/brew shellenv)"Verify:
brew --versionThe script handles this automatically via Homebrew, but if you prefer:
brew install node@22
brew link --overwrite node@22
node -v # Should show v22.x.xcurl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bash- Crazyrouter API Key — Sign up at crazyrouter.com
- Telegram Bot Token (optional) — Create a bot via @BotFather on Telegram
The script automatically handles:
- System detection (Linux/macOS, x64/arm64)
- Node.js 22+ installation (if not present)
- OpenClaw npm package installation
- API key collection and config generation
- Pre-configuration of 15+ popular AI models
- Stability patches (TLS crash guard)
- IM plugin installation (DingTalk, WeCom, QQ Bot)
- System service setup (systemd/launchd) for auto-start
- OpenClaw gateway startup
- Interactive Telegram Bot setup with auto-pairing
| Provider | Models |
|---|---|
| Claude | Opus 4.8 (default), Sonnet 4.6 |
| GPT | 5.5 (default fallback), 5.2, 5.3 Codex, 5 Mini, 4.1, 4.1 Mini, 4o Mini |
| Gemini | 3.1 Pro, 3 Flash |
| DeepSeek | R1, V3.2 |
| Others | Kimi K2.5, GLM-5, Grok 4.1, MiniMax M2.1 |
| Variable | Description | Default |
|---|---|---|
CRAZYROUTER_API_KEY |
Pre-set API key, skips interactive prompt | — |
GATEWAY_PORT |
Gateway port | 18789 |
INSTALLER_LANG |
Installer language (zh/en) |
Interactive |
Non-interactive install example:
CRAZYROUTER_API_KEY=sk-xxx INSTALLER_LANG=en curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bashsystemctl --user status openclaw # Check status
journalctl --user -u openclaw -f # View logs
systemctl --user restart openclaw # Restart
systemctl --user stop openclaw # Stoptail -f ~/.openclaw/openclaw.log # View logs
launchctl stop com.crazyrouter.openclaw && launchctl start com.crazyrouter.openclaw # Restart
launchctl stop com.crazyrouter.openclaw # StopmacOS: "command not found: brew"
Homebrew is not installed or not in PATH. Install it first:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Then follow the terminal instructions to add it to PATH, or reopen your terminal.
macOS: "command not found: node" (after install)
Node.js installed via Homebrew may need linking:
brew link --overwrite node@22Or reopen your terminal window.
Port 18789 already in use
Change the port:
GATEWAY_PORT=28789 curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bashOr edit gateway.port in ~/.openclaw/openclaw.json.
How to uninstall?
# Stop the service
# Linux:
systemctl --user stop openclaw && systemctl --user disable openclaw
# macOS:
launchctl stop com.crazyrouter.openclaw
rm ~/Library/LaunchAgents/com.crazyrouter.openclaw.plist
# Remove data and config
rm -rf ~/.openclaw
# Uninstall npm package
npm uninstall -g openclaw- Telegram (interactive setup during install)
- Discord
- Slack
- Feishu (Lark)
- DingTalk
- WeCom (WeChat Work)
- QQ Bot
- Linux (x64/arm64) or macOS (x64/arm64)
- 1-2 GB RAM
- Internet access
- Crazyrouter API Key
MIT
- Crazyrouter — AI API Gateway
- OpenClaw — Self-hosted AI Assistant
- OpenClaw Docs