feat: Add config flag to filter provider models#580
Closed
ryanjdillon wants to merge 1 commit into
Closed
Conversation
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
github-actions
Bot
force-pushed
the
dev
branch
from
September 29, 2025 05:53
f16de3d to
cc0d460
Compare
Author
|
Removing fork, so will close this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.