Skip to content

Conversation

ryanjdillon
Copy link

@ryanjdillon ryanjdillon commented Jul 1, 2025

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.

@ryanjdillon ryanjdillon force-pushed the feat/add-flag-to-filter-provider-models branch from 637f317 to b6248a0 Compare July 30, 2025 17:46
teamgroove pushed a commit to teamgroove/opencode that referenced this pull request Aug 3, 2025
Merged from: sst#580
Author: @ryanjdillon
Auto-merged by opencode-fork integration system
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