Skip to content
Home

OpenCode

OpenCode can use a custom OpenAI-compatible provider. Configure a provider entry for OdiRouter, add an API key, and select the model in OpenCode.

RequirementValue
OpenCodeInstalled locally
Provider package@ai-sdk/openai-compatible
Base URLhttps://www.odirouter.ai/v1
API KeyOdiRouter API key
ModelAn OdiRouter LLM model ID

If OpenCode is not installed yet, install it with npm:

Окно терминала
npm install -g opencode-ai

You can also install the CLI package name:

Окно терминала
npm install -g @opencode-ai/cli

If you installed OpenCode through the official installer, Homebrew, or another method, just confirm the command is available:

Окно терминала
opencode --version

Start OpenCode from your project directory:

Окно терминала
opencode

Inside OpenCode, run:

/connect

When adding the credential, use:

FieldValue
Provider IDodirouter
API KeyYOUR_API_KEY

The provider ID must match provider.odirouter in opencode.json.

Create or edit opencode.json in your project:

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"odirouter": {
"npm": "@ai-sdk/openai-compatible",
"name": "OdiRouter",
"options": {
"baseURL": "https://www.odirouter.ai/v1"
},
"models": {
"gpt-5.5": {
"name": "GPT 5.5"
}
}
}
},
"model": "odirouter/gpt-5.5"
}
Окно терминала
cd /path/to/your/project
opencode

Inside OpenCode, run:

/models

Select the OdiRouter model if it is not already active.

Explain this project structure. Do not edit files.
SymptomFix
Provider does not appearRestart OpenCode after editing opencode.json
Authentication failsRe-run /connect and use the same provider ID as the config
Model not foundCopy a model ID from GET https://www.odirouter.ai/v1/models
Config is ignoredStart OpenCode from the directory that contains opencode.json, or set OPENCODE_CONFIG to the config path