[PR #580] [CLOSED] feat: Add config flag to filter provider models #9650

Closed
opened 2026-02-16 18:13:55 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/580
Author: @ryanjdillon
Created: 7/1/2025
Status: Closed

Base: devHead: feat/add-flag-to-filter-provider-models


📝 Commits (1)

  • b6248a0 feat: Add config flag to filter provider models

📊 Changes

2 files changed (+11 additions, -1 deletions)

View changed files

📝 packages/opencode/src/config/config.ts (+5 -0)
📝 packages/opencode/src/provider/provider.ts (+6 -1)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/580 **Author:** [@ryanjdillon](https://github.com/ryanjdillon) **Created:** 7/1/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `feat/add-flag-to-filter-provider-models` --- ### 📝 Commits (1) - [`b6248a0`](https://github.com/anomalyco/opencode/commit/b6248a0fe08150b47c595cc973aacf7bb4bd432b) feat: Add config flag to filter provider models ### 📊 Changes **2 files changed** (+11 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/config/config.ts` (+5 -0) 📝 `packages/opencode/src/provider/provider.ts` (+6 -1) </details> ### 📄 Description # 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. ```json { "$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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:13:55 -05:00
yindo closed this issue 2026-02-16 18:13:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9650