anomalyco / anomalyco/opencode

bug: gateway providerOptions drops explicit provider namespace under an unrecognized model-ID alias

Open
#47,987 1 comment 0 reactions 1 assignee View on GitHub

@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
  1. Configure a gateway model whose api.id prefix is not one of the AI SDK's recognized provider slugs (e.g. a custom-aliased model ID such as acme/gpt-5.1 routed through @ai-sdk/gateway).
  2. Set model options that include an explicit provider namespace, e.g. { gateway: { zeroDataRetention: true }, openai: { store: false } }.
  3. Call ProviderTransform.providerOptions(model, options).
  4. Observe the result nests openai inside the alias-derived slug (e.g. { gateway: {...}, acme: { openai: { store: false } } }) instead of preserving it as a top-level openai key — so the OpenAI provider package never receives store: 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.