DEV Community

Cover image for How to Setup OpenClaw with Claude Code and Gemini 3 Pro (Fast and Easy)
Preecha
Preecha

Posted on

How to Setup OpenClaw with Claude Code and Gemini 3 Pro (Fast and Easy)

What if you could control Claude Code or Gemini 3 Pro from WhatsApp or Telegram without touching a terminal? OpenClaw makes this possible, turning your preferred AI models into messaging-based assistants you can chat with from anywhere.

Try Apidog today

If you want to use OpenClaw API, Claude API, CodeX API, Gemini API... for 30% cheaper, check out Zenn.CEO to access these APIs at a discount! Zenn.ceo — The Enterprise LLM Platform | Unified API, Intelligent Routing, AI Model Insurance

The Enterprise LLM Platform. Unified API for all models, intelligent routing, AI Model Insurance to eliminate hallucination risk, and developer-friendly analytics. Up to 50% off.

Image

Zenn.ceo

Image

The Problem: Terminal-Locked AI Access

Claude Code and Gemini 3 Pro run powerful AI models, but they lock you to a terminal or browser window. You cannot send commands away from your desk, check status while commuting, or delegate tasks without sitting at your keyboard.

OpenClaw closes this gap with a local gateway between AI models and messaging platforms. It runs on your machine, connects to Claude Code or Gemini 3 Pro using your existing API credentials, and relays messages through Telegram, WhatsApp, Discord, or Slack. You get full AI capabilities through familiar chat interfaces.

đź’ˇ Want a great API testing tool that generates beautiful API Documentation? Want an integrated, all-in-one platform for your developer team to work together with maximum productivity? Apidog delivers all your demands and replaces Postman at a much more affordable price!

Installing OpenClaw

1. Verify Node.js

OpenClaw requires Node.js 22 or higher:

node -v
Enter fullscreen mode Exit fullscreen mode

2. Run the installer

curl -fsSL https://openclaw.ai/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

The installer detects your OS, verifies dependencies, and handles setup automatically—no repository cloning or manual configuration. Windows users run the PowerShell equivalent:

iwr -useb https://openclaw.ai/install.ps1 | iex
Enter fullscreen mode Exit fullscreen mode

When installation completes, OpenClaw launches an interactive terminal UI (TUI). This conversation-first interface walks you through setup with natural-language prompts instead of configuration files.

install openclaw

3. Verify the installation

openclaw --version
Enter fullscreen mode Exit fullscreen mode

You should see the current version number. If you get a "command not found" error, confirm Node.js is in your PATH and restart your terminal—the installer adds OpenClaw to your executable path, but some shells require a restart to recognize new commands.

Configuring Claude Code and Gemini 3 Pro

OpenClaw supports multiple providers. Use Claude Code through Anthropic's API or Gemini 3 Pro through Google's API—whichever credentials you already have.

For Gemini 3 Pro (Google)

Select "Google" from the model provider list during onboarding, then choose an authentication method:

  • Google Gemini API key — direct API key authentication
  • Google Antigravity OAuth — bundled authentication plugin
  • Google Gemini CLI OAuth — command-line OAuth flow

The API key option works immediately if you have a key from Google AI Studio. The OAuth options require browser authentication but provide enhanced security.

configure openclaw with google gemini 3 pro

For Claude Code (Anthropic)

Select "Anthropic" in the onboarding wizard and enter your API key when prompted:

openclaw onboard
# Select: Anthropic API Key
# Enter: [REDACTED API KEY]
Enter fullscreen mode Exit fullscreen mode

Anthropic API keys are available at console.anthropic.com. OpenClaw stores your key securely in ~/.openclaw/openclaw.json.

Configuration file structure

Your selections are saved in ~/.openclaw/openclaw.json:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-opus-4-5"
      }
    }
  },
  "env": {
    [REDACTED CREDENTIAL]
  }
}
Enter fullscreen mode Exit fullscreen mode

Switch models anytime by editing this file or rerunning openclaw onboard.

Model selection strategy

Pick your primary model based on the task:

  • Claude Code — complex reasoning, code generation, agentic workflows requiring tool use
  • Gemini 3 Pro — faster response times and stronger multimodal capabilities for vision tasks

Both models support function calling and extended context windows. Configure a fallback so OpenClaw switches automatically when the primary hits rate limits or errors:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-opus-4-5",
        "fallback": "google/gemini-3-pro"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

This keeps the assistant running even when one provider experiences downtime.

Prompt Caching (Anthropic Only)

OpenClaw enables prompt caching automatically for Anthropic models, reducing costs for repeated similar prompts. The default cache duration is 5 minutes (short retention). Extend it to 1 hour by adding the extended-cache-ttl-2025-04-11 beta flag to your configuration.

Setting Up Messaging Channels in OpenClaw

OpenClaw supports eight messaging platforms. Telegram and WhatsApp offer the most straightforward setup if you prefer chat interfaces over terminals.

set up messaging channels in openclaw

Telegram Setup

Telegram's Bot API provides clean authentication without QR codes.

  1. Open Telegram and search for @botfather
  2. Send /newbot and follow the prompts
  3. Choose a name (e.g., "My OpenClaw Assistant")
  4. Choose a username ending in "bot" (e.g., myclawbot)
  5. Copy the API token provided

Paste this token when OpenClaw onboarding prompts for it. The gateway connects immediately and shows a confirmation message.

WhatsApp Setup

WhatsApp pairs via QR code through the WhatsApp Web protocol. Run the channel login command:

openclaw channels login
Enter fullscreen mode Exit fullscreen mode

A QR code appears in your terminal. Scan it with your phone:

  1. Open WhatsApp → Settings → Linked Devices
  2. Tap "Link a Device"
  3. Scan the QR code displayed

The connection persists until you manually unlink the device. Use a dedicated phone number for OpenClaw rather than your personal number—this protects your private messages if the bot misbehaves.

Security: Channel Pairing

When someone messages your bot for the first time, OpenClaw sends them a pairing code. Approve access via the CLI:

openclaw pairing approve telegram <CODE>
Enter fullscreen mode Exit fullscreen mode

This prevents unauthorized access even if someone discovers your bot's username. You can configure auto-approval for trusted contacts in ~/.openclaw/openclaw.json if preferred.

Multiple Channels

Channels run simultaneously on the same AI backend: send commands via Telegram, receive notifications via WhatsApp, and monitor status through Discord. Each channel maintains separate access controls and pairing status.

Channel Security Configuration

Control who can interact with your assistant using allowlists in ~/.openclaw/openclaw.json.

Telegram allowlist:

{
  "channels": {
    "telegram": {
      [REDACTED CREDENTIAL],
      "allowedChatIds": [123456789, 987654321]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

WhatsApp allowlist:

{
  "channels": {
    "whatsapp": {
      "allowFrom": ["+1234567890", "+0987654321"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Without an allowlist, anyone who discovers your bot's username can send messages, trigger AI requests, and consume your API quota.

Managing Your OpenClaw AI Agent

Once configured, interact with your agent through natural-language messages. OpenClaw sends your text to Claude Code or Gemini 3 Pro and returns the response in chat.

Basic Commands

Send any prompt directly:

Analyze the code in ~/projects/myapp and suggest optimizations
Enter fullscreen mode Exit fullscreen mode

Check system status:

/status
Enter fullscreen mode Exit fullscreen mode

This shows the active model, token usage, and current cost.

using openclaw with the terminal interface

Skills and Extensions

OpenClaw uses "skills"—folders of tools that extend capabilities. Enable them during onboarding or add them later:

  • File system access — read, write, and manage files
  • Browser automation — navigate websites, extract data
  • Web search — search engines with result summaries
  • Email integration — send and receive emails
  • Calendar access — schedule and retrieve events

Skills auto-configure when enabled. The bot learns the available tools and invokes them based on your natural-language requests.

configure openclaw skills

Web Dashboard

Open the management interface at http://localhost:18789 (or your configured port) to view:

  • Active channel connections
  • Message history and logs
  • Model configuration and switching
  • Token usage and cost tracking
  • Skill management

A graphical alternative to terminal management.

openclaw web inteface

Persistent Memory

Unlike stateless chatbots, OpenClaw maintains context across conversations. It stores conversation history, user preferences, and learned patterns locally in SQLite, so your assistant remembers previous discussions and improves over time.

Configure retention in ~/.openclaw/openclaw.json:

{
  "memory": {
    "enabled": true,
    "database": "./data/openclaw.db",
    "retention_days": 90
  }
}
Enter fullscreen mode Exit fullscreen mode

Memory Management Commands

# Clear history if responses become inconsistent or you want a fresh start
openclaw memory clear

# Export memory for backup or analysis
openclaw memory export > backup.json

# Import previously exported memories
openclaw memory import backup.json
Enter fullscreen mode Exit fullscreen mode

Memory files contain conversation history and learned preferences. Store backups securely—they may hold sensitive information from previous interactions.

Context Requirements

OpenClaw requires models with at least 64K token context length. Claude Code and Gemini 3 Pro exceed this. For local models through Ollama, verify context length:

ollama show <model> --modelfile
Enter fullscreen mode Exit fullscreen mode

Increase it with a custom Modelfile if needed:

FROM <model>
PARAMETER num_ctx 65536
Enter fullscreen mode Exit fullscreen mode

Running as a Service

Enable auto-start on boot by installing the daemon during onboarding:

openclaw onboard --install-daemon
Enter fullscreen mode Exit fullscreen mode

Or start manually:

openclaw gateway --port 18789 --verbose
Enter fullscreen mode Exit fullscreen mode

The gateway runs persistently, processing messages and maintaining channel connections. Check it anytime:

openclaw gateway status
Enter fullscreen mode Exit fullscreen mode

Security Considerations

  • Run OpenClaw as a non-privileged user; isolate it on a dedicated VPS or machine if possible
  • Review skill permissions before enabling—file system access lets the bot read and write files anywhere your user has permissions
  • Store API keys in environment variables or OpenClaw's secure configuration, never in version control
  • Rotate keys quarterly
  • Monitor the dashboard for unusual activity

Updating OpenClaw

npm update -g openclaw
Enter fullscreen mode Exit fullscreen mode

Or rerun the installer:

curl -fsSL https://openclaw.ai/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Review the changelog before major updates. Configuration files remain compatible across versions, but new features may require configuration adjustments.

Advanced OpenClaw Command Patterns

Use slash commands to control OpenClaw directly from chat.

Execute a specific skill or recipe (predefined workflows combining multiple skills—like checking email, summarizing calendar events, and generating a daily briefing):

/run default "Analyze this codebase"
Enter fullscreen mode Exit fullscreen mode

Force specific reasoning levels:

Ship checklist /think high
Enter fullscreen mode Exit fullscreen mode

/think high activates extended reasoning mode for complex problems. Use /think low for simple queries to reduce response time and token consumption.

Trigger browser automation with plain language:

Book the cheapest flight to Berlin next month
Enter fullscreen mode Exit fullscreen mode

OpenClaw launches a browser, searches flight aggregators, compares prices, and returns the best option with booking links.

Conclusion

OpenClaw transforms Claude Code and Gemini 3 Pro from terminal-bound tools into accessible messaging assistants. Configure once with your existing API credentials, connect your preferred messaging platform, and interact through natural chat. Your AI handles complex tasks while you stay mobile.

When building API integrations—whether testing OpenClaw endpoints, debugging authentication flows, or managing multiple provider configurations—streamline your development with Apidog. It provides visual API testing, automatic documentation generation, and collaborative debugging tools that complement your AI assistant workflow.

Top comments (0)