Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jan 28, 2026

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_effort parameter (e.g., "medium") AND a thinking parameter set to { type: "enabled" }. The OpenAI handler was sending reasoning_effort but not the thinking parameter, creating an invalid state.

Implementation Details:

  • Added thinking: { type: "enabled" } parameter in src/api/providers/openai.ts when:

    1. Reasoning effort is being used (the reasoning object is present), AND
    2. The model's supportsReasoningBinary flag is true
  • Applied the fix to three locations:

    • createMessage method (streaming path)
    • handleO3FamilyMessage method (streaming path)
    • handleO3FamilyMessage method (non-streaming path)
  • This follows the same pattern already implemented in base-openai-compatible-provider.ts

Usage: Users can enable this by setting supportsReasoningBinary: true in their custom model info configuration.

Test Procedure

  • Added 5 new test cases to verify the thinking parameter behavior:

    1. should include thinking parameter when supportsReasoningBinary is true and reasoning effort is enabled
    2. should not include thinking parameter when supportsReasoningBinary is false even with reasoning effort enabled
    3. should include thinking parameter for O3 model when supportsReasoningBinary is true
    4. should not include thinking parameter for O3 model when supportsReasoningBinary is false
    5. should include thinking parameter for O3 model in non-streaming mode when supportsReasoningBinary is true
  • All 53 tests pass: cd src && npx vitest run api/providers/__tests__/openai.spec.ts

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes.
  • Documentation Impact: No documentation updates are required - this is an internal fix that uses existing model configuration options.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required - users already have access to supportsReasoningBinary in custom model info.

Additional Notes

Feedback and guidance are welcome!


Important

Adds thinking parameter to OpenAI-compatible APIs when reasoning_effort is used and supportsReasoningBinary is true, with tests verifying behavior.

  • Behavior:
    • Adds thinking: { type: "enabled" } parameter in openai.ts when reasoning_effort is used and supportsReasoningBinary is true.
    • Applied in createMessage and handleO3FamilyMessage methods for both streaming and non-streaming paths.
  • Tests:
    • Adds 5 test cases in openai.spec.ts to verify thinking parameter behavior under different conditions.
    • Tests include scenarios with supportsReasoningBinary true/false and streaming/non-streaming modes.
  • Misc:

This description was created by Ellipsis for 19bd598. You can customize this summary. It will automatically update as commits are pushed.

…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.
@roomote
Copy link
Contributor Author

roomote bot commented Jan 28, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly adds the thinking: { type: "enabled" } parameter when using reasoning effort with supportsReasoningBinary: true. The logic follows the existing pattern in base-openai-compatible-provider.ts, all 53 tests pass, and the fix addresses the root cause of issue #11001.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

nicky-zs

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] [OpenAI completion error] Invalid combination of reasoning_effort and thinking type: medium + disabled

2 participants