diff --git a/internal/gateway/chat.go b/internal/gateway/chat.go index 3a0759b82..7edff257c 100644 --- a/internal/gateway/chat.go +++ b/internal/gateway/chat.go @@ -331,7 +331,8 @@ func buildChat(r *Request, model, host string, rejectTemp bool) []byte { // interleaved thinking): the decoder takes it out as thinking (#1267), // so it goes back in where it came from. A relay serving MiniMax's // models may give the thinking apart and take it back otherwise. - inlineThink := strings.HasSuffix(host, "minimax.io") || strings.HasSuffix(host, "minimaxi.com") + // api.minimax.cn is MiniMax China's host beside api.minimaxi.com. + inlineThink := strings.HasSuffix(host, "minimax.io") || strings.HasSuffix(host, "minimaxi.com") || strings.HasSuffix(host, "minimax.cn") // Gemini wants each step's thought signature back on its first call // (#687), and one it can't check for a step it didn't sign gemini := geminiCompat(host, model) diff --git a/internal/gateway/minimax_think_test.go b/internal/gateway/minimax_think_test.go index f6875a9cf..e1eacc50a 100644 --- a/internal/gateway/minimax_think_test.go +++ b/internal/gateway/minimax_think_test.go @@ -88,6 +88,7 @@ func TestMiniMaxThinkingGoesBackInTags(t *testing.T) { for _, c := range []struct{ model, host, want string }{ {"MiniMax-M2.7", "api.minimax.io", "\nThe user greets me.\n\n\nHello!"}, {"MiniMax-M2.7", "api.minimaxi.com", "\nThe user greets me.\n\n\nHello!"}, + {"MiniMax-M2.7", "api.minimax.cn", "\nThe user greets me.\n\n\nHello!"}, {"minimax/minimax-m3", "openrouter.ai", "Hello!"}, {"kimi-k3", "api.moonshot.cn", "Hello!"}, } { diff --git a/internal/provider/planquota.go b/internal/provider/planquota.go index ea512a32f..edb6c9689 100644 --- a/internal/provider/planquota.go +++ b/internal/provider/planquota.go @@ -57,9 +57,12 @@ func planQuotaSourceOf(p Provider) (planQuotaSource, bool) { // preset too, and is told the plan's 5-hour and weekly windows; // a pay-as-you-go key has none, and no card return planQuotaSource{"https://api.commandcode.ai/alpha/billing/credits", true, readCommandCodePlan, false}, true - case "api.minimaxi.com", "api.minimax.io": + case "api.minimaxi.com", "api.minimax.cn", "api.minimax.io": // a Coding Plan key (sk-cp-…) is told its windows; a - // pay-as-you-go key isn't, and gets no card (#387) + // pay-as-you-go key isn't, and gets no card (#387). + // api.minimax.cn is MiniMax China's host since mmx-cli + // 8746d48f (2026-09-28), beside api.minimaxi.com, and + // answers the same query return planQuotaSource{"https://" + hostOf(base) + "/v1/token_plan/remains", true, readMiniMaxPlan, false}, true case "ollama.com": // Ollama Cloud's included allowance (#1888); a key with none diff --git a/internal/provider/planquota_test.go b/internal/provider/planquota_test.go index 42ed88a2c..d3ade2a4d 100644 --- a/internal/provider/planquota_test.go +++ b/internal/provider/planquota_test.go @@ -40,6 +40,8 @@ func TestPlanQuotaSource(t *testing.T) { {Provider{Chat: "https://api.commandcode.ai/provider/v1", Anthropic: "https://api.commandcode.ai/provider"}, "https://api.commandcode.ai/alpha/billing/credits", true, false}, {Provider{Chat: "https://api.minimaxi.com/v1", Anthropic: "https://api.minimaxi.com/anthropic"}, "https://api.minimaxi.com/v1/token_plan/remains", true, false}, {Provider{Anthropic: "https://api.minimax.io/anthropic"}, "https://api.minimax.io/v1/token_plan/remains", true, false}, + // MiniMax China's host since mmx-cli 8746d48f + {Provider{Chat: "https://api.minimax.cn/v1", Anthropic: "https://api.minimax.cn/anthropic"}, "https://api.minimax.cn/v1/token_plan/remains", true, false}, {Provider{Chat: "https://api.deepseek.com"}, "", false, false}, {Provider{Chat: "https://ollama.com/v1", Anthropic: "https://ollama.com"}, "https://ollama.com/api/balance", true, false}, {Provider{Chat: "http://localhost:11434/v1"}, "", false, false}, // a local Ollama