
这是我们openclaw teaching的第一篇,大家可以先码住,之后的计划会再出3-5篇,讲中高阶的详细用法
一、先搞清楚 OpenClaw 到底是什么
OpenClaw 本质上是一个本地运行的 AI 网关
它的架构很简单:
→ 你的电脑跑一个 Gateway 进程(理解为中转站)→ Gateway 连接你的聊天软件(Telegram/Discord/WhatsApp)→ Gateway 再连接 AI 模型(Claude/GPT/DeepSeek)→ 你在 Telegram 发消息 → Gateway 转给 AI → AI 回复转回 Telegram
为什么要这么设计
因为大部分 AI 服务(Claude、GPT)都没有直接提供 Telegram 机器人,你要么用网页版,要么用 App
但 OpenClaw 让你可以在任何聊天软件里和 AI 对话,而且所有记忆、配置都存在你自己电脑上(~/.openclaw/),没有隐私泄露风险
二、前期准备|别急着装,先把这些搞定
1. 硬件与系统要求
Mac 用户:最省心,原生支持 macOSWindows 用户:必须装 WSL2(Windows Subsystem for Linux),强烈建议用 Ubuntu 22.04Linux 用户:直接开干
如果你想 24 小时挂机,建议:
- Mac Mini(最省电,官方推荐)
- 云服务器 VPS(DigitalOcean 12 美元/月起,Hostinger 也可以,国内的也行)
2. 大模型 API 准备
OpenClaw 支持几乎所有主流模型,但你需要提前准备好 API Key
推荐方案对比:
ChatGPT Plus 订阅(⭐⭐⭐⭐⭐)
$20/月,官方白名单支持,最省心
阿里云百炼 Coding Plan(⭐⭐⭐⭐⭐)
¥100-200/月,国内稳定,通义千问 Qwen3-Max/kimi k2.5 非常不错
OpenRouter(⭐⭐⭐⭐)
按量付费,约 $3-15/天,多模型切换,适合测试
AI/ML API(⭐⭐⭐⭐)
按量付费,支持多模型,OpenClaw 官方集成伙伴
Kimi K2.5(⭐⭐⭐⭐)
按量付费,月之暗面积极支持 OpenClaw
中转站(⭐⭐⭐)
便宜但不稳定,风险高
Ollama 本地模型(⭐⭐⭐)
完全免费,零成本但效果差,适合学习
My suggestions:
- 新手先用 OpenRouter 或 AI/ML API,按量付费,不浪费
- 确定要长期用了,再上个chatgpt的订阅,其实挺合适的
- 千万别一上来就搞中转站,翻车了排查问题你都不知道是模型问题还是配置问题
3. 翻墙环境(重要)
Telegram 和 Discord 都需要翻墙才能连接
你需要:
- Clash Verge / Clash for Windows / Surge
- 一个稳定的机场节点
- 开启 TUN 模式(这个很多人忘了,不开 TUN 模式,终端走不了代理)
验证方法:
curl -I https://api.telegram.org
如果返回 200,说明你的终端能访问 Telegram API
三、正式安装|跟着走不会错
Step 1: 安装 Homebrew 和 Node.js
打开终端(Terminal),先装 Homebrew:
/bin/bash -c “$(curl -fsSL )”
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
装完后安装 Node.js:
brew install nodejs
验证安装:
node –version # 应该显示 v22.x.x 或更高
npm –version
重要:OpenClaw 要求 Node.js 版本≥22,低于这个版本会报错
Step 2: 安装 OpenClaw
推荐方式(官方向导):
curl -fsSL | bash https://openclaw.ai/install.sh
这个脚本会自动帮你:
- 安装 OpenClaw CLI 工具
- 创建配置目录(~/.openclaw/)
- 设置环境变量
安装完成后,运行:
openclaw -version
看到版本号就说明装好了
Step 3: 启动配置向导
这是最关键的一步:
openclaw onboard –install-daemon
–install-daemon 参数会让 OpenClaw 在后台持续运行,即使重启电脑也会自动启动
接下来会进入交互式向导,分几个环节:
四、配置流程|这里是大部分人卡住的地方
4.1 选择 AI 模型提供商
向导会列出:
- OpenAI (GPT)
- kimi…
- ….
- 跳过(Skip)
如果你有官方账号:直接选对应的,然后会跳转浏览器授权
如果你用第三方 API(OpenRouter、中转站等):选择 Skip
跳过后,向导会继续,别担心,我们后面手动配置
4.2 选择聊天平台
向导会问你要连接哪个平台:
● Telegram (Bot API) ← 推荐新手
○ WhatsApp (QR code)
○ Discord (Bot API)
○ Slack○ 跳过(Skip)
为什么推荐 Telegram:
- 配置最简单(3 分钟搞定)
- Bot 创建无需审核
- 支持长消息和文件传输
- 有完整的 Bot 管理面板
Discord 适合什么人:
- 已经有 Discord 服务器的团队
- 需要多人协作的场景
- 配置时间约 10 分钟【7]
这里我们先选 Telegram
4.3 创建 Telegram Bot
打开 Telegram,搜索 @BotFather(这是官方的机器人工厂)
发送 /start 开始对话
然后按顺序发送:
- /newbot
- Enter your Bot display name (e. g. my AI assistant)
- Enter Bot username (must end with _bot, e. g. ai_bot)
After success, BotFather returns a Token format similar to:
1234567890: ABCdefGHIjklMNOpqrsTUVwxyz
Copy this TokenBack to the terminal. Paste in
4.4 Completion of initial configuration
The wizard will ask if you want to install Skills, for example:
- Web Search
- Mail Management
- Organisation
- File Operations
The new guy suggested we skip first, wait for the basics to go through
After the configuration is completed, the Wizard will automatically start Gateway:
• Gateway started on http://127.0.0.1:18789
Telegram channel conned
Ready to chat!
CONFIGURE THIRD-PARTY AI MODELS
If you choose Skip in 4.1, now you need a manual configuration model (the following steps strongly recommend cursor and so on to be an assistant
Method 1: Through Web UI Configuration (Recommended)
Open browser, access:
http://127.0.0.1:18789
This is OpenClaw's control panel
Click Settlings →Models →Add Projecter
FILL IN YOUR API MESSAGE:
- Provider Name: Custom (e. g. openrouter)
- Base URL: Your API address
- Your key
- Model ID: Specific model name (e.g. claude-opus-4)
After saving, texting test for Bot in Telegram
Method 2: Directly edit configuration files
Open profile:
~/.openclaw/openclaw.json
found models.providers section, add:
{“Models”: {“providers”: {“openrouter”: {“baseUrl”: “https://openrouter.ai/api/v1”, “apiKey”: “your-api-key-here”, “api”: “openai-complements”, “models”: [{id”: “anthropic/claude-opus-4”, “name”: “Claude Opus 4”, “reasing”: True}}, “agents”:}, {“defaults”: {model: {primary”: {openrouter/antrope-opus-4}}
Start again after saving
openclaw present
METHOD 3: USE AI/ML API (OFFICIAL INTEGRATION)
IF YOU USE AI/ML API, YOU CAN USE THEIR SPECIAL VERSIONS DIRECTLY WHEN INSTALLED:
@latest
This version will automatically configure the AI/ML API Skills
VI. CONFIGURE THE NETWORK AGENT SO THAT YOUR AI CAN ACCESS THE NETWORK
Bot didn't get back
Confirm your proxy port
Open Clash Verge, see:
- HTTP PORT (GENERALLY 7890)
- SOCKS5 PORT (GENERALLY 7891)
设置环境变量
edit shell profile:
# if with zsh (Mac Default)
~ /.zshrc
# if use bash
~/.bahrc
Add at the end of the document:
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
for example, all_proxy=socks5://127.0.0.1:7891
Save and reload:
~/.zshrc # or ~/.bashrc
Restart OpenClaw:
openclaw present
Validation agent:
Message to Bot in Telegram: Search OpenClaw for updates
If you can return the result, indicate that the agent's configuration is successful
VII. PROGRESS CONFIGURATION MAKES AI REALLY USEFUL
7.1 CONFIGURE PERSONALISED SOUL
OpenClaw supports custom AI character and behaviour rules
Edit files:
nono~/.openlaw/workspace/SOUL.md
Write your requests, for example:
# MY IAA ASSISTANT PERSONALISATION - CALL ME "BOSS" - RESPONDS STYLE: SIMPLICITY, NO BULLSHIT - EXPERTISE IN THE FIELD: PRODUCT DESIGN, TECHNICAL STRUCTURES, CONTENT CREATION - BAN: DON'T ACTIVE TALK, DON'T SAY "SORRY" THAT'S THE KIND OF TALK
ONCE SAVED, AI WILL RETURN TO YOU WITH THIS SETUP
7.2 Security configuration (this must be done)
OpenClaw was warned by a safety researcher about the risks because of the overload
Security measures that must be put in place:
- Limit API spending caps on your API provider backstage (OpenRouter/Claude etc.) to a daily/monthly budget cap
- enable sensitive operation to confirm edit configuration file, find tables section:
{“tools”: {“exec”: {enabled”: true, “approval Required”: true / / / need your confirmation before executing the command}, “email”: {enabled”: true, “approval Required”: true / / e-mail requires your confirmation }
- OpenClaw is not exposed to the public web Gateway default listening 127.0.0.1:18789, only in-house access, and never change to 0.0.0.0
VIII. CLASSING ISSUES
Question 1: Bot doesn't reply
Quest steps:
# 1. Check whether Gateway is running openclaw status
# 2. View logbooks
# 3. Test model connection openclaw anent –message "test" -thining high
If logs see ECONNREFUSED or timeout, it's a web-based proxy problem
If you see 401 Unauthorized, it's API Key error
If you see arate limitt, it's your API level
Question 2: Port occupied
Error: listen EADDRINUE: address already in use #18789
Resolve:
# PROCESS OF FINDING PORT OF OCCUPATION
lsof-i:18789
# KILL PROCESS (PID IS THE LAST AVAILABLE NUMBER)
you know, kill-9 on the ped
# Restart OpenClaw
openclaw present
</pid>
Question 3: Telegram pair failed
If Bot creates but does not match:
# VIEW PAIRING
openclaw calling list
# MANUAL APPROVAL PAIR
your Telegram User ID
Your User ID can be retrieved from Telegram@userinfobot
IX. COSTS AND POSITION RECOMMENDATIONS
We'll talk about the cost
Minimum cost scenario(approximately 30 yuan/month):
- Ollama Local Model
- Telegram
- My own computer is on 24 hours a day
- Total: 20-30 yuan/month
Price-for-money scheme(approximately 150 yuan/month):
- OpenRouter Pays by Volume (approximately $100/month, light)
- Telegram (free of charge)
- CLOUD SERVER VPS (APPROXIMATELY 50 YUAN/MONTH)
- Total: 150 yuan/month
The Too programme(approximately $1,000 per month):
- direct to claude api
- Mac Mini local running (one-time input of $3000)
- Total: First month 4000+, follow-up 1000+/month
My advice: run for a week or two, make sure you really use it, and then think about promotion
It's written at the end
OpenClaw's core value is not another AI chat tool
It's to shorten the process of "open the browser to log in and copy the results" to "send a message at Telegram"
This is the productivity tool that super-individuals need: seamless, ready, continuous memory
But it's not all-powerful either. Current problems include:
- It's too fast to update
- Skills, of mixed quality, some with security risks
- Configure complexity is not very friendly to white
But none of this prevents it from becoming the most promising open source project in 2026
If you have problems, don't give up
Claude Code or GitHub in OpenClaw
THE TECHNOLOGY IS ALWAYS FOR PEOPLE