Repository navigation
Description
Description
Version 1 and version 2 can be installed at the same time. The two versions read the same configuration file. But one file cannot satisfy both versions.
Version 1 stops with an error when the file contains the version 2 keys. The keys are providers and agents. Version 1 shows this message:
Configuration is invalid at <config-dir>/opencode.json
↳ Unrecognized keys: providers, agents
The migration document is at https://opencode.ai/v2/docs/migrate-v1
The document says that version 1 fields and version 2 fields can stay together in one file. The document says: "Supported V1 and native V2 fields may coexist at the top level". The document also says: "when both forms set the same canonical value, a valid native V2 value takes precedence". Thus the user can write the provider with the version 1 fields.
Version 2 does not obey this rule for a custom provider package.
I declare a provider with the version 1 fields. I use the provider key. I use the npm field. Version 1 reads the file correctly. But version 2 shows no models for this provider. Version 2 shows no error message.
I declare the same provider with the version 2 fields. I use the providers key. I use the package field. Version 2 shows all 32 models. But version 1 stops with the error above.
Thus neither format is correct for both versions.
The fault does not occur for all packages. A provider with the @ai-sdk/openai-compatible package loads correctly with the version 1 fields. The fault occurs with the package commandcode-go-opencode-provider.
Environment
- opencode version 2:
0.0.0-next-16974(next channel) - opencode version 1:
1.18.15 - Operating system: macOS 25.5.0
- Architecture: arm64
How to repeat the fault
- Install the package
commandcode-go-opencode-providerfrom npm. - Put configuration A in the global configuration file.
- Run this command with version 2:
opencode models - Count the lines that start with
commandcode/. - Run the same command with version 1.
- Put configuration B in the same file.
- Do step 3 to step 5 again.
Configuration A uses the version 1 fields:
{
"provider": {
"commandcode": {
"npm": "commandcode-go-opencode-provider",
"name": "Command Code",
"env": ["COMMANDCODE_API_KEY"],
"options": { "baseURL": "https://api.commandcode.ai" },
"models": {
"deepseek-v4-flash": {
"id": "deepseek/deepseek-v4-flash",
"name": "DeepSeek V4 Flash",
"tool_call": true
}
}
}
}
}Configuration B uses the version 2 fields:
{
"providers": {
"commandcode": {
"package": "aisdk:commandcode-go-opencode-provider",
"name": "Command Code",
"settings": { "baseURL": "https://api.commandcode.ai" },
"models": {
"deepseek-v4-flash": {
"modelID": "deepseek/deepseek-v4-flash",
"name": "DeepSeek V4 Flash",
"capabilities": { "tools": true }
}
}
}
}
}Result
Configuration A: version 2 shows 0 models for the provider. There is no error message. Version 1 shows all models.
Configuration B: version 2 shows all models. Version 1 stops with the error message.
I did more tests with configuration A. The result stays the same for each test:
- The
packagefield and thenpmfield together in theproviderkey. - Only the
packagefield in theproviderkey. - Model entries with only version 1 fields. I removed
modelID,capabilitiesandcost.cache.
A second file does not correct the problem. Both versions read the file opencode.jsonc. Version 1 also stops with an error for that file.
Expected result
Version 2 must load the provider when the configuration uses the version 1 fields. Then one file can satisfy both versions.
If version 2 cannot load the provider, then version 2 must show an error message.
Activity
[-]Version 2 does not load a provider that uses the version 1 provider and npm fields[/-][+]One configuration file cannot be used by version 1 and version 2[/+]opencode-agent commentedon Aug 17, 2026
This is no longer an issue on the current V2/beta branch. #40919 added V1 configuration normalization: a legacy
providerentry is converted in memory to the V2 provider shape, includingnpm→aisdk:<package>,options→settings, and legacy model fields such asidandtool_call. As a result, configuration A can be shared by V1 and V2 and the custom provider models are loaded by V2.Native V2-only keys such as
providersandagentsare still not accepted by V1; users running both versions should retain the supported V1 form in the shared file.