You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cf-ai-gateway silently drops reasoningEffort, variants, and other provider options (sdkKey/variants missing ai-gateway-provider case) #24432
Two bugs in packages/opencode/src/provider/transform.ts mean that for cf-ai-gateway models whose underlying SDK is ai-gateway-provider (i.e. OpenAI / openai-compatible upstreams), model options and variants never reach the actual SDK:
sdkKey() has no case for "ai-gateway-provider". Falls back to model.providerID ("cloudflare-ai-gateway"), so providerOptions() produces { "cloudflare-ai-gateway": { reasoningEffort: "high", ... } }. But ai-gateway-provider/providers/unified creates the language model via createOpenAICompatible({ name: "Unified" }), and @ai-sdk/openai-compatible reads providerOptions from "openai-compatible" / "openaiCompatible" / "Unified" / "unified". None match "cloudflare-ai-gateway" → all options silently dropped.
variants() switch has no case for "ai-gateway-provider", so it returns {}. Workflow variant: xhigh input is silently ignored for every cf-ai-gateway model on this codepath.
Net effect: bots on cf-ai-gateway OAI models run at OpenAI's default reasoning effort. The variant: "xhigh" input is dead config, and provider.cloudflare-ai-gateway.models.<id>.options.reasoningEffort in opencode.json is also dead.
Scope: only affects cf-ai-gateway models whose underlying SDK is ai-gateway-provider (OpenAI / openai-compatible upstreams). Anthropic and Google models on cf-ai-gateway resolve to bundled @ai-sdk/anthropic / @ai-sdk/google per models.dev, so sdkKey() returns the right key and providerOptions / variants route correctly for those. Fix is specifically for the ai-gateway-provider codepath.
Expected:sdkKey("ai-gateway-provider") should return "openai-compatible" (the underlying SDK), and variants() should dispatch on model.api.id prefix (openai/..., anthropic/..., etc.) like @ai-sdk/gateway already does.
OpenCode version
Reproduces on 1.4.11 and 1.14.25 (every version since cf-ai-gateway shipped).
This issue might be a duplicate of existing issues. Please check:
openai-compatible provider options silently dropped if provider name contains dot #23622: Same root cause — sdkKey() in transform.ts falls back to model.providerID instead of the underlying SDK's expected key, causing providerOptions to be silently dropped. That issue tracks the same bug for providers with dotted names; this issue describes the same pattern for ai-gateway-provider.
Scope note: this only affects cf-ai-gateway models whose underlying SDK is ai-gateway-provider (i.e. OpenAI / openai-compatible upstreams). Anthropic and Google models on cf-ai-gateway resolve to bundled @ai-sdk/anthropic / @ai-sdk/google per models.dev, so sdkKey() returns the right key for those and providerOptions / variants route correctly. The fix is specifically for the ai-gateway-provider codepath.
Activity
github-actions commentedon Apr 26, 2026
This issue might be a duplicate of existing issues. Please check:
optionssilently dropped if provider name contains dot #23622: Same root cause —sdkKey()intransform.tsfalls back tomodel.providerIDinstead of the underlying SDK's expected key, causingproviderOptionsto be silently dropped. That issue tracks the same bug for providers with dotted names; this issue describes the same pattern forai-gateway-provider.variants()switch missing theai-gateway-providercase described here.If your issue is distinct (e.g. the fix for #23622 didn't cover
ai-gateway-provider), please clarify so maintainers can track it separately.NathanDrake2406 commentedon Apr 26, 2026
Scope note: this only affects cf-ai-gateway models whose underlying SDK is
ai-gateway-provider(i.e. OpenAI / openai-compatible upstreams). Anthropic and Google models on cf-ai-gateway resolve to bundled@ai-sdk/anthropic/@ai-sdk/googlepermodels.dev, sosdkKey()returns the right key for those andproviderOptions/variantsroute correctly. The fix is specifically for theai-gateway-providercodepath.fix(cf-ai-gateway): route provider options through openaiCompatible key
fix(cf-ai-gateway): route provider options through openaiCompatible k…
fix(cf-ai-gateway): route provider options through openaiCompatible k…
fix(cf-ai-gateway): route provider options through openaiCompatible k…
chore: sync upstream anomalyco/dev (2026-05-07) (#412)
fix(cf-ai-gateway): route provider options through openaiCompatible k…
fix(cf-ai-gateway): route provider options through openaiCompatible k…
fix(cf-ai-gateway): route provider options through openaiCompatible k…