Skip to content

feat: Add config flag to filter provider models#580

Closed
ryanjdillon wants to merge 1 commit into
anomalyco:devfrom
fornybar:feat/add-flag-to-filter-provider-models
Closed

feat: Add config flag to filter provider models#580
ryanjdillon wants to merge 1 commit into
anomalyco:devfrom
fornybar:feat/add-flag-to-filter-provider-models

Conversation

@ryanjdillon

@ryanjdillon ryanjdillon commented Jul 1, 2025

Copy link
Copy Markdown

Problem

When using Azure OpenAI as a model provider, all potentially available models from this service are shown, but that likely doesn't correspond to the deployed models in a workspace of this service--we have 4 deployed models. You of course get an error if you try to call a model that is not deployed.

Solution

The fix in this PR adds a flag that allows filtering to only the models defined in the config file.

Example
Here, no models will be shown for Copilot despite a Github token being found, and only 3 models of 4 deployed are shown, with the rest found and added to the database being hidden.

{
  "$schema": "https://opencode.ai/config.json",
  "onlyConfigModels": true,
  "provider": {
    "github-copilot": {
      "models": {}
    },
    "azure": {
      "models": {
        "GPT-4.1": {
          "name": "GPT4.1"
        },
        "GPT-4.1-mini": {
          "name": "GPT4.1-mini"
        },
        "GPT-4.1-nano": {
          "name": "GPT4.1-nano"
        }
      }
    }
  }
}

Alternatively, this could just be default behavior omitting the need for such a flag.

It would also be nice to query the available models to prevent the need to define models in the config., but the included solution is easy enough and allows some additional flexibility about which models to show.

teamgroove pushed a commit to teamgroove/opencode that referenced this pull request Aug 3, 2025
Merged from: anomalyco#580
Author: @ryanjdillon
Auto-merged by opencode-fork integration system
@ryanjdillon

Copy link
Copy Markdown
Author

Removing fork, so will close this PR.

@ryanjdillon ryanjdillon closed this Oct 8, 2025
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.

2 participants