From 65c2532cd502a57852deadcaa61fab08576f8225 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 10 Jan 2026 15:08:12 +0100 Subject: [PATCH] fix: minimax apiKey optional for providers (#656) (thanks @mneves75) --- AGENTS.md | 36 ---------------- CHANGELOG.md | 1 + patches/@mariozechner__pi-ai@0.42.1.patch | 13 ------ src/config/config.test.ts | 51 +++++++++++++++++++++++ src/config/zod-schema.ts | 2 +- 5 files changed, 53 insertions(+), 50 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index f8990778f..d7e3cc8aa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -115,39 +115,3 @@ EOF ``` This is a Claude Code quirk, not a clawdbot bug. - ---- - -## PR & Code Review Checklist - -Before creating PRs or presenting code for review (especially to senior engineers): - -### 1. Verify Code Quality -- [ ] Run `pnpm lint` - no errors -- [ ] Run `pnpm build` - TypeScript compiles -- [ ] Run related tests - all pass - -### 2. Review Diff Purity -- [ ] Diff is minimal and focused on the feature -- [ ] No unrelated changes bundled in -- [ ] Patch files: **append** changes, don't replace entire files - -### 3. Self-Critique Questions -- Is the auth resolution chain correct? -- Are type changes safe and backwards compatible? -- Would this pass review by John Carmack? (clarity > cleverness) - -### 4. Fork Workflow (when applicable) -```bash -# Push to fork -git remote add fork https://github.com/USERNAME/clawdbot -git push fork branch-name - -# Create PR from fork -gh pr create --head USERNAME:branch-name --base main -``` - -### 5. Git Diff Interpretation -- `-` lines = content being **removed** -- `+` lines = content being **added** -- Verify you understand what the diff actually shows diff --git a/CHANGELOG.md b/CHANGELOG.md index e7f72eded..399369fde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Onboarding/Gateway: persist non-interactive gateway token auth in config; add WS wizard + gateway tool-calling regression coverage. - CLI: `clawdbot sessions` now includes `elev:*` + `usage:*` flags in the table output. - Branding: normalize user-facing “ClawdBot”/“CLAWDBOT” → “Clawdbot” (CLI, status, docs). +- Models/Auth: allow MiniMax API configs without `models.providers.minimax.apiKey` (auth profiles / `MINIMAX_API_KEY`). (#656) — thanks @mneves75. ## 2026.1.9 diff --git a/patches/@mariozechner__pi-ai@0.42.1.patch b/patches/@mariozechner__pi-ai@0.42.1.patch index f268e0d4d..e4a1be4c1 100644 --- a/patches/@mariozechner__pi-ai@0.42.1.patch +++ b/patches/@mariozechner__pi-ai@0.42.1.patch @@ -55,16 +55,3 @@ index 20fb0a22aaa28f7ff7c2f44a8b628fa1d9d7d936..0bf46bfb4a6fac5a0304652e42566b2c const reasoningItem = JSON.parse(block.thinkingSignature); output.push(reasoningItem); } - -diff --git a/dist/stream.js b/dist/stream.js -index 0000000..2222222 100644 ---- a/dist/stream.js -+++ b/dist/stream.js -@@ -43,6 +43,7 @@ export function getEnvApiKey(provider) { - xai: "XAI_API_KEY", - openrouter: "OPENROUTER_API_KEY", - zai: "ZAI_API_KEY", -+ minimax: "MINIMAX_API_KEY", - mistral: "MISTRAL_API_KEY", - }; - const envVar = envMap[provider]; diff --git a/src/config/config.test.ts b/src/config/config.test.ts index 092c95bec..1670f4e9d 100644 --- a/src/config/config.test.ts +++ b/src/config/config.test.ts @@ -240,6 +240,57 @@ describe("config identity defaults", () => { }); }); + it("accepts blank model provider apiKey values", async () => { + await withTempHome(async (home) => { + const configDir = path.join(home, ".clawdbot"); + await fs.mkdir(configDir, { recursive: true }); + await fs.writeFile( + path.join(configDir, "clawdbot.json"), + JSON.stringify( + { + models: { + mode: "merge", + providers: { + minimax: { + baseUrl: "https://api.minimax.io/anthropic", + apiKey: "", + api: "anthropic-messages", + models: [ + { + id: "MiniMax-M2.1", + name: "MiniMax M2.1", + reasoning: false, + input: ["text"], + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 200000, + maxTokens: 8192, + }, + ], + }, + }, + }, + }, + null, + 2, + ), + "utf-8", + ); + + vi.resetModules(); + const { loadConfig } = await import("./config.js"); + const cfg = loadConfig(); + + expect(cfg.models?.providers?.minimax?.baseUrl).toBe( + "https://api.minimax.io/anthropic", + ); + }); + }); + it("respects empty responsePrefix to disable identity defaults", async () => { await withTempHome(async (home) => { const configDir = path.join(home, ".clawdbot"); diff --git a/src/config/zod-schema.ts b/src/config/zod-schema.ts index 99ae0f95a..39164e69f 100644 --- a/src/config/zod-schema.ts +++ b/src/config/zod-schema.ts @@ -40,7 +40,7 @@ const ModelDefinitionSchema = z.object({ const ModelProviderSchema = z.object({ baseUrl: z.string().min(1), - apiKey: z.string().min(1).optional(), + apiKey: z.string().optional(), api: ModelApiSchema.optional(), headers: z.record(z.string(), z.string()).optional(), authHeader: z.boolean().optional(),