Skip to content

fix(core): send reasoning_effort at the top level of the request - #370

Merged
qorzj merged 2 commits into
lessweb:mainfrom
coderbuzz:fix/reasoning-effort-top-level
Oct 13, 2026
Merged

qorzj merged 2 commits into
lessweb:mainfrom
coderbuzz:fix/reasoning-effort-top-level

Conversation

@coderbuzz

Copy link
Copy Markdown
Contributor

Problem

buildThinkingRequestOptions returns { thinking, extra_body: { reasoning_effort } }, and SessionManager spreads that into the
chat.completions.create params. extra_body is a Python OpenAI SDK option; the Node SDK has no equivalent and serializes it as a
literal "extra_body" key in the JSON body. The DeepSeek API ignores that key, so the reasoningEffort setting
(low / high / max) never reaches the model.

Evidence

Direct calls to https://api.deepseek.com/chat/completions with model: deepseek-v4-flash and thinking: {type: "enabled"}:

body response
"reasoning_effort": "bogus" (top level) 422: reasoning_effort: unknown variant 'bogus', expected one of none, minimal, low, medium, high, xhigh, ultra, max
"extra_body": {"reasoning_effort": "bogus"} 200 (field never read)

So the API reads the top-level field and never looks inside extra_body.

Fix

Send reasoning_effort at the top level, next to thinking (which is already top level). The tests in
openai-thinking.test.ts are updated to the new shape.

I could only verify the DeepSeek endpoint. The Volcengine Ark tests use the same payload as before, so please check whether Ark
also expects reasoning_effort at the top level.

Tests

npm test in packages/core: all openai-thinking tests pass. 3 unrelated tests fail with and without this change on my machine
(computeToolCallPermissions allows read tool calls under skill scan paths, ReadImage uses filesystem read permissions ...,
UnderstandImage requires network ...).

🤖 Generated with Claude Code

coderbuzz and others added 2 commits October 12, 2026 17:25
extra_body is a Python OpenAI SDK convention. The Node SDK has no such
option and serializes it as a literal "extra_body" key, which the
DeepSeek API ignores, so the reasoningEffort setting never reached the
model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qorzj
qorzj merged commit 59a3dcb into lessweb:main Oct 13, 2026
6 checks passed
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.

2 participants