OpenCode

Nội dung tài liệu kỹ thuật hiện được cung cấp bằng tiếng Anh.

OpenCode is an open-source AI coding agent with a terminal UI and desktop app. Uptech API is not a built-in OpenCode provider — register it with @ai-sdk/openai-compatible.

Install

curl -fsSL https://opencode.ai/install | bash

Other options:

npm install -g opencode-ai
brew install anomalyco/tap/opencode

See the OpenCode install docs for Bun, pnpm, Yarn, Arch, and Windows.

Configure Uptech API

Create or edit opencode.json in your project (or the global OpenCode config location):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apigo": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Uptech API",
      "options": {
        "baseURL": "https://api.uptech.vn/v1"
      },
      "models": {
        "gpt-5.6-sol": {
          "name": "GPT-5.6 Sol"
        },
        "qwen3.8-max": {
          "name": "Qwen 3.8 Max"
        },
        "deepseek-v4-flash": {
          "name": "DeepSeek V4 Flash"
        }
      }
    }
  }
}

Replace model keys with slugs from the Model Catalog.

Add your API key

Option A: /connect in the TUI

cd /path/to/your/project
opencode

Run /connect, select the Uptech API provider you defined, and paste sk-apigo-....

Option B: auth file

Write ~/.local/share/opencode/auth.json (path may vary by OS / install):

{
  "apigo": {
    "type": "api",
    "key": "sk-apigo-..."
  }
}

Select a model

Inside OpenCode:

/models

Pick an Uptech API model, then start coding. Confirm traffic in Nhật ký gọi API.

Optional: Anthropic base URL override

If you prefer Claude-native traffic for Anthropic models, you can also override the built-in Anthropic provider base URL:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "anthropic": {
      "options": {
        "baseURL": "https://api.uptech.vn"
      }
    }
  }
}

Authenticate with your Uptech API key for that provider. Prefer the custom apigo provider above when you want mixed vendors under one key.

Troubleshooting

Symptom Fix
Auth errors Re-run /connect or verify auth.json
Model not listed Add the exact slug under provider.apigo.models
Requests miss Uptech API Xác nhận options.baseURL is https://api.uptech.vn/v1

Resources