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/src/commands/configure.ts b/src/commands/configure.ts index e7229c9ac..0c4780e80 100644 --- a/src/commands/configure.ts +++ b/src/commands/configure.ts @@ -70,6 +70,7 @@ import { healthCommand } from "./health.js"; import { formatHealthCheckFailure } from "./health-format.js"; import { applyAuthProfileConfig, + applyMinimaxApiConfig, applyMinimaxConfig, applyMinimaxHostedConfig, applyOpencodeZenConfig, @@ -369,6 +370,7 @@ async function promptAuthConfig( | "gemini-api-key" | "apiKey" | "minimax-cloud" + | "minimax-api" | "minimax" | "opencode-zen" | "skip"; @@ -788,6 +790,21 @@ async function promptAuthConfig( next = applyMinimaxHostedConfig(next); } else if (authChoice === "minimax") { next = applyMinimaxConfig(next); + } else if (authChoice === "minimax-api") { + const key = guardCancel( + await text({ + message: "Enter MiniMax API key", + validate: (value) => (value?.trim() ? undefined : "Required"), + }), + runtime, + ); + await setMinimaxApiKey(String(key).trim()); + next = applyAuthProfileConfig(next, { + profileId: "minimax:default", + provider: "minimax", + mode: "api_key", + }); + next = applyMinimaxApiConfig(next); } else if (authChoice === "opencode-zen") { note( [ diff --git a/src/commands/onboard-auth.ts b/src/commands/onboard-auth.ts index 303512c5a..43f16ac2a 100644 --- a/src/commands/onboard-auth.ts +++ b/src/commands/onboard-auth.ts @@ -336,7 +336,7 @@ export function applyMinimaxApiProviderConfig( const providers = { ...cfg.models?.providers }; providers.minimax = { baseUrl: MINIMAX_API_BASE_URL, - apiKey: "", // Resolved via MINIMAX_API_KEY env var or auth profile + // apiKey omitted: resolved via MINIMAX_API_KEY env var or auth profile by default. api: "anthropic-messages", models: [buildMinimaxApiModelDefinition(modelId)], }; 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/types.ts b/src/config/types.ts index c7c940f4a..dbac18a92 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -1201,7 +1201,7 @@ export type ModelDefinitionConfig = { export type ModelProviderConfig = { baseUrl: string; - apiKey: string; + apiKey?: string; api?: ModelApi; headers?: Record; authHeader?: boolean; diff --git a/src/config/zod-schema.ts b/src/config/zod-schema.ts index 3f07f7d96..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), + apiKey: z.string().optional(), api: ModelApiSchema.optional(), headers: z.record(z.string(), z.string()).optional(), authHeader: z.boolean().optional(),