This repository was archived by the owner on May 15, 2026. It is now read-only.
fix: add thinking parameter for OpenAI-compatible APIs with supportsReasoningBinary - #11032
Draft
ghost wants to merge 1 commit into
Draft
fix: add thinking parameter for OpenAI-compatible APIs with supportsReasoningBinary#11032ghost wants to merge 1 commit into
ghost wants to merge 1 commit into
Conversation
…easoningBinary is true Fixes #11001 When using OpenAI-compatible APIs like volcengine Ark API with reasoning effort enabled, the API requires both: 1. reasoning_effort parameter (e.g., "medium") 2. thinking parameter set to { type: "enabled" } This change adds the thinking parameter when: - Reasoning effort is being used (reasoning object is present), AND - The model's supportsReasoningBinary flag is true The fix is applied to both: - createMessage method (for regular models with streaming) - handleO3FamilyMessage method (for O3 family models) Users can enable this by setting supportsReasoningBinary: true in their custom model info configuration.
Author
Review complete. No issues found. The implementation correctly adds the Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #11001
Description
This PR attempts to address Issue #11001 where OpenAI-compatible APIs (like volcengine's Ark API) return an error when using reasoning effort: "Invalid combination of reasoning_effort and thinking type: medium + disabled"
Root Cause: Some OpenAI-compatible APIs require both the
reasoning_effortparameter (e.g., "medium") AND athinkingparameter set to{ type: "enabled" }. The OpenAI handler was sendingreasoning_effortbut not thethinkingparameter, creating an invalid state.Implementation Details:
Added
thinking: { type: "enabled" }parameter insrc/api/providers/openai.tswhen:reasoningobject is present), ANDsupportsReasoningBinaryflag is trueApplied the fix to three locations:
createMessagemethod (streaming path)handleO3FamilyMessagemethod (streaming path)handleO3FamilyMessagemethod (non-streaming path)This follows the same pattern already implemented in
base-openai-compatible-provider.tsUsage: Users can enable this by setting
supportsReasoningBinary: truein their custom model info configuration.Test Procedure
Added 5 new test cases to verify the thinking parameter behavior:
should include thinking parameter when supportsReasoningBinary is true and reasoning effort is enabledshould not include thinking parameter when supportsReasoningBinary is false even with reasoning effort enabledshould include thinking parameter for O3 model when supportsReasoningBinary is trueshould not include thinking parameter for O3 model when supportsReasoningBinary is falseshould include thinking parameter for O3 model in non-streaming mode when supportsReasoningBinary is trueAll 53 tests pass:
cd src && npx vitest run api/providers/__tests__/openai.spec.tsPre-Submission Checklist
Documentation Updates
supportsReasoningBinaryin custom model info.Additional Notes
Feedback and guidance are welcome!
Important
Adds
thinkingparameter to OpenAI-compatible APIs whenreasoning_effortis used andsupportsReasoningBinaryis true, with tests verifying behavior.thinking: { type: "enabled" }parameter inopenai.tswhenreasoning_effortis used andsupportsReasoningBinaryis true.createMessageandhandleO3FamilyMessagemethods for both streaming and non-streaming paths.openai.spec.tsto verifythinkingparameter behavior under different conditions.supportsReasoningBinarytrue/false and streaming/non-streaming modes.This description was created by
for 19bd598. You can customize this summary. It will automatically update as commits are pushed.