feat: add xAI Grok provider support

This commit is contained in:
George Pickett
2026-02-05 12:25:34 -08:00
parent cefd87f355
commit db31c0ccca
15 changed files with 396 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ import {
applySyntheticConfig,
applyVeniceConfig,
applyVercelAiGatewayConfig,
applyXaiConfig,
applyXiaomiConfig,
applyZaiConfig,
setAnthropicApiKey,
@@ -32,6 +33,7 @@ import {
setOpencodeZenApiKey,
setOpenrouterApiKey,
setSyntheticApiKey,
setXaiApiKey,
setVeniceApiKey,
setVercelAiGatewayApiKey,
setXiaomiApiKey,
@@ -218,6 +220,29 @@ export async function applyNonInteractiveAuthChoice(params: {
return applyXiaomiConfig(nextConfig);
}
if (authChoice === "xai-api-key") {
const resolved = await resolveNonInteractiveApiKey({
provider: "xai",
cfg: baseConfig,
flagValue: opts.xaiApiKey,
flagName: "--xai-api-key",
envVar: "XAI_API_KEY",
runtime,
});
if (!resolved) {
return null;
}
if (resolved.source !== "profile") {
await setXaiApiKey(resolved.key);
}
nextConfig = applyAuthProfileConfig(nextConfig, {
profileId: "xai:default",
provider: "xai",
mode: "api_key",
});
return applyXaiConfig(nextConfig);
}
if (authChoice === "openai-api-key") {
const resolved = await resolveNonInteractiveApiKey({
provider: "openai",