Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
opencode serve does not respect the model setting in opencode.json and attempts to use an invalid model combination, resulting in a ProviderModelNotFoundError.
1076 | const info = provider.models[modelID]
1077 | if (!info) {
1078 | const availableModels = Object.keys(provider.models)
1079 | const matches = fuzzysort.go(modelID, availableModels, { limit: 3, threshold: -10000 })
1080 | const suggestions = matches.map((m) => m.target)
1081 | throw new ModelNotFoundError({ providerID, modelID, suggestions })
^
ProviderModelNotFoundError: ProviderModelNotFoundError
data: {
providerID: "local",
modelID: "claude-sonnet-4.5",
suggestions: [],
},
at getModel (src/provider/provider.ts:1081:13)
Configuration
~/.config/opencode/opencode.json:
{
"model": "local/deepseek-v3.2",
"provider": {
"local": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://my_valid_base_url"
},
"models": {
"deepseek-v3.2": {}
}
}
}
}Expected Behavior
opencode serve should use local/deepseek-v3.2 as specified in the config.
Actual Behavior
Server attempts to use local/claude-sonnet-4.5 (invalid combination) and fails to respond.
Analysis
I used claude to debug opencode source, it tells me (after some long code analysis):
## Root Cause
The defaultModel() function is somehow returning {providerID: "local", modelID: "claude-sonnet-4.5"} instead of the configured {providerID: "local", modelID: "deepseek-v3.2"}
.
This suggests either:
1. cfg.model is not being loaded correctly in server context
2. The if (cfg.model) check is failing unexpectedly
3. The fallback logic is producing an invalid model combination
## Verification
- opencode debug config shows correct config with "model": "local/deepseek-v3.2"
- opencode models shows local/deepseek-v3.2 is available
- Regular opencode CLI works fine, only opencode serve fails
## Workaround
Setting OPENCODE_MODEL=local/deepseek-v3.2 opencode serve should work by bypassing the faulty config logic.
Plugins
none
OpenCode version
1.1.50
Steps to reproduce
- use the following config
{
"model": "local/deepseek-v3.2",
"provider": {
"local": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://my_valid_base_url"
},
"models": {
"deepseek-v3.2": {}
}
}
}
}
opencode run 'Hi'will correctly use this modelopencode servewill correctly use this model for the web sessions, but not for API driven operations such as from https://github.com/ajoslin/opencode-telegram-mirror (it works fine for other providers that has claude-sonnet-4.5)
Screenshot and/or share link
No response
Operating System
macOS 15.4.1
Terminal
ghostty
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
github-actions commentedon Feb 4, 2026
This issue might be a duplicate of existing issues. Please check:
Both issues involve model configuration not being properly respected by the serve command and API. Feel free to ignore if your specific case differs from these.
utensil commentedon Feb 4, 2026
#7099 seems to be reporting a similar issue but it has no fix or workaround, also I'm not using any plugins
utensil commentedon Feb 4, 2026
(I intentionally logged out all other providers to avoid the confusion)
github-actions commentedon Apr 6, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.