OpenCode provider entry
Configure one explicit provider and reference its model identifier consistently.
Create an OpenAI-compatible provider in your user configuration. The provider's local name is an application identifier; it does not change the upstream model value.
Configuration location is ~/.config/opencode/opencode.jsonc on Linux/macOS and %USERPROFILE%\.config\opencode\opencode.jsonc on Windows.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"company_api": {
"name": "B2B workspace",
"npm": "@ai-sdk/openai-compatible",
"options": {"baseURL":"https://api.b2b-llm.com/v1","apiKey":"{env:B2B_API_KEY}"},
"models": {"team-model":{"name":"Team approved model"}}
}
},
"model": "company_api/team-model"
}
Replace team-model with a real enabled canonical ID or alias. Set B2B_API_KEY before launching OpenCode; the reference does not create the environment variable. Use the Responses-oriented provider package only when your workflow and selected model require it.
After editing, restart the client and verify a short request. A missing provider usually means the selection prefix and provider key disagree. An authentication failure requires checking the secret/environment; a payload error requires checking the selected API family. Provider schemas can change, so compare the example with the installed client's official configuration reference.