feat: add Moonshot auth choice

This commit is contained in:
Peter Steinberger
2026-01-12 06:47:52 +00:00
parent 960ed66501
commit 496bad8b98
10 changed files with 316 additions and 26 deletions

View File

@@ -34,12 +34,14 @@ import {
applyAuthProfileConfig,
applyMinimaxApiConfig,
applyMinimaxConfig,
applyMoonshotConfig,
applyOpencodeZenConfig,
applyOpenrouterConfig,
applyZaiConfig,
setAnthropicApiKey,
setGeminiApiKey,
setMinimaxApiKey,
setMoonshotApiKey,
setOpencodeZenApiKey,
setOpenrouterApiKey,
setZaiApiKey,
@@ -284,6 +286,25 @@ export async function runNonInteractiveOnboarding(
mode: "api_key",
});
nextConfig = applyOpenrouterConfig(nextConfig);
} else if (authChoice === "moonshot-api-key") {
const resolved = await resolveNonInteractiveApiKey({
provider: "moonshot",
cfg: baseConfig,
flagValue: opts.moonshotApiKey,
flagName: "--moonshot-api-key",
envVar: "MOONSHOT_API_KEY",
runtime,
});
if (!resolved) return;
if (resolved.source !== "profile") {
await setMoonshotApiKey(resolved.key);
}
nextConfig = applyAuthProfileConfig(nextConfig, {
profileId: "moonshot:default",
provider: "moonshot",
mode: "api_key",
});
nextConfig = applyMoonshotConfig(nextConfig);
} else if (authChoice === "minimax-cloud" || authChoice === "minimax-api") {
const resolved = await resolveNonInteractiveApiKey({
provider: "minimax",