Repository navigation
Description
Upstream tracking: QuantumNous/new-api#7522
Related upstream bug: QuantumNous/new-api#7508
What changed upstream
new-api found that Anthropic-native thinking.type=enabled + thinking.budget_tokens was being collapsed at high, so larger budgets could never produce xhigh or max. PR #7522 changes the shared budget→effort ladder to:
0→none<=1024→low<=8192→medium<16000→high<32000→xhigh>=32000→max
It also adjusts Gemini 2.5 high to a 12288 token budget so the effort↔budget round trip does not cross the new xhigh threshold.
Gap in api.lmm.best
main currently uses an older Claude Messages → OpenAI compatibility mapper in:
apps/api-go/relaykit/relayconvert/internal/claude_messages/to_oai_chat_req.go
Current behavior:
mapClaudeThinkingToReasoningEffort()mapsenabledbudgets only tolow/medium/high, with every budget above 3072 saturating athigh.mapClaudeReasoningEffortFromEffort()also explicitly downgradesxhightohigh.- The newer shared
relayconvert/reasoning.EffortFromBudgetimplementation changed by upstream does not exist in this fork yet, so #7522 cannot be cherry-picked cleanly.
That means Claude-format callers using larger manual-thinking budgets cannot express stronger reasoning intent through LMM's GPT-compatibility path.
Why not copy #7522 directly yet
The upstream PR is still open, and the compatibility boundary differs here. In upstream issue #7508 the tested OpenAI-compatible provider accepts xhigh but rejects max; blindly emitting max for every >=32000 budget could turn requests that currently succeed as high into provider-side 400s. LMM also has an older converter where explicit xhigh is intentionally collapsed today, so the supported outbound effort set needs to be defined once instead of changing one helper in isolation.
Suggested LMM-native approach
- Introduce one small budget→effort helper for the Claude Messages → OpenAI compatibility path, using the upstream ladder as the semantic source of truth.
- Preserve
xhighwhen the target OpenAI-compatible path supports it instead of unconditionally collapsing it tohigh. - Gate or clamp
maxaccording to the actual outbound dialect/model capability; do not make a previously accepted request fail only because its budget crossed 32000. - Keep OpenRouter's native
reasoning.max_tokensbehavior unchanged. - Keep billing, model-price locks, groups,
/fast, OAuth restrictions, provider selection and administrator-assistant settings untouched.
Acceptance criteria
- Regression tests cover budget boundaries
0,1024,8192,8193,15999,16000,31999,32000,64000. - A supported GPT-compatible target can receive
xhighfrom sufficiently large Claudebudget_tokens. maxis emitted only when the target path declares/supports it; otherwise behavior is explicitly clamped/fallback-tested rather than failing silently or producing an upstream 400.- Explicit
output_config.effortand inferredthinking.budget_tokensfollow the same capability policy. - Existing low/medium/high mappings, OpenRouter reasoning payloads, pricing/group/model-lock/fast/OAuth/custom assistant behavior remain unchanged.
go testpasses for the affected relaykit converter package.
Activity