Skip to content

fix(aux-client): preserve /anthropic for MiniMax M-series auxiliary routes - #37183

Closed
gsurenull wants to merge 1 commit into
NousResearch:mainfrom
gsurenull:fix/17387-minimax-anthropic-preserve
Closed

fix(aux-client): preserve /anthropic for MiniMax M-series auxiliary routes#37183
gsurenull wants to merge 1 commit into
NousResearch:mainfrom
gsurenull:fix/17387-minimax-anthropic-preserve

Conversation

@gsurenull

Copy link
Copy Markdown

Summary

Fixes #17387.

Auxiliary tasks (title generation, compression, session_search, vision analysis, flush_memories, ...) for the built-in minimax, minimax-oauth, and minimax-cn providers were 404'ing because _to_openai_base_url rewrote https://api.minimaxi.com/anthropic -> https://api.minimaxi.com/v1 before handing the URL to the OpenAI SDK. M-series models on api.minimaxi.com and api.minimax.io do not expose a working /v1/chat/completions surface — they only speak Anthropic Messages on /anthropic/v1/messages.

Fix

Preserve the original /anthropic URL for MiniMax hosts and rely on the existing _maybe_wrap_anthropic chokepoint to detect the Anthropic-Messages shape via _endpoint_speaks_anthropic_messages and route through the Anthropic SDK. This mirrors the named-custom api_mode=anthropic_messages path added in #15059 but covers the built-in provider profile path that was missed by that fix.

Scope

  • MiniMax hosts (api.minimaxi.com, api.minimax.io): preserved (new behaviour)
  • ZAI (open.bigmodel.cn): continues to rewrite to /api/paas/v4 (regression guard added)
  • Generic /anthropic URLs (LiteLLM proxies, etc.): continues to rewrite to /v1 (regression guard added)

Tests

  • 11/11 new assertions pass on the branch
  • 201 adjacent tests (test_auxiliary_named_custom_providers, test_auxiliary_client) pass with no regressions
  • New TestEndToEndAnthropicRouting covers the full chain: preserved URL is still recognised by _endpoint_speaks_anthropic_messages so calls land on Anthropic SDK wire, not OpenAI wire

Diff stat

agent/auxiliary_client.py                 | 30 ++++++++++----
tests/agent/test_minimax_auxiliary_url.py | 66 +++++++++++++++++++++++--------
2 files changed, 72 insertions(+), 24 deletions(-)

…outes (#17387)

Auxiliary tasks (title generation, compression, session_search, vision
analysis, flush_memories, …) for the built-in `minimax`, `minimax-oauth`,
and `minimax-cn` providers were 404'ing because `_to_openai_base_url`
rewrote `https://api.minimaxi.com/anthropic` → `https://api.minimaxi.com/v1`
before handing the URL to the OpenAI SDK.  The M-series models on
`api.minimaxi.com` and `api.minimax.io` do not expose a working
`/v1/chat/completions` surface — they only speak Anthropic Messages
on `/anthropic/v1/messages`.

The fix preserves the original `/anthropic` URL for MiniMax hosts and
relies on the existing `_maybe_wrap_anthropic` chokepoint to detect
the Anthropic-Messages shape via `_endpoint_speaks_anthropic_messages`
and route through the Anthropic SDK.  This mirrors the named-custom
`api_mode=anthropic_messages` path added in #15059 but covers the
built-in provider profile path that was missed by that fix.

Other `/anthropic` hosts (ZAI, LiteLLM proxies, generic /anthropic
URLs) are unaffected — the ZAI branch continues to rewrite to
`/api/paas/v4` and the generic fallback continues to rewrite to `/v1`.

Tests:
- Renames the previous `_anthropic_suffix_replaced` assertions to
  `_anthropic_suffix_preserved` to reflect the new behaviour.
- Adds regression guards for the ZAI branch and the generic /anthropic
  fallback so the new MiniMax exception does not accidentally swallow
  them.
- Adds `TestEndToEndAnthropicRouting` covering the full chain: the
  preserved URL is still recognised by `_endpoint_speaks_anthropic_messages`
  so the call ends up on the Anthropic SDK wire, not the OpenAI wire.

Fixes #17387
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/minimax MiniMax (Anthropic transport) P3 Low — cosmetic, nice to have labels Jun 2, 2026
@gsurenull gsurenull closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have provider/minimax MiniMax (Anthropic transport) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: use /anthropic endpoint for MiniMax-CN auxiliary tasks

2 participants