swarm-code 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interactive-swarm.js +26 -7
- package/package.json +1 -1
|
@@ -581,16 +581,35 @@ async function cmdConfigure(config, resolved, rl) {
|
|
|
581
581
|
out.write(`\n ${dim("Enter model ID (e.g. ollama/deepseek-coder-v2, anthropic/claude-sonnet-4-6, openrouter/auto)")}\n`);
|
|
582
582
|
const val = await ask(` ${coral(symbols.arrow)} New model [${displayModel}]: `);
|
|
583
583
|
if (val) {
|
|
584
|
-
// Check for
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
584
|
+
// Check for required API keys
|
|
585
|
+
const keyChecks = {
|
|
586
|
+
openrouter: { env: "OPENROUTER_API_KEY", url: "https://openrouter.ai/keys" },
|
|
587
|
+
openai: { env: "OPENAI_API_KEY", url: "https://platform.openai.com/api-keys" },
|
|
588
|
+
anthropic: { env: "ANTHROPIC_API_KEY", url: "https://console.anthropic.com/settings/keys" },
|
|
589
|
+
google: { env: "GEMINI_API_KEY", url: "https://aistudio.google.com/apikey" },
|
|
590
|
+
};
|
|
591
|
+
// Determine which provider the model needs
|
|
592
|
+
let requiredProvider = "";
|
|
593
|
+
if (val.startsWith("openrouter/"))
|
|
594
|
+
requiredProvider = "openrouter";
|
|
595
|
+
else if (val.startsWith("anthropic/") || val.startsWith("claude"))
|
|
596
|
+
requiredProvider = "anthropic";
|
|
597
|
+
else if (val.startsWith("openai/") || val.startsWith("gpt") || val.startsWith("o3") || val.startsWith("o4"))
|
|
598
|
+
requiredProvider = "openai";
|
|
599
|
+
else if (val.startsWith("google/") || val.startsWith("gemini"))
|
|
600
|
+
requiredProvider = "google";
|
|
601
|
+
const check = requiredProvider ? keyChecks[requiredProvider] : undefined;
|
|
602
|
+
const envVal = check ? process.env[check.env] : undefined;
|
|
603
|
+
const hasRealKey = envVal && envVal !== "ollama-local";
|
|
604
|
+
if (check && !hasRealKey) {
|
|
605
|
+
out.write(`\n ${dim(`${requiredProvider} requires an API key (${check.url})`)}\n`);
|
|
606
|
+
const key = await ask(` ${coral(symbols.arrow)} ${check.env}: `);
|
|
588
607
|
if (key) {
|
|
589
|
-
process.env.
|
|
590
|
-
logSuccess(
|
|
608
|
+
process.env[check.env] = key;
|
|
609
|
+
logSuccess(`${check.env} set for this session`);
|
|
591
610
|
}
|
|
592
611
|
else {
|
|
593
|
-
logWarn(
|
|
612
|
+
logWarn(`No API key provided — cannot use ${requiredProvider}`);
|
|
594
613
|
break;
|
|
595
614
|
}
|
|
596
615
|
}
|
package/package.json
CHANGED