OpenClaw + Lumecoder Quick Setup
Claude Models in 3 Steps
No plugins needed. Connect OpenClaw to Lumecoder's Claude API using the native Anthropic Messages API protocol. For users who already have OpenClaw installed.
Prerequisites
- OpenClaw installed (see OpenClaw + Lumecoder Integration Guide)
- Lumecoder account with API Key (starts with sk-)
How It Works
OpenClaw natively supports the Anthropic Messages API protocol. We simply register a custom Provider in openclaw.json pointing to the Lumecoder API endpoint. No plugins required.
Configuration Steps
Edit openclaw.json to add Lumecoder Provider
Open the config file:
vim ~/.openclaw/openclaw.json
Add a top-level models node (same level as agents, channels, etc.):
"models": {
"providers": {
"lumecoder": {
"baseUrl": "https://api.lumecoder.com",
"apiKey": "sk-xxx",
"api": "anthropic-messages",
"models": [
{
"id": "claude-sonnet-4-6",
"name": "Claude Sonnet 4.6",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 8192
},
{
"id": "claude-opus-4-6",
"name": "Claude Opus 4.6",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 8192
},
{
"id": "claude-haiku-4-5-20251001",
"name": "Claude Haiku 4.5",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
}Also update the model config in agents.defaults:
"model": {
"primary": "lumecoder/claude-sonnet-4-6",
"fallbacks": [
"lumecoder/claude-haiku-4-5-20251001"
]
},
"models": {
"lumecoder/claude-sonnet-4-6": {},
"lumecoder/claude-opus-4-6": {},
"lumecoder/claude-haiku-4-5-20251001": {}
}Set API Key environment variable
# 将上一步配置中的 "apiKey": "sk-xxx" 替换为你的真实密钥 # 例如: "apiKey": "sk-d3ebfdxxxxxxxxxxxxxx"
Get your API Key from the Lumecoder dashboard under "API Keys". It starts with sk-. Write it directly in the apiKey field of openclaw.json.
Verification
Run a test command:
openclaw agent --local --session-id test -m "你好"
If you receive a normal response, it means:
- OpenClaw is connected to Lumecoder via Anthropic Messages API
- Claude model calls are successful
- Credits billing is working
Available Models
The following models can be configured in openclaw.json:
| Model ID | Description | Recommended Use |
|---|---|---|
| claude-sonnet-4-6 | Claude Sonnet 4.6 | Code generation, daily chat (recommended) |
| claude-opus-4-6 | Claude Opus 4.6 | Complex reasoning, long-form writing |
| claude-haiku-4-5-20251001 | Claude Haiku 4.5 | Lightweight, fast, low cost |
Switch default model:
openclaw models set lumecoder/claude-opus-4-6
Full Configuration Reference
Complete Lumecoder Claude configuration snippet for openclaw.json:
{
"agents": {
"defaults": {
"model": {
"primary": "lumecoder/claude-sonnet-4-6",
"fallbacks": ["lumecoder/claude-haiku-4-5-20251001"]
},
"models": {
"lumecoder/claude-sonnet-4-6": {},
"lumecoder/claude-opus-4-6": {},
"lumecoder/claude-haiku-4-5-20251001": {}
},
"workspace": "/home/ubuntu/.openclaw/workspace",
"compaction": { "mode": "safeguard" },
"maxConcurrent": 4,
"subagents": { "maxConcurrent": 8 }
}
},
"models": {
"providers": {
"lumecoder": {
"baseUrl": "https://api.lumecoder.com",
"apiKey": "sk-xxx",
"api": "anthropic-messages",
"models": [
{
"id": "claude-sonnet-4-6",
"name": "Claude Sonnet 4.6",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 8192
},
{
"id": "claude-opus-4-6",
"name": "Claude Opus 4.6",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 8192
},
{
"id": "claude-haiku-4-5-20251001",
"name": "Claude Haiku 4.5",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
}
}Troubleshooting
Invalid key format
Lumecoder API Key must start with sk-. Check the providers.lumecoder.apiKey value in openclaw.json.
Config changes not taking effect
You must restart after modifying openclaw.json:
openclaw gateway restart
Done
Setup complete. OpenClaw now calls Claude models through Lumecoder, with support for streaming, tool calling, and Prompt Cache.
