Deploy Your AI Telegram Bot in One Command (OpenClaw + CrazyRouter)
Setting up an AI-powered Telegram bot usually means juggling API keys from multiple providers, writing config files by hand, and debugging Docker setups. I built a one-click deploy script that handles everything — from installing Docker to generating configs to pairing your Telegram account.
5 minutes, one command, done.
What You Get
A Telegram bot running on your server powered by Claude Opus 4.6 (via CrazyRouter), supporting:
- Private conversations with full context
- Image recognition
- File processing
- Group chat with @mention replies
Terminal Deploy Process
Telegram Bot First Conversation
Prerequisites
1. CrazyRouter API Key
CrazyRouter is an AI API gateway — one key gives you access to 600+ models (GPT, Claude, Gemini, DeepSeek, Grok, etc.) without registering with each provider separately.
Sign up and grab your API key from the dashboard.
2. Telegram Bot Token
Message @botfather on Telegram, send /newbot, follow the prompts, get your token.
3. A Linux Server
- Ubuntu/Debian recommended
- Minimum: 1 vCPU, 1GB RAM
- Needs outbound internet access
Deploy
git clone https://github.com/xujfcn/openclaw-deploy.git
cd openclaw-deploy
chmod +x deploy.sh
sudo ./deploy.sh
The script will interactively ask for:
- Your CrazyRouter API Key
- Your Telegram Bot Token
- Runtime choice: Docker (recommended) or native Node.js
It then automatically:
- Installs Docker if needed
- Builds the
openclaw-bot:latestimage - Generates
openclaw.jsonconfig - Starts the container
- Optionally pairs your Telegram account
Pairing Your Telegram Account
OpenClaw uses a pairing system — the bot won't respond to anyone until you approve them.
- Send
/startto your bot on Telegram - Bot replies with a pairing code like
QE8E59CF - On your server:
docker exec openclaw-bot openclaw pairing approve telegram QE8E59CF
Done. The bot starts responding.
Switching Models
CrazyRouter supports 600+ models. To switch, just change model.id in openclaw.json:
| Model | model.id |
|---|---|
| Claude Opus 4.6 | claude-opus-4-6 |
| GPT-5.2 | gpt-5.2 |
| GPT-4o | gpt-4o |
| Gemini 3 Flash | gemini-3-flash-preview |
| DeepSeek V3.2 | deepseek-ai/DeepSeek-V3.2 |
| Grok 4.1 | grok-4.1 |
Then restart: docker restart openclaw-bot
Environment Variables for CI/CD
Skip interactive prompts with env vars:
export CRAZYROUTER_API_KEY="sk-xxxx"
export TELEGRAM_BOT_TOKEN="123456:ABC..."
export USE_DOCKER=1
sudo -E ./deploy.sh
Troubleshooting
Bot not responding? Check if you've paired: docker logs openclaw-bot
401 error? Wrong CrazyRouter API key. Check your dashboard.
Docker build slow? The npm install -g openclaw@latest step takes a minute. Image is cached after first build.
Links
- GitHub: xujfcn/openclaw-deploy
- CrazyRouter: crazyrouter.com — One API key, 600+ AI models
- OpenClaw: github.com/openclaw/openclaw
- API Docs: crazyrouter.apifox.cn
Star the repo if this helped! ⭐


Top comments (0)