Feature Request
Problem
Currently, OpenCode loads all models from all connected providers at startup. There is no plugin hook that allows filtering or excluding specific models from the model list before they appear in the /models selector.
The existing blacklist/whitelist fields in the provider config work on a per-provider basis, but there's no way to apply a global filter across all providers via a plugin.
Use Case
I want to exclude all Claude/Anthropic models from every provider's model list. With 40+ providers that include Claude models, adding a blacklist to each provider's config is impractical. A plugin hook would allow a single filter to apply across all providers.
Proposed Solution
Add a new plugin hook that fires during model loading, allowing plugins to filter the model list:
export const ModelFilterPlugin = async () => {
return {
"model.list": async (input, output) => {
// input: { providerID: string, models: Model[] }
// output: { models: Model[] }
output.models = output.models.filter(
m => !m.name.toLowerCase().includes("claude") &&
!m.id.toLowerCase().includes("anthropic")
)
},
}
}
Alternative
If a dedicated hook isn't feasible, consider:
- A global
disabled_models config field that accepts patterns (e.g., ["*claude*", "*anthropic*"])
- A
model.filter event that plugins can subscribe to
Context
- Plugin hooks currently cover: messages, sessions, tools, files, permissions, shell env, etc.
- No model-related hooks exist
- The
blacklist/whitelist provider config fields exist but are per-provider and require manual configuration for each provider
Feature Request
Problem
Currently, OpenCode loads all models from all connected providers at startup. There is no plugin hook that allows filtering or excluding specific models from the model list before they appear in the
/modelsselector.The existing
blacklist/whitelistfields in the provider config work on a per-provider basis, but there's no way to apply a global filter across all providers via a plugin.Use Case
I want to exclude all Claude/Anthropic models from every provider's model list. With 40+ providers that include Claude models, adding a
blacklistto each provider's config is impractical. A plugin hook would allow a single filter to apply across all providers.Proposed Solution
Add a new plugin hook that fires during model loading, allowing plugins to filter the model list:
Alternative
If a dedicated hook isn't feasible, consider:
disabled_modelsconfig field that accepts patterns (e.g.,["*claude*", "*anthropic*"])model.filterevent that plugins can subscribe toContext
blacklist/whitelistprovider config fields exist but are per-provider and require manual configuration for each provider