feat(auth): add minimax-cn-oauth provider + migrate to OAuth2 endpoints + dedicated client_id#25581
Closed
kapelame wants to merge 1 commit into
Closed
Conversation
kapelame
force-pushed
the
feat/minimax-cn-oauth-and-dedicated-client-id
branch
2 times, most recently
from
May 14, 2026 09:36
13ae4f1 to
2da27b6
Compare
…ts + dedicated client_id Adds China-region OAuth as a separate picker entry so users on the minimaxi.com platform can sign in via browser without copying an API key. Closes the gap where docs claimed `minimax-cn` supported OAuth but the registered provider was api_key only (#25542). Also migrates the MiniMax OAuth helpers from the OpenClaw-shared `api.{minimax.io,minimaxi.com}/oauth/*` endpoints to the canonical `account.{minimax.io,minimaxi.com}/oauth2/*` endpoints — same set that mmx-cli and the opencode `minimax-coding-plan` plugin already target. The `api/oauth/*` endpoints still work but are an older surface; aligning on `account/oauth2/*` matches what MiniMax platform team treats as canonical going forward. Endpoint migration (verified live: both global + CN return HTTP 200 with valid user_code + verification_uri for the dedicated Hermes client_id): | | Before | After | |---|---|---| | Global base | `https://api.minimax.io` | `https://account.minimax.io` | | CN base | `https://api.minimaxi.com` | `https://account.minimaxi.com` | | Device code | `{base}/oauth/code` | `{base}/oauth2/device/code` | | Token | `{base}/oauth/token` | `{base}/oauth2/token` | | Grant type | `…:grant-type:user_code` | `…:grant-type:device_code` (RFC 8628) | | Scope | `group_id profile model.completion` | `openid profile coding_plan` | | Extra param | `response_type: "code"` (sent in body) | (removed — new endpoint doesn't expect it) | Approach for the new CN provider entry mirrors the existing `_minimax_oauth_login(region="cn", ...)` code path that was already in tree but never exposed. Storage and runtime resolution stay on the existing `minimax-oauth` auth.json slot (region recorded inside the entry) — no refactor of helper signatures, no new alias dispatch. Each new branch follows the surrounding parallel-block style (separate `if provider == "..."` blocks rather than collapsing with the existing `minimax-oauth` branch) — keeps the diff easy to grep and revert. Changes ------- - Plugin profile + ProviderConfig + Overlay + ProviderEntry for `minimax-cn-oauth`, mirroring `minimax-oauth` but with CN URLs. - `auth_commands.py`: adds `minimax-cn-oauth` to the `_OAUTH_CAPABLE_PROVIDERS` set (so `hermes auth add` defaults to OAuth) and to the inline duplicate at line 173 (matching existing intent). New `if provider == "minimax-cn-oauth":` block routes to `_minimax_oauth_login(region="cn")`. - `runtime_provider.py`: parallel `elif`/`if` blocks for the new provider in both `_resolve_provider_config` (api_mode pinning) and the runtime credential resolver. - `models.py` adds the picker entry as the 4th MiniMax row. - Docs: "China region" section in `minimax-oauth.md` rewritten to point at the new provider id. Trade-off --------- Switching between the global and China OAuth picker entries triggers a fresh login (OAuth tokens live in the same auth.json slot — last login wins, region is recorded inside). Users who need both regions logged in concurrently would benefit from a follow-up that splits storage by region; this PR keeps the change surface minimal. Client ID --------- Switches from the previously shared OpenClaw client_id (`78257093-...`) to a dedicated Hermes one (`62a38dcb-17d9-4303-a71e-aa694efa20fd`) registered with MiniMax specifically for this integration on the new OAuth2 backend. Verified live: returns HTTP 200 with valid user_code from both `account.minimax.io/oauth2/device/code` and `account.minimaxi.com/oauth2/device/code`. Existing logged-in users may need to re-authenticate once after upgrade since the new client_id (and new endpoint) sees fresh OAuth grants. Tests ----- `tests/test_minimax_oauth.py` adds 1 test verifying the new ProviderConfig is registered with the CN portal/inference URLs, and updates one endpoint-path assertion. All 78 relevant tests pass.
kapelame
force-pushed
the
feat/minimax-cn-oauth-and-dedicated-client-id
branch
from
May 14, 2026 12:26
2da27b6 to
a2a139a
Compare
|
Tracked follow-up technical debt from this PR:
|
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.
Closes #25542
Summary
Two related changes:
minimaxi.complatform can sign in via browser without copying an API key (closes the gap where docs claimedminimax-cnsupported OAuth but the registered provider was api_key only).api.{minimax.io,minimaxi.com}/oauth/*endpoints to the canonicalaccount.{minimax.io,minimaxi.com}/oauth2/*endpoints — same set that mmx-cli and the opencodeminimax-coding-planplugin already target. The old endpoints still respond, butaccount/oauth2/*is what MiniMax platform team treats as canonical going forward.Also switches Hermes from the OpenClaw-shared client_id to its own dedicated one (registered against the new OAuth2 backend specifically for this integration).
Endpoint migration (verified live)
Both global + CN return HTTP 200 with valid user_code + verification_uri for the dedicated Hermes client_id:
https://api.minimax.iohttps://account.minimax.iohttps://api.minimaxi.comhttps://account.minimaxi.com{base}/oauth/code{base}/oauth2/device/code{base}/oauth/token{base}/oauth2/token…:grant-type:user_code…:grant-type:device_code(RFC 8628)group_id profile model.completionopenid profile coding_planresponse_type: "code"(sent in body)Approach
Mirrors the existing
_minimax_oauth_login(region="cn", ...)code path that was already in tree but never exposed as a provider. Storage and runtime resolution stay on the existingminimax-oauthauth.json slot (region recorded inside the entry) — no refactor of helper signatures, no new alias dispatch.Each new branch follows the surrounding parallel-block style (separate
if provider == "..."blocks rather than collapsing with the existingminimax-oauthbranch) — keeps the diff easy to grep and revert.What changes
hermes_cli/auth.pyresponse_typeparam). Newminimax-cn-oauthProviderConfig in PROVIDER_REGISTRY.MINIMAX_OAUTH_CLIENT_IDupdated to dedicated Hermes idplugins/model-providers/minimax/__init__.pyminimax_cn_oauthProviderProfile mirroringminimax_oauthwith CN URLshermes_cli/auth_commands.pyminimax-cn-oauthto_OAUTH_CAPABLE_PROVIDERSset + the inline duplicate at line 173. Newif provider == "minimax-cn-oauth":block routes to_minimax_oauth_login(region="cn")hermes_cli/runtime_provider.pyelif/ifblocks for the new provider in both api_mode pinning and the runtime credential resolverhermes_cli/models.pyProviderEntry("minimax-cn-oauth", "MiniMax China (OAuth)", ...)as the 4th MiniMax rowhermes_cli/providers.pyminimax-cn-oauthtests/test_minimax_oauth.pywebsite/docs/guides/minimax-oauth.mdTrade-off
Switching between the global and China OAuth picker entries triggers a fresh login (the OAuth tokens live in the same auth.json slot — last login wins, region is recorded inside). Users who need both regions logged in concurrently would benefit from a follow-up that splits storage by region; this PR keeps the change surface minimal.
Client ID
Switches from the previously shared OpenClaw client_id (
78257093-...) to a dedicated Hermes one (62a38dcb-17d9-4303-a71e-aa694efa20fd) registered with MiniMax specifically for this integration on the new OAuth2 backend.How verified
pytest tests/test_minimax_oauth.py tests/providers/test_provider_profiles.py tests/hermes_cli/test_provider_config_validation.py→ 78/78 passPOST account.minimax.io/oauth2/device/code(andaccount.minimaxi.com/oauth2/device/code) with the dedicated client_id and new scope/PKCE → HTTP 200, valid user_code + verification_uri returned. Both regions confirmed registered.