fix: minimax apiKey optional for providers (#656) (thanks @mneves75)
This commit is contained in:
36
AGENTS.md
36
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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user