feat(volcengine): integrate Volcengine & Byteplus Provider

This commit is contained in:
fanziqing
2026-02-03 19:57:37 +08:00
committed by Peter Steinberger
parent 95c14d9b5f
commit 559736a5a0
21 changed files with 700 additions and 11 deletions

View File

@@ -28,6 +28,8 @@ type AuthChoiceFlagOptions = Pick<
| "xaiApiKey"
| "litellmApiKey"
| "qianfanApiKey"
| "volcengineApiKey"
| "byteplusApiKey"
| "customBaseUrl"
| "customModelId"
| "customApiKey"

View File

@@ -55,6 +55,7 @@ import {
resolveCustomProviderId,
} from "../../onboard-custom.js";
import type { AuthChoice, OnboardOptions } from "../../onboard-types.js";
import { applyPrimaryModel } from "../../model-picker.js";
import { applyOpenAIConfig } from "../../openai-model-default.js";
import { detectZaiEndpoint } from "../../zai-endpoint-detect.js";
import { resolveNonInteractiveApiKey } from "../api-keys.js";
@@ -303,6 +304,52 @@ export async function applyNonInteractiveAuthChoice(params: {
return applyXaiConfig(nextConfig);
}
if (authChoice === "volcengine-api-key") {
const resolved = await resolveNonInteractiveApiKey({
provider: "volcengine",
cfg: baseConfig,
flagValue: opts.volcengineApiKey,
flagName: "--volcengine-api-key",
envVar: "VOLCANO_ENGINE_API_KEY",
runtime,
});
if (!resolved) {
return null;
}
if (resolved.source !== "profile") {
const result = upsertSharedEnvVar({
key: "VOLCANO_ENGINE_API_KEY",
value: resolved.key,
});
process.env.VOLCANO_ENGINE_API_KEY = resolved.key;
runtime.log(`Saved VOLCANO_ENGINE_API_KEY to ${shortenHomePath(result.path)}`);
}
return applyPrimaryModel(nextConfig, "volcengine-plan/ark-code-latest");
}
if (authChoice === "byteplus-api-key") {
const resolved = await resolveNonInteractiveApiKey({
provider: "byteplus",
cfg: baseConfig,
flagValue: opts.byteplusApiKey,
flagName: "--byteplus-api-key",
envVar: "BYTEPLUS_API_KEY",
runtime,
});
if (!resolved) {
return null;
}
if (resolved.source !== "profile") {
const result = upsertSharedEnvVar({
key: "BYTEPLUS_API_KEY",
value: resolved.key,
});
process.env.BYTEPLUS_API_KEY = resolved.key;
runtime.log(`Saved BYTEPLUS_API_KEY to ${shortenHomePath(result.path)}`);
}
return applyPrimaryModel(nextConfig, "byteplus-plan/ark-code-latest");
}
if (authChoice === "qianfan-api-key") {
const resolved = await resolveNonInteractiveApiKey({
provider: "qianfan",