Run an autonomous AI agent with access to x402 payment APIs (USDC on Base). Works on local machines, EC2, or any remote server.
Read https://github.com/Merit-Systems/OpenClawX402 and help me set up OpenClaw with x402.
Be maximally proactive. Do everything on the user's behalf that doesn't require their input. Only ask questions when you genuinely need information you cannot determine yourself.
Use the AskUserQuestion tool to ask these questions upfront (combine into a single prompt when possible):
- Do you already have OpenClaw installed? (Yes / No)
- Where is OpenClaw installed (or where do you want to install it)?
- Local machine (macOS/Linux)
- AWS EC2 instance
- Other remote server (VPS, DigitalOcean, etc.)
- If yes to #1: What is the path to your OpenClaw installation? (e.g.,
~/openclaw,/home/ubuntu/openclaw)
Once you have the user's answers:
- Verify the installation by checking for
settings.jsonand.claude/directory at the provided path - Run all commands yourself - don't ask the user to run them unless you cannot (e.g., no SSH access)
- Install dependencies automatically - mcporter, skills, etc.
- Create directories and symlinks without asking
- Only pause for user input when required - e.g., funding the wallet (requires their action), or if a command fails and you need clarification
- Don't ask permission to install mcporter, skills, or create symlinks - just do it
- Don't ask which commands to run - execute them based on the user's environment
- Don't ask the user to copy/paste commands - run them yourself
- Don't ask for confirmation at each step - proceed through the guide automatically
Based on the user's answers, they need different prerequisites:
- Telegram bot via BotFather -
./telegram.md - GitHub account for the bot (not your main account) -
./github.md - Anthropic API key from console.anthropic.com
- AWS CLI configured with credentials
- Node.js 18+ installed
- Claude Code CLI installed (
npm install -g @anthropic-ai/claude-code)
| Guide | When to use |
|---|---|
./telegram.md |
All users - Create bot, get token, get your user ID |
./github.md |
All users - Bot GitHub account, token, repo organization |
./EC2.md |
EC2 only - AWS instance, SSH, security group, systemd |
./x402.md |
All users - mcporter, @x402scan/mcp, skills installation |
- Complete
./telegram.md - Complete
./github.md - Follow
./EC2.mdto provision instance and install Node.js - Run the onboard command (see official docs):
openclaw onboard --non-interactive --accept-risk \ --mode local \ --auth-choice apiKey \ --anthropic-api-key "$ANTHROPIC_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopback \ --install-daemon \ --daemon-runtime node
- Configure Telegram (see Telegram docs):
openclaw plugins enable telegram openclaw channels add --channel telegram --token "$TELEGRAM_BOT_TOKEN" openclaw config set channels.telegram.dmPolicy allowlist openclaw config set channels.telegram.allowFrom '[YOUR_TELEGRAM_USER_ID]' systemctl --user restart openclaw-gateway
- Follow
./x402.mdto add x402 support - Message your Telegram bot
- Complete
./telegram.md - Complete
./github.md - Skip EC2.md - Install OpenClaw locally using the official installer:
# macOS/Linux curl -fsSL https://openclaw.ai/install.sh | bash # Windows (PowerShell) iwr -useb https://openclaw.ai/install.ps1 | iex
- Run the onboard wizard (see official docs):
The wizard configures auth, gateway settings, and channels interactively.
openclaw onboard --install-daemon
- Add Telegram channel (if not done during onboard):
openclaw channels add --channel telegram --token "$TELEGRAM_BOT_TOKEN" openclaw pairing list telegram # See pending pairing requests
- Follow
./x402.mdto add x402 support - Message your Telegram bot (approve pairing when prompted)
- Verify
./telegram.mdis complete - Verify
./github.mdis complete - Skip to
./x402.mdto add x402 support - Message your Telegram bot
.
├── README.md # This file - overview and agent instructions
├── telegram.md # Telegram bot setup via BotFather
├── github.md # Bot GitHub account and token setup
├── EC2.md # AWS EC2 instance provisioning (optional)
└── x402.md # x402 payment integration
You (Telegram) --> OpenClaw Host --> Claude API
|
+--> mcporter --> @x402scan/mcp --> USDC payments
The "OpenClaw Host" can be:
- Your local machine (macOS/Linux)
- An EC2 instance
- Any server with Node.js 18+
- Anthropic API: pay-per-use
- x402 calls: pay-per-call (USDC)
- EC2 t3.small: ~$15/month
- EBS 25GB: ~$2/month
- No hosting costs
When installing OpenClaw from scratch, read the official documentation first:
- Non-interactive onboarding: https://docs.openclaw.ai/start/wizard#non-interactive-mode
- Telegram channel setup: https://docs.openclaw.ai/channels/telegram
For fresh installs, don't manually configure openclaw.json, systemd services, and gateway tokens piece by piece. The openclaw onboard --non-interactive command handles all of this correctly:
- Creates proper config structure
- Sets up gateway authentication
- Installs the systemd daemon (user-level service)
- Enables required plugins
-
Add Telegram via CLI: Use the channels CLI to add Telegram:
openclaw channels add --channel telegram --token "$TELEGRAM_BOT_TOKEN" -
Pairing vs Allowlist: By default,
dmPolicy: "pairing"requires users to be approved via:openclaw pairing list telegram openclaw pairing approve telegram <CODE>
Alternatively, configure allowlist mode via the CLI:
openclaw configure --section channels # Or directly set config values: openclaw config set channels.telegram.dmPolicy allowlist openclaw config set channels.telegram.allowFrom '[YOUR_TELEGRAM_USER_ID]'
-
Finding your Telegram User ID (no third-party bot needed):
# Start the gateway and DM your bot, then check logs: openclaw logs --follow # Look for "from.id" in the output
Or message
@userinfoboton Telegram. -
Restart after config changes: Always restart the gateway after config changes:
systemctl --user restart openclaw-gateway
If you see "Gateway auth is set to token, but no token is configured", the gateway will crash-loop. Use the onboard wizard which handles this automatically:
openclaw onboardIf you must manually configure:
openclaw config set gateway.auth.token "$(openssl rand -hex 32)"The onboard --install-daemon creates a user-level systemd service at:
~/.config/systemd/user/openclaw-gateway.service
Manage it with:
systemctl --user start openclaw-gateway
systemctl --user status openclaw-gateway
journalctl --user -u openclaw-gateway -fFor detailed logs:
# Systemd logs
journalctl --user -u openclaw-gateway -n 50 --no-pager
# Full log file
tail -100 /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log
# Telegram-specific logs
grep -i telegram /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log | tail -30