Skip to content

feat(auth): add minimax-cn-oauth provider + migrate to OAuth2 endpoints + dedicated client_id#25581

Closed
kapelame wants to merge 1 commit into
NousResearch:mainfrom
kapelame:feat/minimax-cn-oauth-and-dedicated-client-id
Closed

feat(auth): add minimax-cn-oauth provider + migrate to OAuth2 endpoints + dedicated client_id#25581
kapelame wants to merge 1 commit into
NousResearch:mainfrom
kapelame:feat/minimax-cn-oauth-and-dedicated-client-id

Conversation

@kapelame

@kapelame kapelame commented May 14, 2026

Copy link
Copy Markdown

Closes #25542

Summary

Two related changes:

  1. Add 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).
  2. Migrate 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 old endpoints still respond, but account/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:

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

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 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.

What changes

File Change
hermes_cli/auth.py Endpoint migration (5 constants + 3 endpoint URL strings + 1 removed response_type param). New minimax-cn-oauth ProviderConfig in PROVIDER_REGISTRY. MINIMAX_OAUTH_CLIENT_ID updated to dedicated Hermes id
plugins/model-providers/minimax/__init__.py New minimax_cn_oauth ProviderProfile mirroring minimax_oauth with CN URLs
hermes_cli/auth_commands.py Adds minimax-cn-oauth to _OAUTH_CAPABLE_PROVIDERS set + the inline duplicate at line 173. New if provider == "minimax-cn-oauth": block routes to _minimax_oauth_login(region="cn")
hermes_cli/runtime_provider.py Parallel elif/if blocks for the new provider in both api_mode pinning and the runtime credential resolver
hermes_cli/models.py Picker entry: ProviderEntry("minimax-cn-oauth", "MiniMax China (OAuth)", ...) as the 4th MiniMax row
hermes_cli/providers.py Overlay entry for minimax-cn-oauth
tests/test_minimax_oauth.py +1 test verifying the new ProviderConfig is registered with CN URLs; updates one endpoint-path assertion to the new path
website/docs/guides/minimax-oauth.md "China region" section rewritten to point at the new provider id

Trade-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 pass
  • Live POST account.minimax.io/oauth2/device/code (and account.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.
  • Local end-to-end OAuth login flow on the CN provider before the endpoint migration also worked, confirming the dedicated client_id + the old endpoints work too — the migration is for canonical alignment, not because the old endpoints are broken.

@kapelame
kapelame force-pushed the feat/minimax-cn-oauth-and-dedicated-client-id branch 2 times, most recently from 13ae4f1 to 2da27b6 Compare May 14, 2026 09:36
@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins area/auth Authentication, OAuth, credential pools provider/minimax MiniMax (Anthropic transport) P3 Low — cosmetic, nice to have labels May 14, 2026
…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
kapelame force-pushed the feat/minimax-cn-oauth-and-dedicated-client-id branch from 2da27b6 to a2a139a Compare May 14, 2026 12:26
@kapelame kapelame changed the title feat(auth): add minimax-cn-oauth provider + dedicated Hermes client_id feat(auth): add minimax-cn-oauth provider + migrate to OAuth2 endpoints + dedicated client_id May 14, 2026
@discolotus

Copy link
Copy Markdown

Tracked follow-up technical debt from this PR:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have provider/minimax MiniMax (Anthropic transport) type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add China-region (minimax-cn) OAuth provider — code already supports it, but not exposed

3 participants