Clients
opencode
Use goodapi in opencode — write the provider config for your opencode version, connect both OpenAI-compatible and Claude models, and fix common problems.
Updated
opencode can use models from several groups at once: an OpenAI-compatible provider for models such as DeepSeek, Qwen and GPT, and an Anthropic provider for Claude models. Each provider uses a key from the matching group.
opencode V1 and V2 use different config formats, so check your version first with opencode --version.
V2 config
Edit ~/.config/opencode/opencode.jsonc:
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"goodapi": {
"name": "goodapi",
"env": ["GOODAPI_API_KEY"],
"package": "@opencode/ai/providers/openai-compatible",
"settings": { "baseURL": "https://api.goodapi.tech/v1" },
"models": {
"deepseek-v4-flash": { "name": "DeepSeek V4 Flash" }
}
},
"goodapi-claude": {
"name": "goodapi Claude",
"env": ["GOODAPI_CLAUDE_KEY"],
"package": "@opencode/ai/providers/anthropic",
"settings": { "baseURL": "https://api.goodapi.tech/v1" },
"models": {
"claude-sonnet-5-5": { "name": "Claude Sonnet 5.5" }
}
}
}
}V1 config
Edit ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"goodapi": {
"npm": "@ai-sdk/openai-compatible",
"name": "goodapi",
"options": {
"baseURL": "https://api.goodapi.tech/v1",
"apiKey": "{env:GOODAPI_API_KEY}"
},
"models": {
"deepseek-v4-flash": { "name": "DeepSeek V4 Flash" }
}
},
"goodapi-claude": {
"npm": "@ai-sdk/anthropic",
"name": "goodapi Claude",
"options": {
"baseURL": "https://api.goodapi.tech/v1",
"apiKey": "{env:GOODAPI_CLAUDE_KEY}"
},
"models": {
"claude-sonnet-5-5": { "name": "Claude Sonnet 5.5" }
}
}
}
}Set keys and start
export GOODAPI_API_KEY="sk-..." # key from the DeepSeek group
export GOODAPI_CLAUDE_KEY="sk-..." # key from the Claude Max group
opencodePick a model inside opencode with /models. A model's full name is provider/model, for example goodapi/deepseek-v4-flash.
- In both config formats, the Anthropic provider's
baseURLmust include/v1(usehttps://api.goodapi.tech/v1). This is different from Claude Code. - The keys under
modelsare model names. They must match the names in Models and pricing and be in the group of the provider's key. Add more entries tomodelsfor more models. - If you only use one group, delete the provider you don't need.
Checking it works
opencode run -m goodapi/deepseek-v4-flash "Reply with exactly: ok"If it replies ok and the request shows up on the Usage Logs page of the console, opencode is going through goodapi.
Troubleshooting
HTTP 405 or 404 from Claude models: the Anthropic provider's baseURL is missing /v1.
401: check that the matching environment variable has been exported and the key is valid; see Error codes.
403 This token has no access to model: the model isn't in the key's group. For example, a DeepSeek group key can't call Claude models; put them under the provider that uses a Claude Max group key.