Skip to content

fix(provider/minimax): JCODE_MINIMAX_REGION override for global sk-cp- keys#237

Merged
quangdang46 merged 1 commit into
masterfrom
fix/minimax-global-region-override
May 23, 2026
Merged

fix(provider/minimax): JCODE_MINIMAX_REGION override for global sk-cp- keys#237
quangdang46 merged 1 commit into
masterfrom
fix/minimax-global-region-override

Conversation

@quangdang46
Copy link
Copy Markdown
Owner

What

MiniMax's global console started issuing sk-cp--prefixed API keys in 2026 Q2, but jcode auto-routes any sk-cp- key to the China endpoint (api.minimaxi.com) per the heuristic added in commit 1f66945c. Result: global users get invalid api key (2049) 401s.

Fix

Adds JCODE_MINIMAX_REGION env var override:

Value Effect
global / international / io force api.minimax.io (catalog default)
china / cn / minimaxi force api.minimaxi.com
invalid value falls through to prefix heuristic + logs warning
unset existing prefix heuristic (no behavior change)

Aliases are case-insensitive + whitespace-trimmed.

Verified live

$ JCODE_MINIMAX_REGION=global jcode --provider minimax run "..."
PONG    # real model response from MiniMax-M2.7 via api.minimax.io

Tests

$ cargo test -p jcode --lib provider_catalog_tests::minimax
test result: ok. 6 passed; 0 failed

5 new tests:

  • global override beats sk-cp- → China heuristic
  • china override routes even without sk-cp- prefix
  • invalid value falls through to prefix heuristic (back-compat)
  • alias matrix (global/international/io/CHINA/cn/minimaxi)
  • existing 2 China-region tests still pass

Refs upstream issue #176 follow-up.

…- keys

MiniMax's global console started issuing sk-cp-prefixed API keys in
2026 Q2, but jcode auto-routes any sk-cp- key to the China endpoint
(api.minimaxi.com) per the heuristic added in commit 1f66945.
Result: global users get 'invalid api key (2049)' 401s.

Adds JCODE_MINIMAX_REGION env var override:

  JCODE_MINIMAX_REGION=global   → force api.minimax.io (catalog default)
  JCODE_MINIMAX_REGION=china    → force api.minimaxi.com
  Aliases: international/io/cn/minimaxi (case-insensitive, trimmed)
  Invalid value → falls through to prefix heuristic (warning logged)
  Unset → existing prefix heuristic (no behavior change)

Verified with a real global sk-cp- key:
  $ JCODE_MINIMAX_REGION=global jcode --provider minimax run "..."
  → real model response, no 401.

5 new tests covering global override, china override, invalid value
fall-through, and case-insensitive alias matching.

Refs upstream issue #176 follow-up.
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.

1 participant