Connect OpenClaw to TokenCode as the model provider for your personal assistant, messaging channels, and MCP tools.
OpenClaw requires Node.js 22 or later.
curl -fsSL https://openclaw.ai/install.sh | bash
# or
npm install -g openclaw@latest
On Windows PowerShell:
iwr -useb https://openclaw.ai/install.ps1 | iex
npm install -g @tokencode/tokencode
tokencode
Select OpenClaw in the wizard, or run:
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.
Merge a tokencode provider into models.providers in ~/.openclaw/openclaw.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.