Skip to content

fix(openrouter): remove conflicting reasoning_effort from payload#24120

Merged
gumadeiras merged 2 commits intoopenclaw:mainfrom
tenequm:fix/openrouter-reasoning-effort-conflict
Feb 23, 2026
Merged

fix(openrouter): remove conflicting reasoning_effort from payload#24120
gumadeiras merged 2 commits intoopenclaw:mainfrom
tenequm:fix/openrouter-reasoning-effort-conflict

Conversation

@tenequm
Copy link
Contributor

@tenequm tenequm commented Feb 23, 2026

Summary

  • Remove top-level reasoning_effort field from OpenRouter payloads before injecting the nested reasoning: { effort } format, preventing a 400 Only one of "reasoning" and "reasoning_effort" may be provided error

Fixes #24119

Problem

When using reasoning models via OpenRouter (e.g. MiniMax M2.5), two code paths independently inject reasoning parameters:

  1. pi-ai's buildParams() sets params.reasoning_effort (OpenAI flat format) when a model has reasoning: true
  2. OpenClaw's createOpenRouterWrapper() injects payload.reasoning = { effort } (OpenRouter nested format) via onPayload

Both fields end up in the final payload, which OpenRouter rejects.

This was introduced by the interaction between PR #17236 (added reasoning.effort injection) and PR #22513 (defaulted reasoning to on for reasoning: true models).

Solution

Delete the conflicting top-level reasoning_effort field in the onPayload hook before injecting the correct nested format. This is a single delete call, scoped to the OpenRouter wrapper only.

Test plan

  • Verify MiniMax M2.5 via OpenRouter responds without 400 errors
  • Verify other OpenRouter reasoning models (e.g. Claude, Grok) still work
  • Verify non-OpenRouter providers are unaffected (the delete is inside the OpenRouter-only wrapper)

🤖 Generated with Claude Code

Greptile Summary

Single-line fix in the OpenRouter onPayload hook that removes the top-level reasoning_effort field (set by pi-ai's buildParams()) before injecting the nested reasoning: { effort } format that OpenRouter expects. This prevents a 400 Only one of "reasoning" and "reasoning_effort" may be provided error for reasoning models (e.g. MiniMax M2.5) routed through OpenRouter.

  • The delete is correctly scoped: only runs inside createOpenRouterWrapper and only when thinkingLevel is truthy (i.e., when the nested format will be injected)
  • Non-OpenRouter providers are unaffected
  • No existing tests cover the OpenRouter reasoning injection path; a test would strengthen confidence but is not blocking

Confidence Score: 5/5

  • This PR is safe to merge — it's a minimal, well-scoped one-line fix isolated to the OpenRouter code path.
  • The change is a single delete call scoped entirely within the OpenRouter-only wrapper function. It only executes when thinkingLevel is set (the same condition under which the nested format is injected), and delete on a non-existent property is a safe no-op. Non-OpenRouter providers are completely unaffected. The comment clearly explains the rationale.
  • No files require special attention.

Last reviewed commit: a2c0cf3

(4/5) You can add custom instructions or style guidelines for the agent here!

@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: XS labels Feb 23, 2026
@gumadeiras gumadeiras self-assigned this Feb 23, 2026
@gumadeiras gumadeiras force-pushed the fix/openrouter-reasoning-effort-conflict branch from a2c0cf3 to 29fb038 Compare February 23, 2026 06:40
@gumadeiras gumadeiras force-pushed the fix/openrouter-reasoning-effort-conflict branch from 29fb038 to cc8ef4b Compare February 23, 2026 06:40
@gumadeiras gumadeiras merged commit ec1bc41 into openclaw:main Feb 23, 2026
19 of 20 checks passed
@gumadeiras
Copy link
Member

Merged via squash.

Thanks @tenequm!

ethvilet pushed a commit to ethvilet/openclaw that referenced this pull request Feb 23, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
@tenequm tenequm deleted the fix/openrouter-reasoning-effort-conflict branch February 23, 2026 10:22
jaydiamond42 pushed a commit to jaydiamond42/bloomtbot that referenced this pull request Feb 23, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
carlosrivera pushed a commit to myascendai/meshiclaw that referenced this pull request Feb 23, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
gabrielkoo pushed a commit to gabrielkoo/openclaw that referenced this pull request Feb 23, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
margulans pushed a commit to margulans/Neiron-AI-assistant that referenced this pull request Feb 25, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
brianleach pushed a commit to brianleach/openclaw that referenced this pull request Feb 26, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 26, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…enclaw#24120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cc8ef4b
Co-authored-by: tenequm <22403766+tenequm@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenRouter sends both reasoning and reasoning_effort, causing 400 for reasoning models

2 participants