Other Clients & Protocols

OpenCode

An open-source terminal agent; declare a custom provider in opencode.json.

1Install

Terminal
npm install -g opencode-ai
opencode --version

2Declare a custom provider

OpenCode declares providers in a JSON file. The global configuration is at ~/.config/opencode/opencode.json, or place opencode.json in your project root for project-specific settings. Replace YOUR_API_KEY with your API key, or choose a key at the top of the page to fill it in automatically.

YOUR_API_KEY in the examples is a placeholder and will not work as copied. Sign in to pick one of your keys and fill it into every example on this page.

Sign in to fill in key
opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "keyvia": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "KeyVia",
      "options": {
        "baseURL": "https://api.keyvia.cc/v1",
        "apiKey": "YOUR_API_KEY"
      },
      "models": {
        "gpt-5": {
          "name": "gpt-5"
        }
      }
    }
  }
}

For OpenAI, use @ai-sdk/openai-compatible with /v1 in baseURL. For Anthropic, use @ai-sdk/anthropic, also with /v1 in baseURL, because this SDK only appends /messages.

models lists the models you want to use. Copy names from the Model catalog. Both providers can be configured together.

3Verify

Open your project directory and run opencode and enter a model from the /models to select your configured model, then send a message to verify the connection.

For errors, see Error codes.

KeyVia Logo
KeyVia

One API for full-power Claude, GPT, Gemini and other leading AI models at ultra-low prices.

© 2026 KeyVia. All rights reserved.