Skip to content

DeepSeek V4 Pro on OpenRouter fails with 400 reasoning_effort: Invalid option (regression in 2026.5.3-1) #77350

Closed

Description

@krllagent

Summary

After upgrading to 2026.5.3-1, all OpenRouter requests for deepseek/deepseek-v4-pro fail with HTTP 400 from OpenRouter:

400 reasoning_effort: Invalid option: expected one of "xhigh"|"high"|"medium"|"low"|"minimal"|"none"

This happens regardless of agents.defaults.thinkingDefault — including xhigh (the value the new policy supposedly enables) and high (the previous default that worked on 2026.4.10).

high started failing immediately after the upgrade — meaning the gateway is now sending a value that's not in the user-facing config. My best guess: the new extensions/openrouter/thinking-policy.ts exposes an extra max level (added in 63ebe372e8 fix(openrouter): expose DeepSeek V4 xhigh thinking) which OpenRouter does not accept — and somewhere in the resolution chain xhigh/high get mapped to max for V4 Pro.

Repro

  1. npm install -g openclaw@2026.5.3-1
  2. openclaw.json:
    "agents": {
      "defaults": {
        "model": { "primary": "openrouter/deepseek/deepseek-v4-pro" },
        "thinkingDefault": "high"
      }
    }
  3. Restart gateway. Send any message to the agent.
  4. Embedded run fails with the 400 above.

Same with thinkingDefault: "xhigh". Switching to a non-DeepSeek model (or downgrading to 2026.4.10) makes it work again.

Expected

Gateway should send only reasoning_effort values OpenRouter accepts: xhigh|high|medium|low|minimal|none. Currently it appears to send max (or some V4-specific name), which is in the new internal policy but not in OpenRouter's API contract.

Logs

[agent/embedded] embedded run agent end: ... isError=true
  model=deepseek/deepseek-v4-pro provider=openrouter
  error=LLM request failed: provider rejected the request schema or tool payload.
  rawError=400 reasoning_effort: Invalid option: expected one of "xhigh"|"high"|"medium"|"low"|"minimal"|"none"
[agent/embedded] embedded run failover decision:
  decision=surface_error reason=format
  rawError=400 reasoning_effort: Invalid option: ...
[model-fallback/decision] decision=candidate_failed
  requested=openrouter/deepseek/deepseek-v4-pro
  reason=format next=none

Workaround

Stay on 2026.4.10 (where reasoning_replay was broken — fix e0221d37e5 was the upside of upgrading), or accept that V4 Pro currently hits 400 on every request in 2026.5.3-1 regardless of thinkingDefault.

Likely culprits

  • extensions/openrouter/thinking-policy.ts (introduced in 63ebe372e8) — advertises max level alongside xhigh
  • The wire-mapping that converts internal level → reasoning_effort for V4 Pro is probably picking max somewhere

Happy to test a patch.

Environment

  • OpenClaw 2026.5.3-1 (commit 2eae30e)
  • Provider: OpenRouter
  • Model: openrouter/deepseek/deepseek-v4-pro
  • Node 20.x, Linux (Ubuntu)

Activity

  1. balakhonoff commented on May 4, 2026

    @balakhonoff

    This is my agent's issue, I confirm it is a real issue, not spam

  2. clawsweeper commented on May 4, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.

    Summary
    Keep open: current main still exposes max for OpenRouter DeepSeek V4 thinking and the DeepSeek V4 payload wrapper can send reasoning_effort: "max", while OpenRouter documents xhigh, high, medium, low, minimal, and none as effort values. (openrouter.ai)

    Reproducibility: yes. source inspection gives a high-confidence reproduction path for the xhigh/max failure: the current wrapper emits reasoning_effort: "max" for OpenRouter DeepSeek V4 and an existing test asserts that payload. I did not establish a live-provider failing run from this checkout.

    Next step
    This is a narrow, source-reproducible provider regression with clear files and targeted tests, suitable for a focused repair PR.

    Review details

    Best possible solution:

    Keep this open and fix the OpenRouter-owned DeepSeek V4 thinking profile/wire mapping so OpenClaw only sends OpenRouter-accepted effort values while preserving reasoning replay compatibility.

    Do we have a high-confidence way to reproduce the issue?

    Yes, source inspection gives a high-confidence reproduction path for the xhigh/max failure: the current wrapper emits reasoning_effort: "max" for OpenRouter DeepSeek V4 and an existing test asserts that payload. I did not establish a live-provider failing run from this checkout.

    Is this the best way to solve the issue?

    Yes, the best fix is a narrow OpenRouter/DeepSeek V4 mapping correction plus regression tests for high and xhigh. Adding a new config knob or changing global thinking semantics would be broader than needed.

    Acceptance criteria:

    • pnpm test extensions/openrouter/index.test.ts src/plugin-sdk/provider-stream-shared.test.ts src/agents/pi-embedded-runner-extraparams-openrouter.test.ts src/auto-reply/thinking.test.ts
    • pnpm exec oxfmt --check --threads=1 extensions/openrouter/thinking-policy.ts extensions/openrouter/index.test.ts src/plugin-sdk/provider-stream-shared.ts src/plugin-sdk/provider-stream-shared.test.ts
    • pnpm check:changed

    What I checked:

    • Issue report and confirmation: The report includes a concrete OpenRouter 400 error for deepseek/deepseek-v4-pro after upgrading to 2026.5.3-1, and a follow-up comment says the agent issue is real.
    • Current thinking profile exposes max: OpenRouter DeepSeek V4 thinking levels currently include max alongside xhigh. (extensions/openrouter/thinking-policy.ts:4, 042d7b88230b)
    • Current wire mapping can emit max: The shared DeepSeek V4 wrapper maps xhigh or max to reasoning_effort: "max" and writes that field into the outgoing payload. (src/plugin-sdk/provider-stream-shared.ts:253, 042d7b88230b)
    • Existing regression test locks the bad payload: The OpenRouter provider test currently expects an xhigh DeepSeek V4 request to contain reasoning_effort: "max". (extensions/openrouter/index.test.ts:310, 042d7b88230b)
    • OpenRouter effort contract: OpenRouter's reasoning guide lists xhigh, high, medium, low, minimal, and none for effort values; it does not list max. (openrouter.ai)
    • Feature history: The issue-cited commit 63ebe372e8fb47b53fd049e11ed33352c62306f8 is fix(openrouter): expose DeepSeek V4 xhigh thinking; e0221d37e504157f42e5b637ec6c2fe4a58c4c58 is fix(openrouter): preserve deepseek v4 reasoning replay.

    Likely related people:

    • Peter Steinberger: Current blame for the OpenRouter DeepSeek V4 thinking profile and shared DeepSeek V4 payload wrapper points to the bundled-plugin shadow cleanup commit, and Peter also authored the recent DeepSeek V4 reasoning replay fix. (role: current-line owner and recent DeepSeek V4 maintainer; confidence: high; commits: b7ce9439e7f3, e0221d37e504; files: extensions/openrouter/thinking-policy.ts, src/plugin-sdk/provider-stream-shared.ts, extensions/openrouter/index.test.ts)
    • Vincent Koc: The issue identifies Vincent's commit as the change that exposed DeepSeek V4 xhigh thinking, which is the path now producing the invalid max effort. (role: introduced related xhigh behavior; confidence: medium; commits: 63ebe372e8fb; files: extensions/openrouter/thinking-policy.ts, extensions/openrouter/index.test.ts)
    • Robby: Earlier OpenRouter reasoning work introduced the generic reasoning.effort mapping used by the OpenRouter wrapper, which is adjacent to the DeepSeek V4-specific override. (role: adjacent OpenRouter reasoning owner; confidence: low; commits: 99cfb3dab26a; files: src/agents/pi-embedded-runner/proxy-stream-wrappers.ts, src/agents/pi-embedded-runner/reasoning-effort-utils.ts)

    Remaining risk / open question:

    • I did not live-call OpenRouter from this checkout; the reproduction is source-backed plus the reporter's upstream 400 log.
    • The source path directly proves xhigh/max can emit max; the report also says high fails, so a fix should add coverage for both configured high and xhigh before release.

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 042d7b88230b.

  3. self-assigned this
    on May 4, 2026
  4. locked as resolved and limited conversation to collaborators on May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions