Skip to content

docs(provider): MiniMax dual-endpoint auto-switch + regression (#141)#176

Open
quangdang46 wants to merge 1 commit into
masterfrom
fix/minimax-china-endpoint
Open

docs(provider): MiniMax dual-endpoint auto-switch + regression (#141)#176
quangdang46 wants to merge 1 commit into
masterfrom
fix/minimax-china-endpoint

Conversation

@quangdang46
Copy link
Copy Markdown
Owner

What

Documents and pins down our forks dual-endpoint behavior for MiniMax,
which already addresses the underlying user complaint in
issue #141 (#141)
without the regression cost of upstreams approach.

Background

MiniMax operates two separate platforms:

Platform Endpoint API key style
International https://api.minimax.io/v1 normal
China Token Plan https://api.minimaxi.com/v1 sk-cp-...

Upstream PR 1jehuang#188 fixes the
reported 401 authorized_error for China Token Plan users by flipping
the default MINIMAX_PROFILE.api_base to the China URL.

This forks resolver
(apply_profile_key_based_endpoint_overrides in
crates/jcode-provider-metadata /
src/provider_catalog.rs) already auto-routes any sk-cp-* API key
to MINIMAX_CHINA_API_BASE without changing the default for
international users. Mechanically porting upstreams flip would
regress every non-sk-cp-* MiniMax user. So we deviate.

Changes

  • OAUTH.md: rewrite the MiniMax section to explicitly document
    both endpoints, the sk-cp-* auto-switch, and the matching docs
    URL for each platform. This is the user-visible piece that closes
    the gap behind the original 401 reports.
  • src/provider_catalog_tests.rs: add
    minimax_token_plan_keys_route_to_china_even_when_openai_api_key_env_is_international
    — pins down the exact failure scenario from the issue: an unrelated
    international OPENAI_API_KEY set in env must NOT pull the
    resolution back to .io when a real sk-cp-* key is the one being
    used.
  • MINIMAX_PROFILE defaults are intentionally unchanged.

Tests

$ cargo test -p jcode --lib provider_catalog_tests::minimax_
test result: ok. 2 passed; 0 failed; 0 ignored

The pre-existing
minimax_token_plan_keys_resolve_to_china_endpoint_without_changing_international_default
plus the new regression test together lock the contract.

Acceptance criteria

  • China Token Plan keys (sk-cp-...) hit api.minimaxi.com
    pinned by both tests.
  • International keys still hit api.minimax.io — pinned by the
    pre-existing test.
  • Unrelated OPENAI_API_KEY in env cannot poison the resolution
    — pinned by the new test.
  • User-facing docs (OAUTH.md) explain both endpoints and the
    auto-switch.

Notes / deviations from upstream

  • We do not flip MINIMAX_PROFILE.api_base from .io to .com.
    Upstream PR feat(tui/clipboard): multi-backend copy with OSC 52 fallback (#65) #188 makes that change unconditionally, which would
    break international users whose keys do not start with sk-cp-. Our
    fork already routes by key prefix, which is strictly more correct.
  • We do not rename api_key_env from OPENAI_API_KEY to
    MINIMAX_API_KEY here; that is a separate breaking change and
    should be its own PR if desired.

Refs upstream PR 1jehuang#188 by @richardiitse.

…n test

Issue #141 (upstream PR #188) reports that MiniMax China Token Plan
users get 401 authorized_error because the international endpoint is
hit with a Token Plan key. Upstream's fix flips the default
`api_base` from `api.minimax.io` to `api.minimaxi.com`.

Our fork already handles this differently and better: the resolver
(`apply_profile_key_based_endpoint_overrides`) auto-routes any
`sk-cp-*` API key to the China base URL (`MINIMAX_CHINA_API_BASE`)
without changing the default for international users. Mechanically
porting upstream's flip would regress everyone whose key does not
start with `sk-cp-`.

This change:
- Updates OAUTH.md MiniMax section to document the dual-endpoint
  behavior so users see exactly which base URL their key resolves to,
  and explicitly calls out that `sk-cp-...` keys auto-route to
  `api.minimaxi.com`.
- Adds a regression test
  `minimax_token_plan_keys_route_to_china_even_when_openai_api_key_env_is_international`
  that pins down the exact 401 scenario from the issue: an unrelated
  international `OPENAI_API_KEY` exported in env must NOT pull the
  resolution back to `.io` when a real `sk-cp-*` key is the one
  actually being used.

Defaults in `MINIMAX_PROFILE` are intentionally left unchanged.

Refs #141
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