Files
openclaw/extensions/openrouter/thinking-policy.ts
Sally O'Malley 02ac7dc5a6 fix(openrouter): keep DeepSeek V4 reasoning effort valid (#77423)
Summary:
- The PR removes `max` from OpenRouter DeepSeek V4 thinking profiles, maps stale OpenRouter `max` overrides to `xhigh`, preserves direct DeepSeek behavior, and updates docs, tests, and changelog.
- Reproducibility: yes. Source inspection on current main shows OpenRouter DeepSeek V4 advertises `max` and se ... ffort: "max"`, matching the linked 400 logs; I did not need a live OpenRouter request for this assist pass.

Automerge notes:
- Ran the ClawSweeper repair loop before final review.
- Addressed earlier ClawSweeper review findings before merge.
- Included post-review commit in the final squash: docs(changelog): credit OpenRouter duplicate fix
- Included post-review commit in the final squash: fix(openrouter): keep DeepSeek V4 reasoning effort valid

Validation:
- ClawSweeper review passed for head becdea4223.
- Required merge gates passed before the squash merge.

Prepared head SHA: becdea4223
Review: https://github.com/openclaw/openclaw/pull/77423#issuecomment-4372880583

Co-authored-by: sallyom <somalley@redhat.com>
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
2026-05-04 21:05:05 +00:00

35 lines
971 B
TypeScript

import type { ProviderThinkingProfile } from "openclaw/plugin-sdk/plugin-entry";
import { isOpenRouterDeepSeekV4ModelId } from "./models.js";
const OPENROUTER_DEEPSEEK_V4_THINKING_LEVEL_IDS = [
"off",
"minimal",
"low",
"medium",
"high",
"xhigh",
] as const;
function buildOpenRouterDeepSeekV4ThinkingLevel(
id: (typeof OPENROUTER_DEEPSEEK_V4_THINKING_LEVEL_IDS)[number],
) {
return { id };
}
const OPENROUTER_DEEPSEEK_V4_THINKING_PROFILE = {
levels: OPENROUTER_DEEPSEEK_V4_THINKING_LEVEL_IDS.map(buildOpenRouterDeepSeekV4ThinkingLevel),
defaultLevel: "high",
} satisfies ProviderThinkingProfile;
export function supportsOpenRouterXHighThinking(modelId: string): boolean {
return isOpenRouterDeepSeekV4ModelId(modelId);
}
export function resolveOpenRouterThinkingProfile(
modelId: string,
): ProviderThinkingProfile | undefined {
return isOpenRouterDeepSeekV4ModelId(modelId)
? OPENROUTER_DEEPSEEK_V4_THINKING_PROFILE
: undefined;
}