Tích hợp OpenCode

Cài đặt và cấu hình khuyến nghị

bash
npm install -g opencode-ai
npm install -g @tokencode/tokencode
tokencode

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

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

CLI hợp nhất provider.tokencode vào ~/.config/opencode/opencode.json.

Cấu hình thủ công

json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "tokencode": {
      "npm": "@ai-sdk/anthropic",
      "name": "TokenCode",
      "options": {
        "baseURL": "https://tokencode.dev/v1",
        "apiKey": "sk-your-api-key"
      },
      "models": {
        "claude-sonnet-4-6": { "name": "Claude Sonnet 4.6" },
        "gpt-5.5": { "name": "GPT-5.5" }
      }
    }
  }
}

Khởi động lại OpenCode, nhập /models và chọn mô hình trong mục TokenCode. Nếu provider không xuất hiện, hãy kiểm tra JSON. Lỗi 404 thường có nghĩa là Base URL đang thiếu /v1.