OpenCode setup
OpenCode connects to Claudexia through two providers: Claude goes through one, all other models through the other. They share one key.
Setup
- Install it:
npm install -g opencode-ai. Check withopencode --version. - Open
~/.config/opencode/opencode.json(on Windows%USERPROFILE%\.config\opencode\opencode.json) and paste the configuration:
{
"$schema": "https://opencode.ai/config.json",
"model": "claudexia-claude/claude-sonnet-5",
"provider": {
"claudexia-claude": {
"npm": "@ai-sdk/anthropic",
"name": "Claudexia · Claude",
"options": { "baseURL": "https://api.claudexia.tech/v1", "apiKey": "sk_cdx_YOUR_KEY" },
"models": {
"claude-opus-5-5": { "name": "Claude Opus 5.5", "limit": { "context": 1000000, "output": 128000 } },
"claude-sonnet-5": { "name": "Claude Sonnet 5", "limit": { "context": 1000000, "output": 32000 } }
}
},
"claudexia": {
"npm": "@ai-sdk/openai-compatible",
"name": "Claudexia · GPT, Gemini and others",
"options": { "baseURL": "https://api.claudexia.tech/v1", "apiKey": "sk_cdx_YOUR_KEY" },
"models": {
"gpt-6-astra": { "name": "GPT-6 Astra", "limit": { "context": 1000000, "output": 128000 } },
"gemini-3.1-pro": { "name": "Gemini 3.1 Pro", "limit": { "context": 1000000, "output": 65000 } },
"deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash", "limit": { "context": 1000000, "output": 131072 } }
}
}
}
}- Run
opencodeand pick a model, for exampleclaudexia/gpt-6-astra.
Do not remove the limit block: without it OpenCode does not know the context size and does not compact history. Add any model from the catalog.
OpenCode 2: the configuration above and the install command in step 1 are for OpenCode 1 (npm install -g opencode-ai). OpenCode 2 has its own schema: providers replaces provider, and the address and key live in settings.baseURL and settings.apiKey. According to the OpenCode docs the V1 format stays supported in OpenCode 2 and is read from the same files, so this configuration should work there too. Install OpenCode 2 with curl -fsSL https://opencode.ai/v2/install | bash or npm install -g @opencode/cli; the migration guide is at opencode.ai/v2/docs/migrate-v1.
Tips
- You can name the file
opencode.jsonc: comments are allowed in that format. - In OpenCode a model is written as provider/name. Claude lives in the
claudexia-claudeprovider, all other models inclaudexia.