Skip to main content

Command Palette

Search for a command to run...

Deploy Your Own AI Assistant in One Command: Crazyrouter + OpenClaw Self-Hosting Guide

Published
4 min read
Deploy Your Own AI Assistant in One Command: Crazyrouter + OpenClaw Self-Hosting Guide

Why Self-Host an AI Gateway?

If you've used ChatGPT, Claude, and Gemini, you know the pain: separate accounts, separate API keys, separate billing for each platform.

Imagine this:

  • Claude for coding (best code quality)
  • GPT for daily chat (cheap)
  • Gemini for long document analysis (huge context window)
  • DeepSeek R1 for reasoning tasks (best value)

That's 4 API keys, 4 invoices, 4 different API formats.

Crazyrouter + OpenClaw solves this:

  • Crazyrouter: One API key for 300+ models (GPT, Claude, Gemini, DeepSeek, Kimi, etc.). OpenAI-compatible format, cheaper than official pricing.
  • OpenClaw: Open-source AI gateway that turns AI models into your personal assistant, supporting Telegram, Discord, Slack, and more.

Combined = your own AI infrastructure.

What You Get

After deployment:

  1. An AI gateway running on your server (port 18789)
  2. A Telegram Bot for chatting with AI anytime, anywhere
  3. 15+ popular models pre-configured and ready to use

Telegram Bot chat After deployment, send /start in Telegram to pair and start chatting with your AI assistant

Prerequisites

ItemHow to Get
Crazyrouter API KeyRegister at crazyrouter.com
Telegram Bot Token (optional)Create via @BotFather on Telegram

Server requirements:

  • Linux (Ubuntu/Debian/CentOS) or macOS
  • 4GB+ RAM
  • Internet access

One-Command Install

curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bash

Or download first:

wget https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh
bash install.sh

Non-interactive mode:

CRAZYROUTER_API_KEY=sk-yourkey curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bash

Installation Process

The script runs 10 automated steps with progress bars and an ASCII art banner:

Installation part 1 Steps 1-7: System detection, Node.js and OpenClaw installation, config generation, stability patch

Installation part 2 Steps 7-10: IM plugins, systemd service, gateway startup

After completion, the script displays:

  • WebUI access URL
  • Default model (claude-sonnet-4-6)
  • Config file path
  • Gateway Token (save this!)
  • Management commands

Total time: ~2-5 minutes depending on network speed.

Pre-configured Models

VendorModelStrength
AnthropicClaude Opus 4.6Best overall
AnthropicClaude Sonnet 4.6Best value
OpenAIGPT-5.2Latest flagship
OpenAIGPT-5.3 CodexCode specialist
GoogleGemini 3.1 ProLong context
GoogleGemini 3 FlashUltra-fast
DeepSeekR1Strong reasoning
DeepSeekV3.2Best for Chinese
OthersKimi K2.5, GLM-5, Grok 4.1, MiniMax M2.1Various strengths

All models through Crazyrouter — one API key for everything.

Connecting Telegram Bot

Step 1: Create a Bot

Search @BotFather on Telegram, send /newbot, follow the prompts:

BotFather creating a bot Create a Bot in BotFather and get your Token

Step 2: Paste Token and Pair

Paste the token into the install script. It automatically writes config, restarts the gateway, and guides you through pairing:

Telegram Bot setup and pairing Interactive guide: paste Token, write config, restart, auto-pair

Step 3: Start Chatting

After pairing, just talk to your Bot on Telegram:

First conversation with the bot After /start pairing, the AI assistant greets you automatically

Supported IM Platforms

  • Discord — Gaming community AI
  • Slack — Team collaboration AI
  • Feishu/Lark — Enterprise AI
  • DingTalk — Office AI assistant
  • WeCom — WeChat ecosystem AI
  • QQ Bot — Social AI

Docker Deployment (Optional)

git clone https://github.com/xujfcn/crazyrouter-openclaw.git
cd crazyrouter-openclaw
docker build -t openclaw-bot .
docker run -d --name openclaw-bot -p 18789:18789 -v ~/.openclaw:/root/.openclaw openclaw-bot

Post-Install Management

# Linux (systemd)
systemctl --user status openclaw    # Status
journalctl --user -u openclaw -f   # Live logs
systemctl --user restart openclaw  # Restart
systemctl --user stop openclaw     # Stop

Stability

Built-in crash-guard.cjs handles Node.js 22 + undici 7.x TLS crashes:

  • TLS Session protection against null pointer crashes
  • Automatic suppression of transient undici errors
  • Stale lock file cleanup
  • Memory directory backup every 5 minutes

Your AI gateway runs 24/7 without manual intervention.

FAQ

Q: How is Crazyrouter different from OpenRouter? Lower prices, supports Chinese models (DeepSeek, Kimi, GLM), fully OpenAI-compatible API. No overseas credit card needed.

Q: Can it run on Raspberry Pi? Yes! The script supports arm64. Raspberry Pi 4/5 works perfectly.

Q: How much does it cost? Crazyrouter charges per token, cheaper than official APIs. See crazyrouter.com.

Summary

One command gives you:

  • Private gateway for 300+ AI models
  • Telegram AI assistant available 24/7
  • Auto-start + crash recovery
  • Unified API interface
curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-openclaw/main/install.sh | bash

Try it — you'll have your own AI in 2 minutes.


Links:

More from this blog

AI insignt

38 posts