Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
fix(minimax): send metered keys to the international host by default
Jack Rudenko0177ca9b4531
diff --git a/README.md b/README.mdindex 3d7eec9a..636ac24b 100644--- a/README.md+++ b/README.md@@ -446,7 +446,7 @@ Every one of these also accepts `CUSTOM_<NAME>_KEY` as an alias, and any of them|----------|----------|---------|| `GEMINI_BASE_URL` | Gemini API | `https://generativelanguage.googleapis.com` || `OPENAI_BASE_URL` | OpenAI/Azure | `https://api.openai.com` |-| `MINIMAX_BASE_URL` | MiniMax | `https://api.minimaxi.com` |+| `MINIMAX_BASE_URL` | MiniMax | `https://api.minimax.io` (China-platform keys: `https://api.minimaxi.com`) || `MOONSHOT_BASE_URL` | Kimi/Moonshot | `https://api.moonshot.ai` || `ZHIPU_BASE_URL` | GLM/Zhipu | `https://open.bigmodel.cn` || `ZAI_BASE_URL` | Z.AI | `https://api.z.ai` |diff --git a/ai-docs/reports/PLAN_catalog_v3_reader-20260919.md b/ai-docs/reports/PLAN_catalog_v3_reader-20260919.mdindex 3b7404b7..aa7d3a8f 100644--- a/ai-docs/reports/PLAN_catalog_v3_reader-20260919.md+++ b/ai-docs/reports/PLAN_catalog_v3_reader-20260919.md@@ -137,7 +137,7 @@ Then release as 9.8.0 and tell the backend.- **Alibaba Coding Plan:** the key stored as `QWEN_CODING_PLAN_API_KEY` is the Token Plan key (both show `sk-••Cxg`); coding-intl answers `401 invalid access token`. Store the Coding Plan's own key.- **Alibaba PAYG:** the key is accepted by `dashscope-intl` but every model answers `"Model access denied."` (qwen3.7-plus, qwen3.8-max, qwen3.8-flash, qwen3.8-omni-flash); the China host rejects the key (403). Re-checked against the account's OWN list: `GET /compatible-mode/v1/models` returns 200 with 169 models, the catalog's `qwen/dashscope-direct` wire ids appear in it with the same spelling, and a chat request for an id taken from that list (`qwen-plus-character`) is also `403 Model.AccessDenied`. So the catalog data is not the cause on this evidence; the account's model permissions are (Model Studio activation or workspace access). Open until Jack confirms the account works in Alibaba's own console.- **Alibaba Coding Plan:** skipped by Jack's decision (not available on this account).-- **MiniMax metered, CORRECTED: claudish bug.** The old key failed on both hosts. Jack reset it, and the fresh key (`sk-••0EQ`) answers 200 on `api.minimax.io` for `GET /v1/models`, `/anthropic/v1/messages` and `/v1/chat/completions`, and `401 invalid api key (2049)` on `api.minimaxi.com` for all three. claudish fixes metered MiniMax to the China host (`b7173d2`, 2026-08-11), which was right for a China key and is wrong for an international one. The catalog publishes one profile, `minimax/direct-api`, with no region, so the host is claudish's choice. Fix options: (a) the host follows the key, found once by `GET /v1/models` on each host and kept in memory; (b) default to the international host, with `MINIMAX_BASE_URL` for China. Either way add `modelDiscovery` (`/v1/models` works), which metered MiniMax lacks today.+- **MiniMax metered, CORRECTED: claudish bug.** The old key failed on both hosts. Jack reset it, and the fresh key (`sk-••0EQ`) answers 200 on `api.minimax.io` for `GET /v1/models`, `/anthropic/v1/messages` and `/v1/chat/completions`, and `401 invalid api key (2049)` on `api.minimaxi.com` for all three. claudish fixes metered MiniMax to the China host (`b7173d2`, 2026-08-11), which was right for a China key and is wrong for an international one. The catalog publishes one profile, `minimax/direct-api`, with no region, so the host is claudish's choice. **Fixed** by Jack's choice (b): the default is the international host, a China-platform key sets `MINIMAX_BASE_URL=https://api.minimaxi.com`, and metered MiniMax now declares `modelDiscovery` (`/v1/models`). Jack's `~/.claudish/config.json` also pinned `endpoints.MINIMAX_BASE_URL` to the China host, which overrides both the default and the environment; it was removed with his approval (backup `config.json.bak-before-minimax-endpoint-20260919`). After that, the proxy probe for `minimax@MiniMax-M3` is `live`, and bare `minimax-m3` routes `mmc@MiniMax-M3 > zengo@minimax-m3 > mm@MiniMax-M3 > minimax/minimax-m3`.**Local servers, measured**diff --git a/docs/settings-reference.md b/docs/settings-reference.mdindex d239fb7e..1c594988 100644--- a/docs/settings-reference.md+++ b/docs/settings-reference.md@@ -194,7 +194,7 @@ Claudish automatically loads `.env` from the current working directory at startu| `OPENROUTER_API_KEY` | OpenRouter (default backend / universal fallback) | | https://openrouter.ai/keys || `GEMINI_API_KEY` | Google Gemini direct API (`g@`, `google@`) | | https://aistudio.google.com/app/apikey || `OPENAI_API_KEY` | OpenAI direct API (`oai@`) | | https://platform.openai.com/api-keys |-| `MINIMAX_API_KEY` | MiniMax (`mm@`, `mmax@`) | | https://www.minimaxi.com/ |+| `MINIMAX_API_KEY` | MiniMax (`mm@`, `mmax@`) | | https://platform.minimax.io/user-center/basic-information/interface-key (China platform: https://www.minimaxi.com/, and set `MINIMAX_BASE_URL`) || `MINIMAX_CODING_API_KEY` | MiniMax Coding Plan (`mmc@`) | | https://platform.minimax.io/ || `MOONSHOT_API_KEY` | Kimi/Moonshot (`kimi@`, `moon@`) | `KIMI_API_KEY` | https://platform.moonshot.cn/ || `KIMI_CODING_API_KEY` | Kimi Coding Plan (`kc@`); also accepts OAuth via `claudish --kimi-login` | | https://kimi.com/code |@@ -249,7 +249,7 @@ Claudish automatically loads `.env` from the current working directory at startu|----------|----------|---------|| `GEMINI_BASE_URL` | Google Gemini API | `https://generativelanguage.googleapis.com` || `OPENAI_BASE_URL` | OpenAI API (also for Azure-compatible) | `https://api.openai.com` |-| `MINIMAX_BASE_URL` | MiniMax API | `https://api.minimaxi.com` |+| `MINIMAX_BASE_URL` | MiniMax API | `https://api.minimax.io`; set `https://api.minimaxi.com` for a China-platform key || `MINIMAX_CODING_BASE_URL` | MiniMax Coding Plan endpoint | `https://api.minimax.io` || `MOONSHOT_BASE_URL` | Kimi/Moonshot API | `https://api.moonshot.ai` || `KIMI_BASE_URL` | Alias for `MOONSHOT_BASE_URL` | |diff --git a/packages/cli/src/model-catalog.test.ts b/packages/cli/src/model-catalog.test.tsindex ca6bb123..683e2732 100644--- a/packages/cli/src/model-catalog.test.ts+++ b/packages/cli/src/model-catalog.test.ts@@ -26,13 +26,14 @@ import {lookupModelForProvider,searchCatalogModels,} from "./adapters/model-catalog.js";+import { getEffectiveBaseUrl, getProviderByName } from "./providers/provider-definitions.js";const MINIMAX_API_KEY = process.env.MINIMAX_CODING_API_KEY || process.env.MINIMAX_API_KEY;-const SKIP_REAL_API = !MINIMAX_API_KEY;-// Choose the host by key type because PAYG and coding are separate credential silos.-const MINIMAX_API_BASE = process.env.MINIMAX_CODING_API_KEY- ? "https://api.minimax.io/anthropic/v1/messages"- : "https://api.minimaxi.com/anthropic/v1/messages";+const SKIP_REAL_API = process.env.CLAUDISH_SKIP_LIVE_E2E === "1" || !MINIMAX_API_KEY;+const MINIMAX_PROVIDER = getProviderByName(+ process.env.MINIMAX_CODING_API_KEY ? "minimax-coding" : "minimax"+)!;+const MINIMAX_API_BASE = `${getEffectiveBaseUrl(MINIMAX_PROVIDER)}${MINIMAX_PROVIDER.apiPath}`;// ─── Mock slim-cache seeding ─────────────────────────────────────────────────diff --git a/packages/cli/src/providers/provider-definitions.test.ts b/packages/cli/src/providers/provider-definitions.test.tsindex 6cb3b394..46539c49 100644--- a/packages/cli/src/providers/provider-definitions.test.ts+++ b/packages/cli/src/providers/provider-definitions.test.ts@@ -490,16 +490,22 @@ describe("getApiKeyEnvVars", () => {// equivalence matrix in auth/credentials/equivalence.test.ts.describe("MiniMax credential silo endpoints", () => {- test("keeps PAYG and coding providers on their matching hosts", () => {- const payg = getProviderByName("minimax")!;+ test("defaults both MiniMax providers to the international platform and exposes metered discovery", () => {+ const metered = getProviderByName("minimax")!;const coding = getProviderByName("minimax-coding")!;- expect(payg.baseUrl).toBe("https://api.minimaxi.com");+ expect(metered.baseUrl).toBe("https://api.minimax.io");expect(coding.baseUrl).toBe("https://api.minimax.io");- // This is the actual regression guard: identical URLs sent PAYG keys to the coding host.- expect(payg.baseUrl).not.toBe(coding.baseUrl);- expect(payg.apiKeyUrl).toContain("minimaxi.com");- expect(payg.baseUrl).toContain("minimaxi.com");+ expect(metered.apiKeyUrl).toBe(+ "https://platform.minimax.io/user-center/basic-information/interface-key"+ );+ expect(new URL(metered.apiKeyUrl!).hostname).toBe("platform.minimax.io");+ expect(new URL(metered.baseUrl).hostname).toBe("api.minimax.io");+ expect(metered.baseUrlEnvVars).toContain("MINIMAX_BASE_URL");+ expect(metered.modelDiscovery).toEqual({+ path: "/v1/models",+ format: "openai-models-list",+ });});});diff --git a/packages/cli/src/providers/provider-definitions.ts b/packages/cli/src/providers/provider-definitions.tsindex 3ad167a0..10afde36 100644--- a/packages/cli/src/providers/provider-definitions.ts+++ b/packages/cli/src/providers/provider-definitions.ts@@ -551,20 +551,26 @@ export const BUILTIN_PROVIDERS: ProviderDefinition[] = [name: "minimax",displayName: "MiniMax",transport: "anthropic",- // NOT api.minimax.io — that host is the CODING PLAN's, and the two are- // separate credential silos rather than aliases of one service. Measured- // 2026-08-11 with a real coding key: api.minimax.io answers 200, while- // api.minimaxi.com answers 401 "invalid api key" for the same key. A PAYG- // key sent to minimax.io fails the same way in reverse, which is what- // `mm@`/`mmax@` did from here. `apiKeyUrl` below has always pointed at- // minimaxi.com, so this entry was telling users to fetch a key from one- // silo and then spending it against the other.- baseUrl: "https://api.minimaxi.com",+ // The two MiniMax hosts are REGIONS, and a key works only on the host of the+ // platform that issued it: api.minimax.io for the international platform+ // (platform.minimax.io), api.minimaxi.com for the China platform+ // (minimaxi.com). Metered and coding-plan keys follow the same rule.+ //+ // The default is the international host. Measured 2026-09-19 with a fresh+ // international metered key: api.minimax.io answered 200 on /v1/models,+ // /anthropic/v1/messages and /v1/chat/completions, and api.minimaxi.com+ // answered 401 "invalid api key (2049)" on all three. This entry pointed at+ // minimaxi.com from 2026-08-11 (b7173d2), so every international metered key+ // failed. A China-platform key needs MINIMAX_BASE_URL=https://api.minimaxi.com.+ // The catalog publishes one profile, `minimax/direct-api`, with no region, so+ // the host is claudish's choice rather than a contract value.+ baseUrl: "https://api.minimax.io",baseUrlEnvVars: ["MINIMAX_BASE_URL"],apiPath: "/anthropic/v1/messages",+ modelDiscovery: { path: "/v1/models", format: "openai-models-list" },apiKeyEnvVar: "MINIMAX_API_KEY",apiKeyDescription: "MiniMax API Key",- apiKeyUrl: "https://www.minimaxi.com/",+ apiKeyUrl: "https://platform.minimax.io/user-center/basic-information/interface-key",authScheme: "bearer",shortcuts: ["mm", "mmax"],shortestPrefix: "mm",diff --git a/packages/cli/src/providers/remote-provider-registry.ts b/packages/cli/src/providers/remote-provider-registry.tsindex 8b742ae8..4c9d4531 100644--- a/packages/cli/src/providers/remote-provider-registry.ts+++ b/packages/cli/src/providers/remote-provider-registry.ts@@ -138,7 +138,8 @@ export function validateRemoteProviderApiKey(provider: RemoteProvider): string |"export OPENAI_API_KEY='sk-...' (get from https://platform.openai.com/api-keys)",OPENROUTER_API_KEY:"export OPENROUTER_API_KEY='sk-or-...' (get from https://openrouter.ai/keys)",- MINIMAX_API_KEY: "export MINIMAX_API_KEY='your-key' (get from https://www.minimaxi.com/)",+ MINIMAX_API_KEY:+ "export MINIMAX_API_KEY='your-key' (get from https://platform.minimax.io/user-center/basic-information/interface-key; a China-platform key also needs MINIMAX_BASE_URL=https://api.minimaxi.com)",MINIMAX_CODING_API_KEY:"export MINIMAX_CODING_API_KEY='your-key' (get from https://platform.minimax.io/user-center/basic-information/interface-key)",MOONSHOT_API_KEY: