anomalyco / anomalyco/opencode

opencode models --refresh overwrites custom providers in /models picker

Open
#40,626 0 comments 0 reactions 1 assignee View on GitHub

@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
  1. 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"
}
  1. Open the OpenCode TUI and use scnet/Kimi-K2.7-Code once.
  2. Quit OpenCode.
  3. Run opencode models --refresh.
  4. 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 scnet provider is not visible in the /models catalog.
  • The models do appear in the Recent section.
  • ~/.cache/opencode/models.json no longer contains the scnet provider.
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.