Skip to content

Conversation

@KelvinJRosado
Copy link

@KelvinJRosado KelvinJRosado commented Jan 22, 2026

What does this PR do?

Closes #9203

This adds both a disabled_models and a enabled_models option to help give better control over which models are shown. Supports both full IDs as well as glob patterns. These options mirror how the enabled_providers and disabled_providers options set precedence.

This is useful in situations like Enterprises where only certain models are allowed for use, even though a provider may expose more. For example, this can allow for disabling preview models. Or to only allow OpenAI codex models for a cleaner view.

How did you verify your code works?

I verified that all tests passed and also verified the functionality locally. Used the following config options to try it out locally with bun dev:

  "enabled_models": {
    "openai": ["gpt-5.2-codex"],
    "opencode": ["claude-sonnet-4-5"]
  },
  "disabled_models": {
    "google": ["gemini-1*"]
  }

And that gave me the following result with my setup:

image

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found.

@KelvinJRosado
Copy link
Author

Adding screenshots for additional testing I did with these options. Used the following config:

{
  "$schema": "https://opencode.ai/config.json",
  "enabled_providers": ["openai", "opencode", "google"],
  "model": "openai/gpt-5-2-codex",
  "small_model": "openai/gpt-5-1-codex-mini",
  "default_agent": "plan",
  "compaction": {
    "auto": true,
    "prune": true
  },
  "enabled_models": {
    "openai": ["gpt-5.*-codex*"],
    "opencode": ["claude-sonnet-4-5"],
    "google": ["gemini-2*"]
  },
  "disabled_models": {
    "google": ["*preview*"]
  }
}

This gives us the following options in the /models list:

image

This shows how we can restrict the models per provider. In this case, disabling preview models from the Google provider and ensuring we only use the 2* series. We also limit Zen to just 1 model, and OpenAI to the 5.* codex models

@KelvinJRosado
Copy link
Author

KelvinJRosado commented Jan 24, 2026

I believe this is in a good state to review now. But not sure how to go about doing that 😅

@KelvinJRosado KelvinJRosado changed the title feat: add config options to enable and disable models feat(opencode): add config options to enable and disable models Jan 27, 2026
@KelvinJRosado
Copy link
Author

Cleaned this up to remove some redundant tests, reducing the size

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Support disabled_models config to hide specific models

1 participant