|
|
|
|
@@ -77,8 +77,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "ANTHROPIC_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setAnthropicApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setAnthropicApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
return applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "anthropic:default",
|
|
|
|
|
provider: "anthropic",
|
|
|
|
|
@@ -150,8 +154,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "GEMINI_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setGeminiApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setGeminiApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "google:default",
|
|
|
|
|
provider: "google",
|
|
|
|
|
@@ -169,8 +177,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "ZAI_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setZaiApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setZaiApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "zai:default",
|
|
|
|
|
provider: "zai",
|
|
|
|
|
@@ -188,8 +200,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "XIAOMI_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setXiaomiApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setXiaomiApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "xiaomi:default",
|
|
|
|
|
provider: "xiaomi",
|
|
|
|
|
@@ -208,7 +224,9 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
runtime,
|
|
|
|
|
allowProfile: false,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
const key = resolved.key;
|
|
|
|
|
const result = upsertSharedEnvVar({ key: "OPENAI_API_KEY", value: key });
|
|
|
|
|
process.env.OPENAI_API_KEY = key;
|
|
|
|
|
@@ -225,8 +243,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "OPENROUTER_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setOpenrouterApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setOpenrouterApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "openrouter:default",
|
|
|
|
|
provider: "openrouter",
|
|
|
|
|
@@ -244,8 +266,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "AI_GATEWAY_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setVercelAiGatewayApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setVercelAiGatewayApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "vercel-ai-gateway:default",
|
|
|
|
|
provider: "vercel-ai-gateway",
|
|
|
|
|
@@ -263,8 +289,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "MOONSHOT_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setMoonshotApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setMoonshotApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "moonshot:default",
|
|
|
|
|
provider: "moonshot",
|
|
|
|
|
@@ -282,8 +312,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "KIMI_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setKimiCodingApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setKimiCodingApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "kimi-coding:default",
|
|
|
|
|
provider: "kimi-coding",
|
|
|
|
|
@@ -301,8 +335,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "SYNTHETIC_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setSyntheticApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setSyntheticApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "synthetic:default",
|
|
|
|
|
provider: "synthetic",
|
|
|
|
|
@@ -320,8 +358,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "VENICE_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setVeniceApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setVeniceApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "venice:default",
|
|
|
|
|
provider: "venice",
|
|
|
|
|
@@ -343,8 +385,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "MINIMAX_API_KEY",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setMinimaxApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setMinimaxApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "minimax:default",
|
|
|
|
|
provider: "minimax",
|
|
|
|
|
@@ -355,7 +401,9 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
return applyMinimaxApiConfig(nextConfig, modelId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (authChoice === "minimax") return applyMinimaxConfig(nextConfig);
|
|
|
|
|
if (authChoice === "minimax") {
|
|
|
|
|
return applyMinimaxConfig(nextConfig);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (authChoice === "opencode-zen") {
|
|
|
|
|
const resolved = await resolveNonInteractiveApiKey({
|
|
|
|
|
@@ -366,8 +414,12 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|
|
|
|
envVar: "OPENCODE_API_KEY (or OPENCODE_ZEN_API_KEY)",
|
|
|
|
|
runtime,
|
|
|
|
|
});
|
|
|
|
|
if (!resolved) return null;
|
|
|
|
|
if (resolved.source !== "profile") await setOpencodeZenApiKey(resolved.key);
|
|
|
|
|
if (!resolved) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (resolved.source !== "profile") {
|
|
|
|
|
await setOpencodeZenApiKey(resolved.key);
|
|
|
|
|
}
|
|
|
|
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
|
|
|
|
profileId: "opencode:default",
|
|
|
|
|
provider: "opencode",
|
|
|
|
|
|