OpenClaw

Install OpenClaw, register OneRouter as an OpenAI-compatible model provider, start the local gateway, and run a smoke test.

OpenClaw can execute real actions

Start with a local test workspace and the minimum required permissions. Do not connect messaging channels, browsers, or shell automation until the model provider and approval policy are verified.

Install and initialize

Install the latest OpenClaw release, verify the version, then create the local baseline configuration before adding OneRouter.

npm install -g openclaw@latest
openclaw --version

Configure OneRouter

Edit ~/.openclaw/openclaw.json. Keep api set to openai-completions, use the OneRouter /v1 base URL, and declare only models you have verified. The selected model is addressed as onerouter/<MODEL_SLUG> inside OpenClaw.

The capability, context-window, and output-token values are model-specific. Replace the example values with the current model metadata, and protect this file because it contains the API key.

{
  "models": {
    "mode": "merge",
    "providers": {
      "onerouter": {
        "baseUrl": "https://onerouter.com/v1",
        "apiKey": "YOUR_ONEROUTER_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "<MODEL_SLUG>",
            "name": "OneRouter model",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 128000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "onerouter/<MODEL_SLUG>"
      }
    }
  }
}

Start the gateway

Install the local gateway service, start it, and require a successful connectivity probe before testing any agent action.

openclaw gateway install
openclaw gateway start
openclaw gateway status

Run a provider smoke test

Test the exact provider/model pair through the gateway. This isolates provider configuration from chat channels and other integrations.

openclaw infer model run --gateway --model onerouter/<MODEL_SLUG> \
  --prompt "Reply with OK only"

Switch and add models

Add each model to the provider's models array, restart the gateway, then switch with /model onerouter/<MODEL_SLUG>. Keep the model list small until every entry passes the smoke test.

openclaw gateway restart

Troubleshooting

SymptomHow to fix it
Gateway is unreachableRun openclaw gateway status, fix the local service first, and do not change provider fields until connectivity is healthy.
401Re-enter the complete OneRouter key and restrict access to the configuration file.
404Use /v1 as baseUrl and openai-completions as the provider API mode.
Provider exists but model is missingAdd the exact slug to the provider model list and restart the gateway.
Tool behavior is unsafe or unexpectedStop the gateway, reduce permissions and connected channels, then retest with an approval-required policy.