OpenCode
OpenCode Integration
Select a custom provider for a terminal coding agent.
Install
npm install -g opencode-aiConfigure the provider
Define a provider with an OpenAI-compatible adapter in the OpenCode configuration. Register the model under that provider and choose it in the model picker.
{
"provider": {
"gptproto": {
"npm": "@ai-sdk/openai-compatible",
"name": "GPTProto",
"options": {
"baseURL": "https://gptproto.com/v1",
"apiKey": "{env:GPTPROTO_API_KEY}"
},
"models": {
"YOUR_MODEL_ID": {
"name": "GPTProto chat"
}
}
}
},
"model": "gptproto/YOUR_MODEL_ID"
}Register the API key
export GPTPROTO_API_KEY="YOUR_API_KEY"Run it
opencodeSet the environment variable, reopen OpenCode and select the registered model.
Troubleshooting
The model key inside models must match the part after gptproto/ in the default model setting.