Skip to content

fix(openai): strip reasoning param and map to reasoning_effort for "/v1/chat/completions"#1374

Open
Jinhyeok33 wants to merge 1 commit into
musistudio:mainfrom
Jinhyeok33:fix/openai-strip-reasoning
Open

fix(openai): strip reasoning param and map to reasoning_effort for "/v1/chat/completions"#1374
Jinhyeok33 wants to merge 1 commit into
musistudio:mainfrom
Jinhyeok33:fix/openai-strip-reasoning

Conversation

@Jinhyeok33
Copy link
Copy Markdown

Summary

OpenAI's /v1/chat/completions rejects the unknown parameter reasoning, returning a 400:

Unknown parameter: 'reasoning'

This breaks every provider whose transformer.use includes OpenAI whenever Claude Code sends a thinking-enabled request
(Plan Mode, think harder, etc.).

Closes #652
Related to #510, #668

Fix

Add transformRequestIn to OpenAITransformer that:

  1. Maps reasoning.effort → OpenAI's native reasoning_effort (the field actually accepted by o1/o3/o4/gpt-5 on
    /v1/chat/completions) when an effort level is set and not "none".
  2. Strips reasoning, thinking, and enable_thinking so OpenAI's strict-parameter validation passes.

The ThinkLevel values produced by this codebase — none | low | medium | high (see packages/core/src/utils/thinking.ts) — are exactly the values OpenAI accepts for reasoning_effort, so the mapping is a 1:1 passthrough with no value-space
conversion needed.

Verification

  • ✅ Reproduced the original Unknown parameter: 'reasoning' 400 against an OpenAI provider with Plan Mode enabled (before this change).
  • ✅ With this change the same request succeeds; the outgoing payload contains reasoning_effort (when an effort is set) and
    no longer contains reasoning / thinking / enable_thinking.
  • ✅ Non-thinking requests are unchanged.

OpenAI's /v1/chat/completions rejects the unknown `reasoning` parameter
that AnthropicTransformer + ReasoningTransformer leave on the request,
causing "Unknown parameter: 'reasoning'" (400) whenever Claude Code
sends a thinking-enabled request to an OpenAI provider.

Add transformRequestIn to OpenAITransformer that maps reasoning.effort
to OpenAI's native reasoning_effort and strips reasoning / thinking /
enable_thinking. Mirrors the pattern already used by CerebrasTransformer.

Closes musistudio#652
Related to musistudio#510, musistudio#668
@Jinhyeok33 Jinhyeok33 changed the title fix(openai): strip reasoning param and map to reasoning_effort for /v1/chat/completions" fix(openai): strip reasoning param and map to reasoning_effort for "/v1/chat/completions" Apr 30, 2026
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.

GPT-5 crashes with 'Unknown parameter: reasoning' in 'think mode'

1 participant