OpenClaw is the open-source AI gateway that lets you run a personal AI assistant on your own infrastructure. It connects to any major LLM provider — Anthropic, OpenAI, Google, MiniMax — and pipes everything through your messaging apps: Telegram, Discord, WhatsApp, Signal.

The result is an AI assistant that remembers who you are, runs 24/7, and does whatever you teach it to do. No subscription to someone else's platform. No data leaving your server unless you decide it should.

This guide walks you through the complete setup. By the end, you will have a working OpenClaw agent responding to messages in Telegram.

What You Need

  • A server or machine — A Linux VPS ($4-12/month from DigitalOcean, Hetzner, or Hostinger), a Mac, or Windows with WSL2
  • Node.js 22+ — OpenClaw runs on Node
  • An LLM API key — From Anthropic (Claude), OpenAI (GPT), Google (Gemini), or MiniMax (free tier available)
  • A Telegram account — For your first messaging channel

Which LLM should you start with? For best quality, go with Anthropic Claude. For free, MiniMax M2.5 has a generous free tier with a 200K context window. You can always switch or add more providers later — OpenClaw supports multiple simultaneously.

Phase 1: Install OpenClaw (5 minutes)

First, verify your Node.js version:

node --version
# Should output v22.x.x or higher

If you need to install or update Node.js:

# Using nvm (recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source ~/.bashrc
nvm install 22
nvm use 22

Now install OpenClaw globally:

npm install -g openclaw

Run the onboarding wizard — this handles initial configuration and sets up the background daemon:

openclaw onboard --install-daemon

The onboarding walks you through creating your workspace, setting up the gateway service, and configuring your first LLM provider.

Once complete, verify everything is running:

openclaw gateway status
# Should show "running" with an active PID

openclaw doctor
# Checks for common configuration issues

Troubleshooting: Gateway Won't Start

  • openclaw gateway status shows "stopped" → run openclaw gateway start
  • Port conflict → check if another process is using the gateway port
  • Permission issues → ensure your user owns the ~/.openclaw directory

Phase 2: Add Your LLM Provider (5 minutes)

OpenClaw needs at least one AI provider. Open your configuration file at ~/.openclaw/openclaw.json and add your provider credentials:

Option A: Anthropic (Claude)

{
  "providers": {
    "anthropic": {
      "apiKey": "sk-ant-your-key-here"
    }
  }
}

Option B: OpenAI (GPT)

{
  "providers": {
    "openai": {
      "apiKey": "sk-your-key-here"
    }
  }
}

Option C: MiniMax (Free Tier)

{
  "providers": {
    "minimax-portal": {
      "apiKey": "your-minimax-key"
    }
  }
}

Security note: Never commit API keys to version control. For production setups, use a separate secrets.env file with restricted permissions (chmod 600). The OpenClaw Field Guide covers proper secrets management in detail.

Set your default model in the same config:

{
  "agents": {
    "defaults": {
      "model": "anthropic/claude-sonnet-4-6",
      "models": {
        "anthropic/claude-sonnet-4-6": {}
      }
    }
  }
}

Restart the gateway to pick up changes:

openclaw gateway restart

Phase 3: Connect Telegram (5 minutes)

Telegram is the fastest channel to configure. Here is the process:

  1. Create a bot — Open Telegram, search for @BotFather, send /newbot, and follow the prompts. You will receive a bot token.
  2. Add the token to your config:
{
  "channels": {
    "telegram": {
      "token": "your-bot-token-from-botfather"
    }
  }
}
  1. Restart the gateway and test it — Find your bot in Telegram and send it a message. You should get a response from your configured LLM.

That is it. You now have a working AI assistant on Telegram. But it is a blank slate — it does not know who it is or what it should do. That is where workspace files come in.

Phase 4: Give Your Agent a Brain (10 minutes)

OpenClaw's workspace is a directory of files that your agent reads at the start of every conversation. This is what makes it fundamentally different from ChatGPT or a basic API wrapper — your agent has persistent, editable context.

Navigate to your workspace:

cd ~/.openclaw/workspace

SOUL.md — Who Your Agent Is

This file defines personality, voice, and behavioral rules:

# Who I Am
I am Atlas, a focused and practical AI assistant.

## Personality
- Direct and concise
- Technical depth when needed, plain language by default
- I admit when I do not know something

## Rules
- Never delete files without asking first
- Always cite sources for factual claims

USER.md — Who You Are

# About My Human
- **Name:** [Your name]
- **Timezone:** [Your timezone]  
- **Focus:** [What you mainly use this for]
- **Preferences:** Concise answers, code examples when relevant

MEMORY.md — Long-Term Memory

# Memory
## Key Facts
- [Important context your agent should always remember]

## Decisions
- [Track decisions so your agent does not re-litigate them]

Also create the daily memory directory:

mkdir -p memory

Restart one more time to load everything:

openclaw gateway restart

Send your bot another message. It should respond with the personality you defined.

Phase 5: Make It Useful (5 minutes)

Add a Heartbeat

The heartbeat system lets your agent check in periodically and do background work. Create HEARTBEAT.md in your workspace:

# Heartbeat Checklist
- [ ] Check if any reminders are due
- [ ] Review pending tasks in MEMORY.md
- If nothing needs attention, reply HEARTBEAT_OK

Add a Cron Job

Cron jobs run tasks on a schedule:

# Daily morning briefing at 8am
openclaw cron add \
  --schedule "0 8 * * *" \
  --prompt "Good morning. Check my calendar and give me a brief for today."

What You Should Have Now

Your 30-Minute Checklist — Complete

  • ✅ OpenClaw installed and gateway running
  • ✅ LLM provider configured
  • ✅ Telegram channel connected and responding
  • ✅ Agent persona defined (SOUL.md, USER.md, MEMORY.md)
  • ✅ Background automation started (heartbeat + optional cron)

Where to Go From Here

  • Add more channels — Discord, WhatsApp, Signal, or Slack
  • Install skills — Plugins that give your agent new capabilities
  • Set up sub-agents — Delegate specialized tasks to different AI models
  • Harden security — Lock down permissions, manage secrets, set up monitoring
  • Build workflows — Chain tools together for complex automation

Each of these topics could fill its own article. But if you want the complete picture in one place, organized and tested against real production deployments, that is exactly what we built the Field Guide for.

Go From Setup to Production-Ready

The OpenClaw Field Guide is 40 pages and 12 chapters of exactly this — setup, configuration, skill routing, memory architecture, cron automation, and multi-agent delegation. Everything you need to go from installed to indispensable.

Get the Field Guide — $24 →
Back to Blog