OpenCode
OpenCode + GPT Proto
OpenCode is an open-source AI coding agent with a provider abstraction layer. One relay becomes multiple providers — each carrying the models you want — configured in ~/.config/opencode/opencode.json.
Install OpenCode
macOS / Linux — pick one:
bash
brew install opencode
# or
npm i -g opencode-ai
# or
curl -fsSL https://opencode.ai/install | bash
opencode --version # verifyConfigure providers in opencode.json
Map one relay to as many providers as you like — here's GPT Proto as both a general provider and a Grok provider:
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"gptproto": {
"name": "GPT Proto",
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://gptproto.com/v1",
"apiKey": "<YOUR_API_KEY>"
},
"models": {
"gpt-5.5": { "name": "GPT-5.5" },
"claude-sonnet-4-6": { "name": "Claude Sonnet 4.6" }
}
},
"grok": {
"name": "Grok via GPTProto",
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://gptproto.com/v1",
"apiKey": "<YOUR_API_KEY>"
},
"models": {
"grok-4.5": { "name": "Grok 4.5" },
"grok-4.6": { "name": "Grok 4.6" }
}
}
}
}- npm:
@ai-sdk/openai-compatibleworks with virtually any relay (OpenAI chat protocol). - Model ids must match exactly what
/v1/modelsreturns. - Env-var keys:
{"env:ANTHROPIC_API_KEY"}is also supported.
Use it
bash
opencode # start, then /models to pick a model
opencode -m grok/grok-4.5 # or specify directly