Clawbot
Clawdbot完整配置指南:从安装到Claude Code中转
Install / Use
/learn @xianyu110/ClawbotQuality Score
Category
Development & EngineeringSupported Platforms
README
Clawdbot完整配置指南:从安装到Claude Code中转

目录
推荐新的部署教程,从零开始打造你的AI工作助手:最全面的中文教程,涵盖安装、配置、实战案例和避坑指南!
简介
Clawdbot是一个开源的本地AI助手,支持通过消息应用(Telegram、WhatsApp、Discord等)或Web UI与AI模型交互。
核心特点:
- 🦞 完全开源,数据本地存储
- 💬 支持多种消息平台
- 🌐 提供Web控制面板
- 🔧 可自定义AI模型和API端点
系统要求
必需条件
| 项目 | 要求 | |------|------| | 操作系统 | macOS / Linux / Windows | | Node.js | 22.0.0 或更高版本 | | 包管理器 | pnpm(推荐)或 npm |
可选条件
- Xcode(仅macOS,如需构建原生应用)
- 消息平台账号(Telegram Bot Token、Discord Bot等)
安装步骤
1. 升级Node.js版本
Clawdbot要求Node.js 22+,使用nvm管理版本:
# 安装Node.js 22
nvm install 22
# 设置为默认版本
nvm use 22
nvm alias default 22
# 验证版本
node --version # 应显示 v22.x.x
2. 选择安装方式
方式一:npm安装(推荐)
npm install -g clawdbot
方式二:一键安装脚本
curl -fsSL https://clawd.bot/install.sh | bash
方式三:从源码安装
# 克隆仓库
git clone https://github.com/clawdbot/clawdbot.git
cd clawdbot
# 安装依赖
pnpm install
# 构建
pnpm build
# 链接CLI
npm link
3. 初始化配置
安装完成后运行配置向导:
clawdbot onboard
配置向导流程:
步骤1:安全确认
◇ Security ───────────────────────────────────────────────────────╮
│ Clawdbot agents can run commands, read/write files, and act │
│ through any tools you enable. │
│ Please read: https://docs.clawd.bot/security │
├──────────────────────────────────────────────────────────────────╯
◇ I understand this is powerful and inherently risky. Continue?
│ Yes
步骤2:选择AI后端
◇ Model/auth provider
│ Anthropic
◆ Anthropic auth method
│ ● Anthropic token (paste setup-token) ← 推荐Claude Max用户
│ ○ Anthropic token (Claude Code CLI)
│ ○ Anthropic API key
认证方式对比:
| 认证方式 | 适用场景 | 优点 | 缺点 | |---------|---------|------|------| | setup-token | Claude Max/Pro订阅用户 | 无需额外付费 | 需要额外步骤生成token | | Claude Code CLI | 已配置Claude Code的用户 | 自动读取凭证 | 可能找不到凭证文件 | | API Key | API按量付费用户 | 最直接 | 需要独立付费 |
步骤3:生成setup-token(Claude Max用户)
在另一个终端运行:
claude setup-token
复制生成的token,粘贴到配置向导中:
◇ Paste Anthropic setup-token
│ sk-ant-oat01-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
◇ Token name (blank = default)
│ default
◇ Default model
│ Keep current (default: anthropic/claude-opus-4-5)
提示: Claude Max订阅用户不需要单独购买API Key,使用setup-token即可复用订阅额度。
步骤4:配置消息平台(可选)
◇ Channel status ────────────────────────────╮
│ Telegram: not configured │
│ WhatsApp: not configured │
│ Discord: not configured │
│ ...共支持 12+ 平台 │
├─────────────────────────────────────────────╯
◇ Select channel (QuickStart)
│ Telegram (Bot API)
获取Telegram Bot Token:
- 在Telegram中搜索 @BotFather
- 发送
/newbot - 按提示输入Bot名称和用户名
- 复制Bot Token
步骤5:完成配置
◇ Telegram: ok (@YourBotName) (1416ms)
Agents: main (default)
Heartbeat interval: 1h (main)
◇ Control UI ─────────────────────────────────────────────────────╮
│ Web UI: http://127.0.0.1:18789/ │
│ Web UI (with token): http://127.0.0.1:18789/?token=your-token │
│ Gateway WS: ws://127.0.0.1:18789 │
├──────────────────────────────────────────────────────────────────╯
└ Onboarding complete.
步骤6:配对验证(如使用Telegram)
去Telegram给你的Bot发消息,会收到配对码:
Clawdbot: access not configured.
Your Telegram user id: 1234567890
Pairing code: ABC12345
Ask the bot owner to approve with:
clawdbot pairing approve telegram <code>
在终端批准配对:
clawdbot pairing approve telegram ABC12345
配置自定义中转站(多模型支持)
方案一:配置多模型中转站(推荐)
这个方案支持同时配置 GPT、Claude、Gemini 等多个模型。
1. 获取API凭证
从中转服务获取:
- API Base URL:
https://apipro.maynor1024.live - API Key:
sk-xxxxxxxxxxxxx
推荐服务:
- 推荐中转API:https://apipro.maynor1024.live/
- 购买链接:https://maynorai.tqfk.xyz/item/7
2. 修改主配置文件
⚠️ 重要提示: Clawdbot不支持通过环境变量
ANTHROPIC_BASE_URL来设置自定义API端点。必须通过配置文件的models.providers来配置。
步骤1:备份配置文件
cp ~/.clawdbot/clawdbot.json ~/.clawdbot/clawdbot.json.bak
步骤2:编辑配置文件
nano ~/.clawdbot/clawdbot.json
在配置文件中添加多个 provider:
{
"models": {
"mode": "merge",
"providers": {
"api-proxy-gpt": {
"baseUrl": "https://apipro.maynor1024.live/v1",
"api": "openai-completions",
"apiKey": "sk-你的API密钥",
"models": [
{
"id": "gpt-4o",
"name": "GPT-4o",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 128000,
"maxTokens": 8192
}
]
},
"api-proxy-claude": {
"baseUrl": "https://apipro.maynor1024.live",
"api": "anthropic-messages",
"apiKey": "sk-你的API密钥",
"models": [
{
"id": "claude-sonnet-4-5-20250929",
"name": "Claude Sonnet 4.5",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
},
"api-proxy-google": {
"baseUrl": "https://apipro.maynor1024.live/v1beta",
"api": "google-generative-ai",
"apiKey": "sk-你的API密钥",
"models": [
{
"id": "gemini-3-pro-preview",
"name": "Gemini 3 Pro",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 2000000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "api-proxy-claude/claude-sonnet-4-5-20250929"
},
"models": {
"api-proxy-gpt/gpt-4o": {
"alias": "GPT-4o"
},
"api-proxy-claude/claude-sonnet-4-5-20250929": {
"alias": "Claude Sonnet 4.5"
},
"api-proxy-google/gemini-3-pro-preview": {
"alias": "Gemini 3 Pro"
}
}
}
},
"auth": {
"profiles": {
"api-proxy-gpt:default": {
"provider": "api-proxy-gpt",
"mode": "api_key"
},
"api-proxy-claude:default": {
"provider": "api-proxy-claude",
"mode": "api_key"
},
"api-proxy-google:default": {
"provider": "api-proxy-google",
"mode": "api_key"
}
}
}
}
关键配置说明:
| 字段 | 说明 | 必需 | |------|------|------| | baseUrl | 自定义API端点 | ✅ | | apiKey | 你的API密钥 | ✅ | | api | API类型(openai-completions/anthropic-messages/google-generative-ai) | ✅ | | models | 模型列表,必须包含此字段 | ✅ |
步骤3:配置鉴权文件
编辑 ~/.clawdbot/agents/main/agent/auth-profiles.json:
nano ~/.clawdbot/agents/main/agent/auth-profiles.json
添加以下内容:
{
"version": 1,
"profiles": {
"api-proxy-gpt:default": {
"type": "api_key",
"provider": "api-proxy-gpt",
"key": "sk-你的API密钥"
},
"api-proxy-claude:default": {
"type": "api_key",
"provider": "api-proxy-claude",
"key": "sk-你的API密钥"
},
"api-proxy-google:default": {
"type": "api_key",
"provider": "api-proxy-google",
"key": "sk-你的API密钥"
}
},
"lastGood": {
"api-proxy-gpt": "api-proxy-gpt:default",
"api-proxy-claude": "api-proxy-claude:default",
"api-proxy-google": "api-proxy-google:default"
}
}
方案二:配置 Claude Code 中转(需要 User-Agent)
如果你使用的是需要 Claude Code User-Agent 验证的中转站:
1. 获取API凭证
- API Base URL:
https://code.claude-opus.top/api - API Key:
cr_xxxxxxxxxxxxx
2. 配置文件(带 User-Agent)
{
"models": {
"providers": {
"code-claude-opus": {
"baseUrl": "https://code.claude-opus.top/api",
"apiKey": "cr_你的API密钥",
"auth": "api-key",
"api": "anthropic-messages",
"models": [
{
"id": "claude-opus-4-20250514",
"name": "Claude Opus 4",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192,
"headers": {
"User-Agent": "Claude-Code/1.0.0"
}
}
]
}
}
}
}
关键点: 在 models 数组的每个模型中添加 headers 字段来设置自定义 User-Agent。
完整配置示例:
{
"meta": {
"lastTouchedVersion": "2026.1.25",
"lastTouchedAt": "2026-01-27T01:05:21.233Z"
},
"models": {
"providers": {
"anthropic": {
"baseUrl": "https://code.claude-opus.top/api",
"apiKey": "cr_你的API密钥",
"api": "anthropic-messages",
"models": []
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-4-5"
},
"workspace": "/Users/你的用户名/clawd",
"maxConcurrent": 4
}
},
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"auth": {
"mode": "token",
"token": "你的gateway_token"
}
},
"channels": {
"telegram": {
"enabled": false
}
}
}
步骤4:验证配置格式
# 使用jq验证JSON格式
cat ~/.clawdbot/clawdbot.json | jq '.models'
# 验证鉴权配置
cat ~/.clawdbot/agents/main/agent/auth-profiles.json | jq '.'
3. 重启Gateway服务
clawdbot gatewa
Related Skills
node-connect
336.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
336.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.9kCommit, push, and open a PR
Security Score
Audited on Mar 25, 2026
