How to Connect Claude AI API to Your OpenClaw Instance (CLI)

How to Connect Claude AI to Your OpenClaw Instance 

Product: OpenClaw VM and OpenClaw Basic VM

Category: Getting Started
Difficulty: Intermediate


What is This?

Your OpenClaw Product 2 instance is a CLI-based AI agent that needs to connect to an AI model to work. This guide walks you through connecting it to Claude, one of the most powerful AI models available, made by Anthropic.

Once connected, your OpenClaw assistant will be able to:

  • Answer questions instantly
  • Draft emails and documents
  • Help with research and analysis
  • Automate tasks and workflows

What You Will Need

  • Your OpenClaw VM IP address and root password (sent in your welcome email)
  • An SSH client (Terminal on Mac/Linux, PuTTY or Windows Terminal on Windows)
  • A credit card to create your Anthropic account
  • About 10 minutes

Part 1 — Get Your Claude API Key

Step 1 — Create Your Anthropic Account

  1. Open your browser and go to https://console.anthropic.com
  2. Click Sign Up
  3. Enter your email address and create a password
  4. Check your email and click the verification link
  5. You will land on the Anthropic Console dashboard

Step 2 — Add Credits

Claude API is pay-as-you-go. $5 is enough for thousands of messages.

  1. On the dashboard click "Add funds"
  2. Select $5 to start
  3. Enter your billing address and card details
  4. Click "Buy credits"

???? Tip: At typical usage, $5 worth of credits lasts several months for a single user.

Step 3 — Create Your API Key

  1. Click "Get API key" (top right of dashboard)
  2. Click "Create Key"
  3. Give it a name — for example: my-openclaw
  4. Click Create
  5. Copy the key — it looks like: sk-ant-api03-xxxxxxxxxxxx

⚠️ Important: Save your API key somewhere safe (password manager). You will not be able to see it again after closing this window.


Part 2 — Connect Claude to Your OpenClaw Instance

Step 4 — SSH Into Your VM

Open your terminal and connect to your OpenClaw VM:

ssh root@[your-vm-ip]

Enter your root password when prompted.
(Both IP and password were sent in your welcome email)

Step 5 — Navigate to OpenClaw Directory

cd /opt/openclaw

Step 6 — Apply Your API Key

Copy the command below, replace YOUR_KEY_HERE with your actual API key, then run it:

docker compose run --rm --no-deps --entrypoint node openclaw-gateway \
  dist/index.js config patch --stdin << 'EOF'
{
  "models": {
    "providers": {
      "anthropic": {
        "apiKey": "YOUR_KEY_HERE",
        "baseUrl": "https://api.anthropic.com",
        "models": [
          {
            "id": "claude-haiku-4-5-20251001",
            "name": "Claude Haiku",
            "contextWindow": 200000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-haiku-4-5-20251001"
      }
    }
  }
}
EOF

Step 7 — Set Gateway Mode

docker compose run --rm --no-deps --entrypoint node openclaw-gateway \
  dist/index.js config set gateway.mode local

Step 8 — Restart OpenClaw

docker compose restart openclaw-gateway

Wait a few seconds, then verify it started correctly:

docker compose logs --tail=20 openclaw-gateway

You should see at the end:

[gateway] ready
[heartbeat] started

Part 3 — Test Your Setup

Step 9 — Launch the OpenClaw CLI

docker compose exec openclaw-gateway node dist/index.js chat

You should see:

local ready | idle
agent main | session main | anthropic/claude-haiku-4-5-20251001 | tokens ?/200k

Step 10 — Send a Test Message

Type the following and press Enter:

What is the capital of France?

You should get an instant response: The capital of France is Paris.

If it works — you are all set! ????

To exit the CLI press Ctrl+C


Choosing the Right Claude Model

Model Speed Quality Best for
Claude Haiku ⚡ Fastest ⭐⭐⭐⭐ Everyday tasks, quick answers
Claude Sonnet ⚡ Fast ⭐⭐⭐⭐⭐ Complex tasks, long documents

We recommend starting with Claude Haiku — it handles most tasks perfectly and costs less.

To switch to Sonnet, replace claude-haiku-4-5-20251001 with claude-sonnet-4-5-20251001 in Step 6.


How Much Will It Cost?

Usage Estimated monthly cost
Light use (few messages/day) ~$1–2/month
Regular use (20–30 messages/day) ~$3–5/month
Heavy use (100+ messages/day) ~$10–20/month

Monitor your usage at console.anthropic.com at any time.


Frequently Asked Questions

Can I use a different AI provider?
Yes — OpenClaw also supports OpenAI (ChatGPT) and local AI models. Contact our support team for help.

Is my data private?
Your conversations are processed by Anthropic's servers. For fully private AI that never leaves your infrastructure, ask us about our Local LLM add-on.

What if I run out of credits?
Your OpenClaw will stop responding until you add more credits at console.anthropic.com. We recommend enabling auto-reload in your Anthropic billing settings.

I lost my API key — what do I do?
Go to console.anthropic.com → API Keys → delete the old key → create a new one → repeat Steps 6 and 7.

Something is not working — who do I contact?
Open a support ticket at cloudacropolis.lt and our team will help you.


Need Help?

???? support@cloudacropolis.lt
???? https://cloudacropolis.lt


CloudAcropolis — European Cloud Infrastructure, Lithuania

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

OpenClaw Basic VM

Getting Started with Your Cloud Acropolis Basic VM     Your Basic VM is a clean Ubuntu 22.04...

OpenClaw VM

Getting Started with Your OpenClaw VM     Your OpenClaw VM is an Ubuntu 22.04 virtual machine...

OpenClaw Pro

Getting Started with Your OpenClaw Pro Server Your OpenClaw Pro server is an AI-powered server...

OpenClaw Pro - How to connect WhatsApp

How to connect WhatsApp WhatsApp is connected by linking your existing WhatsApp number — similar...

OpenClaw Pro - How to connect Slack

How to connect Slack Connecting Slack requires creating a Slack app in your workspace. Step 1 —...