AI coding agent cho terminal

OpenCode

> Cấu hình OpenCode qua @ai-sdk/openai-compatible để gọi các public alias của ProxyLLM.

[INFO]Provider

Dùng một provider OpenAI-compatible duy nhất. Các alias Claude Opus là nhãn thương mại và vẫn route qua upstream GPT đã cấu hình.

//Điều kiện tiên quyết

  • OpenCode đã cài đặt: npm install -g opencode-ai
  • API key ProxyLLM (lấy tại đây)

//Mở file config OpenCode

shellbash
# Project-level config
touch opencode.json

# Or global
code ~/.config/opencode/opencode.json

//Cấu hình provider

opencode.jsonjson
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "proxyllm": {
      "name": "ProxyLLM",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "your-proxyllm-api-key",
        "baseURL": "https://proxyllm.eu/v1"
      }
    }
  }
}

//Khai báo mô hình

opencode.jsonjson
{
  "provider": {
    "proxyllm": {
      "name": "ProxyLLM",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "your-proxyllm-api-key",
        "baseURL": "https://proxyllm.eu/v1"
      },
      "models": {
        "claude-opus-4.7": {
          "name": "Claude Opus 4.7",
          "limit": { "context": 200000, "output": 64000 },
          "tool_call": true
        },
        "claude-opus-4.6": {
          "name": "Claude Opus 4.6",
          "limit": { "context": 200000, "output": 64000 },
          "tool_call": true
        },
        "gpt-5.5": {
          "name": "GPT-5.5",
          "limit": { "context": 200000, "output": 64000 },
          "tool_call": true
        },
        "gpt-5.4": {
          "name": "GPT-5.4",
          "limit": { "context": 200000, "output": 64000 },
          "tool_call": true
        }
      }
    }
  },
  "defaultModel": "claude-opus-4.7"
}