OpenCode has two ways to write a provider in its configuration file. Newer versions know both. Older ones only know the first and, when they find the second, they stop with Unrecognized key: "providers". The fix takes a minute: write the provider in the format every version accepts.
Why it happens
The current OpenCode documentation shows the new format, with "providers" (plural), "package", "settings" and "env". An OpenCode that does not know this format rejects the whole file. It does not read the provider, so the MozOut models do not show in /models.
The older format, with "provider" (singular), "npm" and "options", still works in the new versions: the OpenCode migration guide says that existing configuration is meant to keep working. That is why our documentation and these articles use it.
The fix
| 1 |
Open the file that gives the error: opencode.json or opencode.jsonc in the project folder, or ~/.config/opencode/opencode.jsonc for all projects.
|
|
| 2 |
Replace its whole content with the block below.
|
|
| 3 |
Save, close OpenCode completely and open it again.
|
|
| 4 |
Type /models and check that the MozOut models show.
|
|
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"api": {
"npm": "@ai-sdk/openai-compatible",
"name": "MozOut",
"options": {
"baseURL": "https://api.mozout.com/v1",
"apiKey": "{env:MOZOUT_API_KEY}"
},
"models": {
"moonshotai/kimi-k2.7-code": { "name": "Kimi K2.7 Code", "limit": { "context": 262144, "output": 16000 } },
"deepseek-ai/deepseek-v4-pro": { "name": "DeepSeek V4 Pro", "limit": { "context": 1048576, "output": 16000 } },
"zai-org/glm-5.2": { "name": "GLM 5.2", "limit": { "context": 1048576, "output": 16000 } },
"deepseek-ai/deepseek-v4-flash": { "name": "DeepSeek V4 Flash", "limit": { "context": 1048576, "output": 16000 } }
}
}
},
"model": "api/moonshotai/kimi-k2.7-code"
}
What changes from one format to the other
| New format (rejected) |
Format that always works |
| "providers" |
"provider" |
| "package" |
"npm": "@ai-sdk/openai-compatible" |
| "settings": { "baseURL": ... } |
"options": { "baseURL": ... } |
| "env": ["MOZOUT_API_KEY"] |
"apiKey": "{env:MOZOUT_API_KEY}", inside "options" |
The models block, with the catalogue id and its slash, and the model line stay the same.
env takes the variable name, never the key
In the new format, "env" takes the name of the variable, such as MOZOUT_API_KEY. In "apiKey", {env:MOZOUT_API_KEY} also takes the name. If you paste the key itself there, OpenCode looks for a variable with that name, does not find it and the request goes without a key: the API answers 401.