Files
magpie/internal
yetone f6e7214af7 minimax: api.minimax.cn is MiniMax China, for the usage card and the thinking sent back
MiniMax moved its China API host to api.minimax.cn (MiniMax-AI/cli
8746d48f, 2026-09-28: mmx agent setup now writes it into Claude Code,
Codex, OpenCode and pi). api.minimaxi.com still answers, but a provider
pointed at the new host got no usage card, because the plan-quota source
knew only api.minimaxi.com and api.minimax.io. Chat requests to it also
lost the <think> block MiniMax wants back on the turns after.

Every place in magpie that matches MiniMax by host is covered:
- planquota.go: api.minimax.cn reads /v1/token_plan/remains on its own
  host. Probed without a key, api.minimax.cn answers this path with the
  same base_resp 1004 as api.minimaxi.com.
- gateway/chat.go: inlineThink also matches minimax.cn.
Pricing and the catalog go by the provider's Catalog id ("minimax"),
not by host, so nothing changes there. The presets keep api.minimaxi.com.

Tests: a TestPlanQuotaSource case and a TestMiniMaxThinkingGoesBackInTags
case for api.minimax.cn. Both are red on the old code (code reverted by
hand, test kept; mote-run) and green with the fix.

Run on mote (mote-run):
- At 96bfdd57c (base 11c427eaa): gofmt -l on the changed files prints
  nothing; GOOS=linux go vet -tags nogui ./... ok; GOOS=windows go vet
  ./... ok; go test -count=1 -timeout 45m ./...: 76 packages ok
  (internal/gateway 1073s, internal/provider 490s). internal/gui timed
  out at 45m, with TestRestartHandsTheGatewayOver stuck 43m in
  gateway stopAccepting during the handover at load ~110. That is not
  this change: filed as #4107 with the stacks.
- Rebased onto 425a61322 and run again at this head: TestPlanQuotaSource
  and TestMiniMaxThinkingGoesBackInTags pass; ./internal/provider ok;
  go vet (darwin), linux -tags nogui and windows vet ok;
  TestRestartHandsTheGatewayOver -count=5 ok.
Not tried: a real Coding Plan key against api.minimax.cn (I have none),
so the card on that host is checked only by the shape of the no-key reply.
2026-10-29 01:52:34 +08:00
..
…
…
…
…