anomalyco / anomalyco/opencode
bug: gateway providerOptions drops explicit provider namespace under an unrecognized model-ID alias
@neriousy is already working on this.
Since Sep 8, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
ProviderTransform.providerOptions() (in packages/opencode/src/provider/transform.ts, the @ai-sdk/gateway branch) buckets every non-gateway top-level provider option under a single key derived from the gateway model-ID prefix (model.api.id.split("/")[0], via SLUG_OVERRIDES).
When that prefix is an internal routing alias rather than a recognized AI SDK provider slug (e.g. a centrally-configured virtual-model-catalog ID that isn't literally "openai" or "anthropic"), there is no way to address a specific upstream provider's providerOptions namespace directly. An explicit, already-correctly-namespaced option such as:
{ "gateway": { "zeroDataRetention": true }, "openai": { "store": false } }
gets folded entirely into the alias slug's bucket instead of surviving as its own top-level providerOptions.openai key — so the AI SDK provider package that actually reads providerOptions.openai never sees it. This breaks any setup that needs OpenAI-specific options (e.g. store: false for zero-data-retention / stateless-reasoning workflows) on a gateway model whose ID isn't already prefixed with a recognized provider slug.
I have a fix and tests ready in a PR: adds a reserved options.providerOptions wrapper as an explicit escape hatch, consumed and stripped before legacy bucketing runs so every other option keeps byte-for-byte identical legacy behavior. See the linked PR for full details and design-alternatives considered.
Plugins
None — reproducible directly against ProviderTransform.providerOptions() with a unit test, no plugins involved.
OpenCode version
Reproduces against dev at commit d6855b6 (opencode-ai 1.18.29), and against the opencode-ai@1.18.15 npm release.
Steps to reproduce
- Configure a gateway model whose
api.idprefix is not one of the AI SDK's recognized provider slugs (e.g. a custom-aliased model ID such asacme/gpt-5.1routed through@ai-sdk/gateway). - Set model options that include an explicit provider namespace, e.g.
{ gateway: { zeroDataRetention: true }, openai: { store: false } }. - Call
ProviderTransform.providerOptions(model, options). - Observe the result nests
openaiinside the alias-derived slug (e.g.{ gateway: {...}, acme: { openai: { store: false } } }) instead of preserving it as a top-levelopenaikey — so the OpenAI provider package never receivesstore: false.
Screenshot and/or share link
N/A — this is a pure function bug reproducible with a unit test; see the failing/passing test cases in the linked PR.
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.
Assessment
This issue has not been assessed yet.