Skip to content

Conversation

@dcversus
Copy link

Summary

Fixes the issue where users cannot configure z.ai as their AI provider due to missing required fields in the authentication wizard.

Problem

When users try to configure z.ai provider, they encounter this error:

zaiApiLine is required and cannot be empty for selected provider, apiModelId is required and cannot be empty for selected provider

Root Cause

The authentication wizard (cli/src/utils/authWizard.ts) was only collecting the zaiApiKey but the validation requires three fields:

  • zaiApiKey ✓ (already collected)
  • zaiApiLine ✗ (missing)
  • apiModelId ✗ (missing)

Solution

Updated the auth wizard to collect all required fields:

  1. Added a prompt for selecting API line (international_coding or china_coding)
  2. Set default model to gpt-4o from PROVIDER_DEFAULT_MODELS
  3. Imported getProviderDefaultModel function from settings

Changes Made

  • Modified cli/src/utils/authWizard.ts:
    • Added import for getProviderDefaultModel
    • Added inquirer prompt for zaiApiLine selection
    • Added logic to set apiModelId with default value

Testing

  • ✅ 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:
    {
      "provider": "zai",
      "zaiApiKey": "...",
      "zaiApiLine": "international_coding",
      "apiModelId": "gpt-4o"
    }
  • ✅ No validation errors occur during setup

Verification Steps

  1. Run kilocode auth
  2. Select "zAI" as provider
  3. Enter your zAI API token
  4. Select API line (International/China Coding)
  5. Configuration is saved successfully with all required fields

Fixes: #3828

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: Kilo-Org#3828
@changeset-bot
Copy link

changeset-bot bot commented Nov 23, 2025

🦋 Changeset detected

Latest commit: 7a43d02

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@eshurakov
Copy link
Contributor

Thanks for the contribution! This was already fixed by #4003 which refactored the auth system and resolved #3828. Closing as superseded.

@eshurakov eshurakov closed this Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set up fails many times during z.ai setup

2 participants