Integrate OpenClaw

Connect OpenClaw to TokenCode as the model provider for your personal assistant, messaging channels, and MCP tools.

Install OpenClaw

OpenClaw requires Node.js 22 or later.

bash
curl -fsSL https://openclaw.ai/install.sh | bash
# or
npm install -g openclaw@latest

On Windows PowerShell:

powershell
iwr -useb https://openclaw.ai/install.ps1 | iex
bash
npm install -g @tokencode/tokencode
tokencode

Select OpenClaw in the wizard, or run:

bash
npx @tokencode/tokencode oc -k sk-your-api-key -m claude-sonnet-4-6

The CLI preserves existing channels, gateway settings, providers, and other top-level settings while merging the TokenCode provider.

Manual configuration

Merge a tokencode provider into models.providers in ~/.openclaw/openclaw.json:

json
{
  "models": {
    "mode": "merge",
    "providers": {
      "tokencode": {
        "baseUrl": "https://tokencode.dev",
        "apiKey": "sk-your-api-key",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "claude-sonnet-4-6",
            "name": "claude-sonnet-4-6",
            "reasoning": false,
            "input": ["text", "image"],
            "contextWindow": 200000,
            "maxTokens": 8192,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
          }
        ]
      }
    }
  }
}

Do not replace the whole file when you already have channel or MCP settings. Restart the gateway with openclaw gateway restart, open openclaw tui, then use /model to select a TokenCode model.

When api is anthropic-messages, use https://tokencode.dev without /v1. For cached provider or key errors, remove the obsolete provider entry from ~/.openclaw/agents/main/agent/models.json and restart.