Skip to content

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

Closed as not planned

Description

@Abe-li

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

Activity

  1. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions