Skip to content

fix: use camelCase reasoningEffort for Gemini 3 models in openai-compatible provider#13228

Merged
kangfenmao merged 1 commit intomainfrom
DeJeune/fix-gemini-model-bug
Mar 5, 2026
Merged

fix: use camelCase reasoningEffort for Gemini 3 models in openai-compatible provider#13228
kangfenmao merged 1 commit intomainfrom
DeJeune/fix-gemini-model-bug

Conversation

@DeJeune
Copy link
Copy Markdown
Collaborator

@DeJeune DeJeune commented Mar 5, 2026

What this PR does

Before this PR:
Gemini 3 models (e.g., gemini-3-flash-preview) did not include the reasoning_effort parameter in HTTP requests when deep thinking mode was enabled through OpenAI Compatible providers. The parameter was silently dropped.

image

After this PR:
Gemini 3 models correctly send the reasoning_effort parameter when using OpenAI Compatible providers.

image

Fixes #13221

Why we need it and why it was done in this way

The AI SDK's @ai-sdk/openai-compatible provider schema only recognizes camelCase reasoningEffort, not snake_case reasoning_effort. When snake_case was passed via provider options, it failed schema validation. The SDK then explicitly mapped reasoning_effort: compatibleOptions.reasoningEffort in the request body, which resolved to undefined (since the schema rejected the snake_case key), overriding any spread value and silently dropping the parameter.

The fix changes the return value from { reasoning_effort: reasoningEffort } to { reasoningEffort } (camelCase) so the AI SDK schema recognizes it and properly maps it to reasoning_effort in the HTTP request body.

The following tradeoffs were made: N/A

The following alternatives were considered: Patching the AI SDK to accept snake_case — rejected because it's a third-party dependency and the camelCase format is the documented API.

Breaking changes

None

Special notes for your reviewer

The existing comment in src/renderer/src/types/sdk.ts (line 82) already warns about this exact behavior: // WARN: This field will be overwrite to undefined by aisdk if the provider is openai-compatible. Use reasoningEffort instead.

Checklist

  • PR: The PR description is expressive enough and will help future contributors
  • Code: Write code that humans can understand and Keep it simple
  • Refactor: You have left the code cleaner than you found it (Boy Scout Rule)
  • Upgrade: Impact of this change on upgrade flows was considered and addressed if required
  • Documentation: Not required — bug fix with no behavior change from the user's perspective
  • Self-review: I have reviewed my own code before requesting review from others

Release note

Fix Gemini 3 models not sending reasoning_effort parameter when deep thinking mode is enabled through OpenAI Compatible providers.

…atible provider

The AI SDK's openai-compatible provider schema only recognizes camelCase
`reasoningEffort`, not snake_case `reasoning_effort`. When snake_case was
passed, the SDK's explicit mapping overrode it with `undefined`, silently
dropping the parameter from HTTP requests.

Closes #13221

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@kangfenmao kangfenmao merged commit dcf844e into main Mar 5, 2026
12 checks passed
@kangfenmao kangfenmao deleted the DeJeune/fix-gemini-model-bug branch March 5, 2026 05:39
@1738348785
Copy link
Copy Markdown

1738348785 commented Mar 5, 2026

Note

This comment was translated by Claude.

The openai-response API has the same issue, it also doesn't pass parameters.


Original Content openai-response api 也有同样的问题,也没传参

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.

[Bug]: Gemini 3 model does not include the built-in “deep thinking” parameter reasoning_effort: "high" in openai and openai response api

4 participants