anomalyco / anomalyco/opencode
[FEATURE]: Add a native V2 replacement for provider model filtering
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement
OpenCode V1 supports per-provider model filtering with whitelist and blacklist:
{
"provider": {
"ollama-cloud": {
"whitelist": ["glm-5.2"]
}
}
}
This is useful when a provider exposes a large or changing catalog.
V2 currently drops these fields during V1-to-V2 normalization. The provider remains available, but the model filter is not applied.
Reproduction
Tested with @opencode/cli@2.0.9 using a clean config and:
npx --yes @opencode/cli@2.0.9 \
api --standalone --print-logs get /api/config
The normalized config contains the provider settings but omits whitelist. The server log reports:
path=$.provider.ollama-cloud.whitelist
kind=unsupported
action="omitted unsupported legacy setting"
Expected behavior
Please either:
- provide a native V2 equivalent for per-provider model filtering; or
- document the intentional removal and recommended replacement clearly in the V2 migration guide.
The old provider documentation still documents this feature, which makes migration unclear.
References
- V1 documentation: https://opencode.ai/docs/providers#hiding-models
- V2 provider documentation: https://opencode.ai/v2/docs/providers
- V2 migration guide: https://opencode.ai/v2/docs/migrate-v1#accepted-but-unsupported-fields
- V2 normalizer: https://github.com/anomalyco/opencode/blob/v2.0.9/packages/core/src/config/normalize.ts#L54
- V2 unsupported-field handling: https://github.com/anomalyco/opencode/blob/v2.0.9/packages/core/src/config/normalize.ts#L566-L576
- Original V1 implementation: https://github.com/anomalyco/opencode/blob/c0d9f21c0f921b6baf2e034ed64133af04d5b7fb/packages/opencode/src/provider/provider.ts#L449-L475
Related: #42535 covers wildcard support for the existing V1 filter syntax. This issue concerns the missing V2 migration path.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/core/src/config/normalize.ts around the V1-to-V2 provider normalization and unsupported-field handling, then compare the linked V1 provider implementation and V2 provider and migration documentation. Confirm how provider model filtering should work in V2; done means the behavior is supported natively or its removal and replacement are clearly documented, with coverage for the reported normalization case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100