1jehuang / 1jehuang/jcode

MiniMax Token Plan (Plus) keys fail with 401 - broken China endpoint auto-detection

Open Beginner friendly
#597 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug from-pr priority: medium triage: needs-decision
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

  1. Get a MiniMax Token Plan (Plus) subscription
  2. Configure jcode with the Plus plan API key
  3. Try to use MiniMax-M2.7 model
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.