fix: resolve MiniMax 401 auth error by defaulting to anthropic_messages#2103
Merged
fix: resolve MiniMax 401 auth error by defaulting to anthropic_messages#2103
Conversation
MiniMax's default base URL was /v1 which caused runtime_provider to default to chat_completions mode (OpenAI-style Authorization: Bearer header). MiniMax rejects this with a 401 because they require the Anthropic-style x-api-key header. Changes: - auth.py: Change default inference_base_url for minimax and minimax-cn from /v1 to /anthropic - runtime_provider.py: Auto-correct stale /v1 URLs from existing .env files to /anthropic, and always default minimax/minimax-cn providers to anthropic_messages mode - Update tests to reflect new defaults, add tests for stale URL auto-correction and explicit api_mode override Based on PR #2100 by @devorun. Fixes #2094.
23 tasks
outsourc-e
pushed a commit
to outsourc-e/hermes-agent
that referenced
this pull request
Mar 26, 2026
…es (NousResearch#2103) MiniMax's default base URL was /v1 which caused runtime_provider to default to chat_completions mode (OpenAI-style Authorization: Bearer header). MiniMax rejects this with a 401 because they require the Anthropic-style x-api-key header. Changes: - auth.py: Change default inference_base_url for minimax and minimax-cn from /v1 to /anthropic - runtime_provider.py: Auto-correct stale /v1 URLs from existing .env files to /anthropic, and always default minimax/minimax-cn providers to anthropic_messages mode - Update tests to reflect new defaults, add tests for stale URL auto-correction and explicit api_mode override Based on PR NousResearch#2100 by @devorun. Fixes NousResearch#2094. Co-authored-by: Test <test@test.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2094. Salvages PR #2100 by @devorun with additional root-cause fixes.
MiniMax's default
inference_base_urlinauth.pywas/v1, which caused the runtime provider to default tochat_completionsmode (OpenAI-styleAuthorization: Bearerheader). MiniMax rejects this with a 401 because they require the Anthropic-stylex-api-keyheader.Root cause
The original MiniMax → Anthropic URL switch (commit 3ea53b8 from PR #1623) never landed on
main. The runtime_provider infrastructure for Anthropic-compatible endpoints was added in PR #1997, but the actual MiniMax defaults remained on the broken/v1path.Changes
hermes_cli/auth.py— Change defaultinference_base_urlforminimaxandminimax-cnfrom/v1to/anthropic(root cause fix for new users)hermes_cli/runtime_provider.py— Auto-detectminimax/minimax-cnproviders and default toanthropic_messagesmode; auto-correct stale/v1URLs from existing.envfiles to/anthropic(fixes existing users)/v1auto-correction (both minimax and minimax-cn), and explicitapi_modeoverride respectedTest plan