opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Inconsistent model blacklisting behaviour in opencode.json?

Open ariane-emory opened this issue 1 month ago • 3 comments

Description

My opencode.json file includes this content to meant to avoid displaying models I'm uninterested in using:

"zai-coding-plan": {
  "blacklist": [
    "glm-4.5",
    "glm-4.5-air",
    "glm-4.5-flash",
    "glm-4.5v",
  ]
},
"github-copilot": {
  "blacklist": [
    "claude-3.5-sonnet",
    "claude-3.7-sonnet",
    "claude-3.7-sonnet-thought",
    "claude-opus-4",
    "claude-opus-41",
    "claude-sonnet-4",
    "gemini-2.0-flash-001",
    "gemini-2.5-pro",
    "gpt-5",
    "gpt-5-codex",
    "gpt-5.1",
    "gpt-5.1-codex",
    "grok-code-fast-1",
  ]
},
// ... 

The blacklisting appears to be working inconsistently: the blacklisted zai-coding-plan models do not appear, as expected, but the blacklisted github-copilot models are inconsistent: the claude-opus41, claude-3.5-sonnet and claude-3.7-sonnet models (amongst others) are hidden as expected, but the gpt-5 and grok-code-fast-1 models (amongst others) appear despite being blacklisted.

What's going on here? Am I doing something wrong, or is this a bug?

OpenCode version

1.0.162

Steps to reproduce

  1. Blacklist models as described above and then observe the inconsistent behaviour in the /models list.

Screenshot and/or share link

Image

Operating System

No response

Terminal

No response

ariane-emory avatar Dec 16 '25 12:12 ariane-emory

This issue might be a duplicate of existing issues. Please check:

  • #4476: /models shows all available models rather than those restricted in opencode.json. (This appears to be the same core issue with the /models list not respecting configuration)
  • #5623: Custom subagents with explicit model config throw ProviderModelNotFoundError (Related to model configuration not being properly applied)

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Dec 16 '25 12:12 github-actions[bot]

are any of those models in ur recents or favorites list?

rekram1-node avatar Dec 16 '25 12:12 rekram1-node

@rekram1-node No, they should not be as I have not used any of these models since at least the last time I last nuked my .cache/.local/state directories (if ever, some of these are models I have never used) and they do not appear in the recent/favourites subgroups in /models.

ariane-emory avatar Dec 16 '25 12:12 ariane-emory

Another example, it seems like quite a few of the models on github-copilot-enterprise cannot be blacklisted:

These are also not in my recents/favourites, I have never had access to Github Copilot Enterprise as I have only ever had a personal Copilot account.

Image

OCRed text from the screenshot above for the benefit of agensts reading this Github Issue:

First window displaying the /model selection modal in opencode

Select model      search
GitHub Copilot Enterprise
Claude Opus 4.5
Claude Opus 4.1
GPT-4.1
GPT-40
GPT-5-Codex
GPT-5-mini
Claude Haiku 4.5
GPT-5.1-Codex
GPT-5.1-Codex-max
GPT-5. 1-Codex-mini
GPT-5.2
Gemini 3 Pro Preview
Grok Code Fast 1
Raptor Mini (Preview)
GPT-5.1
Claude Sonnet 4.5
Gemini 2.5 Pro
GPT-5
Claude Sonnet 4

Second window displaying part of an opencode.json file:

"github-copilot-enterprise": {
    "blacklist": [
    "claude-3.5-sonnet"
    "claude-3.7-sonnet"
    "claude-3.7-sonnet-thought",
    "claude-haiku-4.5"
    "claude-opus-4"
    "claude-opus-4.5"
    "claude-opus-41"
    "claude-sonnet-4i"
    "c-laude-sonnet-4.5",
    "gemini-2.0-flash-001",
    "gemini-2.5-pro",
    "gemini-3-pro-preview",
    "gpt-4.1"
    "gpt-40"
    "gpt-",
    "gpt-5-codex"
    "gpt-5-mini"
    "gpt-5. 1"
    "gpt-5.1-codex"
    "gpt-5.1-codex-max"
    "gpt-5.1-codex-mini"
    "gpt-5.2"
    "grok-code-fast-1",
    "o3"
    "o3-mini"
    "O4-mini"',
    "oswe-vscode-prime",
  ]
},

ariane-emory avatar Dec 16 '25 17:12 ariane-emory

The issue seems to have been due to some mysterious nonsense in either my .cache/opencode or .local/state/opencode files: still not sure exactly what happened, but it seems to be resolved after clearing those folders.

Closing for now (and hopefully forever unless the problem reoccurs in the future).

ariane-emory avatar Dec 16 '25 20:12 ariane-emory