MiniMax Token Plan (Plus) keys fail with 401 - broken China endpoint auto-detection
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Bug Description
MiniMax Token Plan (Plus/Max/Ultra) API keys start with sk-cp- prefix but work on the international endpoint (api.minimax.io), NOT the China endpoint (api.minimaxi.com).
The current auto-detection in jcode incorrectly routes sk-cp- keys to the China endpoint, causing 401 authentication errors.
Reproduction
- Get a MiniMax Token Plan (Plus) subscription
- Configure jcode with the Plus plan API key
- Try to use MiniMax-M2.7 model
- Get 401 Unauthorized error
Root Cause
In crates/jcode-base/src/provider_catalog.rs:
if key.trim_start().starts_with("sk-cp-") {
resolved.api_base = MINIMAX_CHINA_API_BASE.to_string(); // WRONG!
}
Fix
Remove the China auto-detection - Token Plan keys work on international endpoint. See PR: https://github.com/ChathurangaBW/jcode/pull/new/fix/minimax-token-plan-endpoint
Alternative: Add JCODE_MINIMAX_API_BASE env var override (already implemented in fix branch).
Verification
curl -X POST "https://api.minimax.io/v1/chat/completions" \
-H "Authorization: Bearer sk-cp-YOUR_TOKEN" \
-d '{"model": "MiniMax-M2.7", "messages": [{"role": "user", "content": "test"}]}'
Returns successful response on international endpoint.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in crates/jcode-base/src/provider_catalog.rs and inspect the MiniMax API-base resolution for keys beginning with sk-cp-. Use the curl verification request in the issue to confirm the international endpoint accepts the key; done means MiniMax Token Plan keys no longer route to the China endpoint and the documented request succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100