Skip to content

fix(auth): use bearer auth for MiniMax Anthropic endpoints - #4028

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-ac2495d7
Mar 30, 2026
Merged

fix(auth): use bearer auth for MiniMax Anthropic endpoints#4028
teknium1 merged 1 commit into
mainfrom
hermes/hermes-ac2495d7

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #4002 by @kshitijk4poor onto current main.

Summary

MiniMax's /anthropic endpoints implement Anthropic's Messages API but require Authorization: Bearer instead of Anthropic's native x-api-key header. Without this fix, MiniMax users get 401 errors in gateway sessions.

Changes

  • Adds _requires_bearer_auth() to detect MiniMax global (api.minimax.io/anthropic) and China (api.minimaxi.com/anthropic) endpoints
  • Routes MiniMax through auth_token (Bearer) instead of api_key (x-api-key) in the Anthropic SDK
  • Check runs before OAuth token detection so MiniMax keys aren't misclassified as setup tokens
  • Native Anthropic auth behavior unchanged

Salvage fixes

  • Restored 3 existing test values corrupted by display-tool redaction artifacts in the original PR (*** and sk-ant... replacing valid mock keys)

Testing

  • 98/98 anthropic adapter tests pass
  • E2E verified: MiniMax → Bearer auth, native Anthropic → x-api-key, MiniMax non-sk-ant keys don't fall into OAuth path

Original PR: #4002 by @kshitijk4poor — cherry-picked with authorship preserved.

MiniMax's /anthropic endpoints implement Anthropic's Messages API but
require Authorization: Bearer instead of x-api-key. Without this fix,
MiniMax users get 401 errors in gateway sessions.

Adds _requires_bearer_auth() to detect MiniMax endpoints and route
through auth_token in the Anthropic SDK. Check runs before OAuth
token detection so MiniMax keys aren't misclassified as setup tokens.

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
bcross pushed a commit to bcross/hermes-agent that referenced this pull request Mar 30, 2026
…rch#4028)

MiniMax's /anthropic endpoints implement Anthropic's Messages API but
require Authorization: Bearer instead of x-api-key. Without this fix,
MiniMax users get 401 errors in gateway sessions.

Adds _requires_bearer_auth() to detect MiniMax endpoints and route
through auth_token in the Anthropic SDK. Check runs before OAuth
token detection so MiniMax keys aren't misclassified as setup tokens.

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
@teknium1
teknium1 merged commit 4b35836 into main Mar 30, 2026
2 of 3 checks passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…rch#4028)

MiniMax's /anthropic endpoints implement Anthropic's Messages API but
require Authorization: Bearer instead of x-api-key. Without this fix,
MiniMax users get 401 errors in gateway sessions.

Adds _requires_bearer_auth() to detect MiniMax endpoints and route
through auth_token in the Anthropic SDK. Check runs before OAuth
token detection so MiniMax keys aren't misclassified as setup tokens.

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…rch#4028)

MiniMax's /anthropic endpoints implement Anthropic's Messages API but
require Authorization: Bearer instead of x-api-key. Without this fix,
MiniMax users get 401 errors in gateway sessions.

Adds _requires_bearer_auth() to detect MiniMax endpoints and route
through auth_token in the Anthropic SDK. Check runs before OAuth
token detection so MiniMax keys aren't misclassified as setup tokens.

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
waym0reom3ga pushed a commit to waym0reom3ga/autolycus-agent that referenced this pull request May 8, 2026
…rch#4028)

MiniMax's /anthropic endpoints implement Anthropic's Messages API but
require Authorization: Bearer instead of x-api-key. Without this fix,
MiniMax users get 401 errors in gateway sessions.

Adds _requires_bearer_auth() to detect MiniMax endpoints and route
through auth_token in the Anthropic SDK. Check runs before OAuth
token detection so MiniMax keys aren't misclassified as setup tokens.

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
waym0reom3ga pushed a commit to waym0reom3ga/autolycus-agent that referenced this pull request May 8, 2026
…rch#4028)

MiniMax's /anthropic endpoints implement Anthropic's Messages API but
require Authorization: Bearer instead of x-api-key. Without this fix,
MiniMax users get 401 errors in gateway sessions.

Adds _requires_bearer_auth() to detect MiniMax endpoints and route
through auth_token in the Anthropic SDK. Check runs before OAuth
token detection so MiniMax keys aren't misclassified as setup tokens.

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…rch#4028)

MiniMax's /anthropic endpoints implement Anthropic's Messages API but
require Authorization: Bearer instead of x-api-key. Without this fix,
MiniMax users get 401 errors in gateway sessions.

Adds _requires_bearer_auth() to detect MiniMax endpoints and route
through auth_token in the Anthropic SDK. Check runs before OAuth
token detection so MiniMax keys aren't misclassified as setup tokens.

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants