Reasoning variants don't work with Vercel AI Gateway provider #8797

Closed
opened 2026-02-16 18:10:52 -05:00 by yindo · 2 comments
Owner

Originally created by @AndrewBarba on GitHub (Feb 7, 2026).

Originally assigned to: @thdxr on GitHub.

Description

When using the Vercel AI Gateway provider, built-in reasoning variants are defined but have no effect. Reasoning options are passed into providerOptions.gateway, which does not accept or forward reasoning options to the upstream provider.

This means that when using models like Claude Opus 4.6 or GPT 5.2 through AI Gateway, no thinking/reasoning output is produced and the AI Gateway dashboard shows zero reasoning tokens.

Expected Behavior

Reasoning variants (e.g. thinking/extended thinking) should work correctly when using models through the Vercel AI Gateway, just as they do when using the providers directly.

Actual Behavior

  • No thinking/reasoning output is produced when using reasoning variants through AI Gateway
  • AI Gateway dashboard shows zero reasoning tokens
  • The reasoning variant options are silently ignored because providerOptions.gateway doesn't support them

Root Cause

The Vercel AI Gateway passes through providerOptions for upstream providers (docs), but the built-in variant logic doesn't account for this. It sets reasoning options on the gateway provider options directly rather than targeting the upstream provider's options.

Related

Originally created by @AndrewBarba on GitHub (Feb 7, 2026). Originally assigned to: @thdxr on GitHub. ## Description When using the Vercel AI Gateway provider, built-in reasoning variants are defined but have no effect. Reasoning options are passed into `providerOptions.gateway`, which does not accept or forward reasoning options to the upstream provider. This means that when using models like Claude Opus 4.6 or GPT 5.2 through AI Gateway, no thinking/reasoning output is produced and the AI Gateway dashboard shows zero reasoning tokens. ## Expected Behavior Reasoning variants (e.g. thinking/extended thinking) should work correctly when using models through the Vercel AI Gateway, just as they do when using the providers directly. ## Actual Behavior - No thinking/reasoning output is produced when using reasoning variants through AI Gateway - AI Gateway dashboard shows zero reasoning tokens - The reasoning variant options are silently ignored because `providerOptions.gateway` doesn't support them ## Root Cause The Vercel AI Gateway passes through `providerOptions` for upstream providers ([docs](https://ai-sdk.dev/providers/ai-sdk-providers/ai-gateway#provider-specific-options)), but the built-in variant logic doesn't account for this. It sets reasoning options on the gateway provider options directly rather than targeting the upstream provider's options. ## Related - Fix PR: #12391
yindo closed this issue 2026-02-16 18:10:52 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 7, 2026):

This issue might be a duplicate of or related to existing issues. Please check:

  • #12396: Gateway provider rejecting thinking/reasoning config for paid models (GLM-4.7, Kimi K2.5, MiniMax M2.1 on Zen)
  • #12155: Missing reasoning variants for multiple providers (Together.AI, OpenAI-compatible, OpenRouter)

The root cause appears to be a systematic issue with how reasoning options are passed through gateway/proxy providers that don't natively support the parameters. The fix PR #12391 may address this pattern across multiple providers.

Feel free to ignore if these don't match your specific use case with Vercel AI Gateway.

@github-actions[bot] commented on GitHub (Feb 7, 2026): This issue might be a duplicate of or related to existing issues. Please check: - #12396: Gateway provider rejecting thinking/reasoning config for paid models (GLM-4.7, Kimi K2.5, MiniMax M2.1 on Zen) - #12155: Missing reasoning variants for multiple providers (Together.AI, OpenAI-compatible, OpenRouter) The root cause appears to be a systematic issue with how reasoning options are passed through gateway/proxy providers that don't natively support the parameters. The fix PR #12391 may address this pattern across multiple providers. Feel free to ignore if these don't match your specific use case with Vercel AI Gateway.
Author
Owner

@AdJIa commented on GitHub (Feb 8, 2026):

Related: We encountered a similar pattern with alibaba-cn (DashScope) provider.

Same root cause: reasoning options are not correctly passed to the underlying provider.

In our case, DashScope's OpenAI-compatible API requires enable_thinking: true in the request body for reasoning models (kimi-k2.5, qwen-plus, deepseek-r1, etc.) to return reasoning_content. Without it, all these models produce zero reasoning tokens.

The existing transform.ts logic only handled:

  1. providerID === "opencode" (via chat_template_args.enable_thinking)
  2. @ai-sdk/anthropic SDK (via thinking.type: "enabled")

But alibaba-cn uses @ai-sdk/openai-compatible, so neither path was taken.

We've submitted PR #12772 to fix this for the alibaba-cn provider. The fix adds a condition to set enable_thinking: true for all reasoning-capable models on alibaba-cn.

Temporary workaround for alibaba-cn users until the PR is merged: add "enable_thinking": true to model options in opencode.json:

"alibaba-cn": {
  "models": {
    "kimi-k2.5": { "options": { "enable_thinking": true } },
    "qwen-plus": { "options": { "enable_thinking": true } }
  }
}
@AdJIa commented on GitHub (Feb 8, 2026): Related: We encountered a similar pattern with `alibaba-cn` (DashScope) provider. **Same root cause**: reasoning options are not correctly passed to the underlying provider. In our case, DashScope's OpenAI-compatible API requires `enable_thinking: true` in the request body for reasoning models (kimi-k2.5, qwen-plus, deepseek-r1, etc.) to return `reasoning_content`. Without it, all these models produce zero reasoning tokens. The existing `transform.ts` logic only handled: 1. `providerID === "opencode"` (via `chat_template_args.enable_thinking`) 2. `@ai-sdk/anthropic` SDK (via `thinking.type: "enabled"`) But `alibaba-cn` uses `@ai-sdk/openai-compatible`, so neither path was taken. We've submitted PR #12772 to fix this for the alibaba-cn provider. The fix adds a condition to set `enable_thinking: true` for all reasoning-capable models on alibaba-cn. Temporary workaround for alibaba-cn users until the PR is merged: add `"enable_thinking": true` to model options in `opencode.json`: ```json "alibaba-cn": { "models": { "kimi-k2.5": { "options": { "enable_thinking": true } }, "qwen-plus": { "options": { "enable_thinking": true } } } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8797