Third-party Platform SupportConfigure in OpenCode

Configure in OpenCode

OpenCode is both a CLI + TUI AI programming agent tool that runs in the terminal, and also provides IDE plugin integration. It can complete fast code generation, debugging, project analysis, file operations, and cross-project collaboration in different development environments.

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

OriginRouter supports calling models in OpenCode via the Anthropic Protocol.

Detailed configuration steps:
  1. Run the following command to start the login process:

opencode auth login
  1. In the popup options, search for and select the Other category

  2. Enter a supplier ID (custom name, can only use lowercase letters and numbers), for example originrouter

  3. Enter the API Key you applied for in the Developer Console

Edit configuration file

Open the configuration file ~/.config/opencode/opencode.json and edit according to the following template:

Depending on your subscription plan, copy the matching template below verbatim:

opencode.json

For users on the pay-as-you-go API plan. Requests are served via the /beta endpoint and billed per request.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "originrouter": {
      "npm": "@ai-sdk/anthropic",
      "name": "OriginRouter",
      "options": {
        "baseURL": "https://api.easytransnote.com/beta"
      },
      "models": {
        "claude-sonnet-4-6": {
          "name": "Claude Sonnet 4.6"
        },
        "gpt-5.4": {
          "name": "GPT 5.4"
        },
        "gemini-3.1-pro-preview": {
          "name": "Gemini 3.1 Pro"
        }
      }
    }
  }
}

After configuration is complete, open a new terminal and run the following command to test:

opencode

Was this page helpful?