How to connect Claude to OpenClaw
Configure OpenClaw to use Claude models through Claude API Tech. The API key is stored as an environment value, while the provider and models live in one configuration file.
What is OpenClaw
OpenClaw is an open-source personal AI assistant and self-hosted gateway. It connects AI agents to Telegram, WhatsApp, Slack, Discord, and other channels from your own computer or server.
Before you start
1. Install OpenClaw
Download OpenClaw from the official website or run the official installer on macOS and Linux:
curl -fsSL https://openclaw.ai/install.sh | bash
2. Open the configuration
The main config is stored at ~/.openclaw/openclaw.json. Create the directory and file if they do not exist:
mkdir -p ~/.openclaw && $EDITOR ~/.openclaw/openclaw.json
3. Add Claude API Tech
Paste the configuration and replace sk-cs2-YOUR_API_KEY with a key from your dashboard. Claude Sonnet 5 is the primary model; Fable 5 and Opus 4.8 remain available for selection.
{
"env": {
"LLM_GATE_API_KEY": "sk-cs2-YOUR_API_KEY"
},
"agents": {
"defaults": {
"model": {
"primary": "llmgate/claude-sonnet-5"
},
"models": {
"llmgate/claude-fable-5": {},
"llmgate/claude-sonnet-5": {},
"llmgate/claude-opus-4-8": {}
}
}
},
"models": {
"mode": "merge",
"providers": {
"llmgate": {
"baseUrl": "https://api.llm-gate.tech",
"apiKey": "${LLM_GATE_API_KEY}",
"api": "anthropic-messages",
"models": [
{
"id": "claude-fable-5",
"name": "Claude Fable 5",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 1000000,
"maxTokens": 64000
},
{
"id": "claude-sonnet-5",
"name": "Claude Sonnet 5",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 1000000,
"maxTokens": 64000
},
{
"id": "claude-opus-4-8",
"name": "Claude Opus 4.8",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 200000,
"maxTokens": 64000
}
]
}
}
}
}API key security
What this configuration adds
- Anthropic Messages API through https://api.llm-gate.tech
- Claude Sonnet 5 as the primary model
- Text and image input
- Fable 5, Sonnet 5, and Opus 4.8 in the model list
4. Check the gateway
Save the config and confirm that the OpenClaw gateway is running and responding:
openclaw gateway status
5. Check the model list
The output should include llmgate/claude-fable-5, llmgate/claude-sonnet-5, and llmgate/claude-opus-4-8:
openclaw models list
6. You are ready
OpenClaw is configured. New sessions use Claude Sonnet 5 by default, and you can select another configured model in OpenClaw when needed.
If a model does not appear
openclaw gateway statusYou need Node.js, terminal access, and a Claude API Tech API key. Create a key in your dashboard if you do not have one yet.
Get an API key →