If OpenCode Desktop shows Custom providers are unavailable on this server (provider.custom.unavailable) when you submit its custom-provider form, the failure happens while saving the provider. It is separate from a bad API key, model ID or request URL.
Check the version before changing the endpoint
Public reports for OpenCode Desktop releases 2.0.14, 2.0.16, 2.0.25, 2.0.29 and 2.0.32 describe the same save error, including reports against the app's bundled local server. OpenCode tagged 2.1.2 on October 21, 2026; its official changelog does not mention this form, and I found no verified report of the Desktop form on 2.1.x. As checked on October 22, PR #57997 proposes a V2 save flow but remains open and targets dev, so it does not establish that a released Desktop build contains the fix. Check the installed version and issue #50650 for status. If the exact toast appears, repeatedly editing a valid base URL or credential will not repair the form.
Define the provider in OpenCode’s config
- Open your global OpenCode config. The documented path is
~/.config/opencode/opencode.json; the Windows troubleshooting guide uses%USERPROFILE%\.config\opencode\opencode.jsonc. - Merge this provider into the existing top-level
providersobject. Keep the config you already use; do not replace the whole file. - Replace the example base URL, environment-variable name and model ID with the values from your provider. The model key below is the exact upstream ID used by this config.
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"myprovider": {
"name": "My Provider",
"env": ["MY_PROVIDER_API_KEY"],
"package": "@opencode/ai/providers/openai-compatible",
"settings": {
"baseURL": "https://api.example.com/v1"
},
"models": {
"MODEL_ID_FROM_PROVIDER": {
"name": "My model"
}
}
}
}
}Set MY_PROVIDER_API_KEY in the environment available to OpenCode Desktop, then reopen the model picker. The key is referenced by name and stays out of the JSON file. If the provider does not appear, recheck the config path, JSON syntax and server environment before restarting the app. Do not commit a real key in a project-level config.
In the model picker, choose myprovider/MODEL_ID_FROM_PROVIDER. Seeing the entry confirms that OpenCode loaded the config; it does not validate the credential or prove a request will succeed.
If it still fails
- If the same save toast remains, confirm the file path and JSON syntax, then compare the installed version with the open issue.
- If the provider appears but a request returns
401, check that the desktop process received the environment variable. - If a request returns
404, verify the provider's base URL and API format; setup details are in the OpenCode-compatible provider guide.
OpenCode V2 provider config
OpenCode config locations and environment variables
OpenCode troubleshooting: global config paths
The workaround is based on OpenCode's documented V2 config format and public Desktop reports. No provider key or model request was used to verify it here.