Tích hợp OpenClaw

OpenClaw yêu cầu Node.js 22 trở lên.

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

Chọn OpenClaw trong trình hướng dẫn hoặc chạy:

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

CLI giữ nguyên các channel, gateway, provider khác và thiết lập cấp cao nhất khi hợp nhất provider TokenCode.

Cấu hình thủ công

Thêm provider vào models.providers trong ~/.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 }
        }]
      }
    }
  }
}

Chạy openclaw gateway restart, sau đó mở openclaw tui và nhập /model. Với anthropic-messages, dùng https://tokencode.dev và không thêm /v1.