From a93672642d180b1eb9510c1d737279bd2166392a Mon Sep 17 00:00:00 2001 From: Vasilisa Versus Date: Sun, 23 Nov 2025 12:23:54 +0000 Subject: [PATCH 1/2] fix: resolve z.ai provider setup failure (#3828) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the issue where users cannot configure z.ai as their AI provider due to missing required fields. The authentication wizard was only collecting `zaiApiKey` but the validation requires three fields: - `zaiApiKey` ✓ (already collected) - `zaiApiLine` ✗ (now added) - `apiModelId` ✗ (now added) Changes: - Added prompt for selecting API line (international_coding or china_coding) - Set default model to gpt-4o from PROVIDER_DEFAULT_MODELS - Imported getProviderDefaultModel function from settings Tested: - ✅ All linting checks pass - ✅ All type checks pass - ✅ All existing tests pass (1062 tests) - ✅ Interactive test confirms API line selection prompt appears - ✅ Configuration saves with all required fields - ✅ No validation errors occur Fixes: #3828 --- cli/src/utils/authWizard.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/cli/src/utils/authWizard.ts b/cli/src/utils/authWizard.ts index 6a5920516d8..12aa07421c7 100644 --- a/cli/src/utils/authWizard.ts +++ b/cli/src/utils/authWizard.ts @@ -4,6 +4,7 @@ import openConfigFile from "../config/openConfig" import wait from "../utils/wait" import { getKilocodeDefaultModel } from "./getKilocodeDefaultModel.js" import { getKilocodeProfile, INVALID_TOKEN_ERROR, type KilocodeProfileData } from "./getKilocodeProfile.js" +import { getProviderDefaultModel } from "../constants/providers/settings.js" export default async function authWizard() { const config = await loadConfig() @@ -103,14 +104,35 @@ export default async function authWizard() { break } case "zai": { - const { zaiApiKey } = await inquirer.prompt<{ zaiApiKey: string }>([ + const { zaiApiKey, zaiApiLine } = await inquirer.prompt<{ + zaiApiKey: string + zaiApiLine: "international_coding" | "china_coding" + }>([ { type: "password", name: "zaiApiKey", message: "Please enter your zAI token:", }, + { + type: "list", + name: "zaiApiLine", + message: "Select your zAI API line:", + choices: [ + { name: "International Coding", value: "international_coding" }, + { name: "China Coding", value: "china_coding" }, + ], + default: "international_coding", + }, ]) - providerSpecificConfig = { zaiApiKey } + + // Get the default model for zai provider + const defaultModel = getProviderDefaultModel("zai") + + providerSpecificConfig = { + zaiApiKey, + zaiApiLine, + apiModelId: defaultModel, + } break } case "other": { From 158956cc4f24d8adb40b8048e9e168c53a5c4134 Mon Sep 17 00:00:00 2001 From: Vasilisa Versus Date: Sun, 23 Nov 2025 12:38:53 +0000 Subject: [PATCH 2/2] chore: add changeset for z.ai provider fix (#3828) --- .changeset/zai-provider-fix.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/zai-provider-fix.md diff --git a/.changeset/zai-provider-fix.md b/.changeset/zai-provider-fix.md new file mode 100644 index 00000000000..f2cbe2201d1 --- /dev/null +++ b/.changeset/zai-provider-fix.md @@ -0,0 +1,7 @@ +--- +"@kilocode/cli": patch +--- + +Fixes z.ai provider setup failure by collecting all required configuration fields. The authentication wizard now prompts for API line selection (international_coding or china_coding) and sets the default model to gpt-4o. + +Fixes #3828