Skip to content

fix (gateway): forward non-gateway provider options under gateway.providerOptions for fallback model support#16502

Open
kairosci wants to merge 2 commits into
vercel:mainfrom
kairosci:gateway-fallback-provider-options
Open

fix (gateway): forward non-gateway provider options under gateway.providerOptions for fallback model support#16502
kairosci wants to merge 2 commits into
vercel:mainfrom
kairosci:gateway-fallback-provider-options

Conversation

@kairosci

@kairosci kairosci commented Jun 30, 2026

Copy link
Copy Markdown

Description

Provider-specific options (e.g., google.thinkingConfig) specified at the top level of providerOptions were being ignored when the gateway routed to a fallback model from gateway.models or gateway.order. The gateway API server applies providerOptions.<provider> only for the primary model, not for any fallback model selected at runtime.

Changes

A new providerOptions field was added to the GatewayProviderOptions type, providing a mechanism to associate options with any provider the gateway might route to. GatewayLanguageModel.getArgs() was updated to auto-nest all non-gateway provider options under gateway.providerOptions before sending the request, so the server can read and apply the correct options regardless of which model (primary or fallback) is selected. 4 regression tests were added covering nesting for doGenerate, nesting for doStream, no-op when no non-gateway options exist, and preservation of top-level options for backward compatibility.

The change is transparent to users: the public API is unchanged, and the SDK automatically populates the new field from existing top-level provider options.

Closes #14377

@kairosci kairosci force-pushed the gateway-fallback-provider-options branch from a0c363f to e2c9166 Compare June 30, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

providerOptions.google.thinkingConfig.includeThoughts: false ignored for gateway-fallback models — thinking tokens break Output.object() parsing

1 participant