OpenClaw Integration
OpenClaw connects to KOPRouter over the OpenAI-compatible interface. Put the Base URL, API key, and model into the config file and OpenClaw’s agents use KOPRouter models, with authentication and billing handled through KOPRouter.
- Node.js 22 or newer (the OpenClaw runtime)
- A KOPRouter API key (prefixed with
sk-)
Install OpenClaw
Install globally with npm:
npm install -g openclaw@latest
You can also use the official installer: on macOS / Linux run curl -fsSL https://openclaw.ai/install.sh | bash, or on Windows run iwr -useb https://openclaw.ai/install.ps1 | iex in PowerShell.
Then run openclaw --version — seeing a version number means it installed successfully.
Core configuration
Connecting to KOPRouter needs three values:
- Base URL:
https://koprouter.kopglobal.com/v1(KOPRouter’s OpenAI-compatible root) - API Key: your KOPRouter API key (prefixed with
sk-) - Model: a model ID in KOPRouter, taken from the
idreturned by/v1/models
Option 1: Write to openclaw.json (recommended)
OpenClaw reads the user-level config file ~/.openclaw/openclaw.json. Put all three values there at once — no other setup needed.
```bash
mkdir -p ~/.openclaw
nano ~/.openclaw/openclaw.json
```
```bat
if not exist "%USERPROFILE%\.openclaw" mkdir "%USERPROFILE%\.openclaw"
notepad "%USERPROFILE%\.openclaw\openclaw.json"
```
Write the following (replace MODEL_ID with a model ID returned by /v1/models):
{
"models": {
"mode": "merge",
"providers": {
"koprouter": {
"baseUrl": "https://koprouter.kopglobal.com/v1",
"apiKey": "sk-...",
"api": "openai-completions",
"models": [
{ "id": "MODEL_ID" }
]
}
}
},
"agents": {
"defaults": {
"model": { "primary": "koprouter/MODEL_ID" },
"models": { "koprouter/MODEL_ID": {} }
}
},
"gateway": { "mode": "local" }
}
Save it, then restart OpenClaw.
Option 2: Configure with openclaw onboard
If you’d rather not hand-write JSON, run OpenClaw’s built-in setup wizard and follow the prompts (it writes to openclaw.json as well):
openclaw onboard
In the wizard, choose a Custom / OpenAI-compatible provider and enter https://koprouter.kopglobal.com/v1, your API key, and the model ID.
Select and switch models
Set the default model to one available in KOPRouter:
openclaw models set koprouter/MODEL_ID
Check the state of your configured models:
openclaw models status --plain
Model IDs always come from the id returned by /v1/models. If you don’t set one, OpenClaw uses its built-in default model name, which will fail with “model not found” if KOPRouter has no matching model.
Verify
openclaw config validate
If validation passes and openclaw models status --plain lists your model, the setup is correct. You can then start a conversation to test.
Troubleshooting
If your network cannot reach KOPRouter directly (e.g. mainland China), write the proxy into openclaw.json or set it with a command:
openclaw config set proxy.proxyUrl http://127.0.0.1:7890
7890 is only an example port — replace it with your own proxy client’s actual port. OpenClaw does not read the HTTP_PROXY / HTTPS_PROXY environment variables — it only supports proxy.proxyUrl. See Network & Proxy for details.