anomalyco / anomalyco/opencode
opencode models --refresh overwrites custom providers in /models picker
@nexxeln is already working on this.
Since Aug 5, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Bug Description
After running opencode models --refresh, custom providers declared in opencode.json disappear from the /models TUI picker catalog. The models still appear in the Recent section (because they were used before), but they are no longer listed under their provider section.
This suggests that opencode models --refresh replaces the local model catalog (~/.cache/opencode/models.json) with the public models.dev snapshot, which does not include custom providers, and does not re-merge the custom provider definitions from config.
Steps to Reproduce
- Configure a custom provider in
~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"scnet": {
"npm": "@ai-sdk/openai-compatible",
"name": "SCNet",
"options": {
"baseURL": "https://api.scnet.cn/api/llm/v1",
"apiKey": "<redacted>"
},
"models": {
"Kimi-K2.7-Code": { "name": "Kimi-K2.7-Code" },
"MiniMax-M2.5": { "name": "MiniMax-M2.5" }
}
}
},
"model": "scnet/Kimi-K2.7-Code"
}
- Open the OpenCode TUI and use
scnet/Kimi-K2.7-Codeonce. - Quit OpenCode.
- Run
opencode models --refresh. - Reopen the OpenCode TUI and run
/models.
Expected Behavior
scnet/Kimi-K2.7-Code and scnet/MiniMax-M2.5 should still appear in the /models picker under the scnet provider, alongside the refreshed public catalog.
Actual Behavior
- The
scnetprovider is not visible in the/modelscatalog. - The models do appear in the Recent section.
~/.cache/opencode/models.jsonno longer contains thescnetprovider.
Evidence
~/.local/state/opencode/model.json still contains the recent entries:
{
"recent": [
{"providerID": "scnet", "modelID": "Kimi-K2.7-Code"},
...
]
}
~/.cache/opencode/models.json contains only public providers (e.g. deepseek, openai, etc.) and no scnet key.
Environment
- OpenCode version: 1.18.10
- OS: macOS
- Install method: Homebrew
Workaround
Avoid running opencode models --refresh, or manually select the model from the Recent section.
Related Issues
- #6169
/model TUI picker does not display all custom provider models - #7714
The cache of the Provider's Models cannot be updatable - #25630
Regression: plugin provider.models() hook no longer populates custom providers
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.