kilocode icon indicating copy to clipboard operation
kilocode copied to clipboard

Cli Zai authetincation doens't work

Open filippopairotti opened this issue 1 year ago • 8 comments

Plugin Type

Kilo Code CLI

App Version

1.0.0

Description

when i launch the cli and i select Zai i paste my api keys and it doesn't work Welcome to the Kilo Code CLI! 🎉

To get you started, please fill out these following questions. ✔ Please select which provider you would like to use: zAI ✔ Please enter your zAI token: node:internal/process/promises:391 triggerUncaughtException(err, true /* fromPromise */); ^

Error: Invalid config: zaiApiLine is required and cannot be empty for selected provider, apiModelId is required and cannot be empty for selected provider at saveConfig (file:///home/filippo/.nvm/versions/node/v20.19.5/lib/node_modules/@kilocode/cli/index.js:12107:15) at async authWizard (file:///home/filippo/.nvm/versions/node/v20.19.5/lib/node_modules/@kilocode/cli/index.js:57664:3) at async Command. (file:///home/filippo/.nvm/versions/node/v20.19.5/lib/node_modules/@kilocode/cli/index.js:57712:5)

Node.js v20.19.5

Reproduction steps

launch kilocode from the cli paste the zai api

Provider

No response

Model

No response

System Information

No response

filippopairotti avatar Oct 22 '25 16:10 filippopairotti

If you need a temporary fix, you can check out the ZAi Config Docs. That’s what I did, and it worked for me.

kanishka-sahoo avatar Oct 22 '25 16:10 kanishka-sahoo

Same problem for me, installed it fresh today (after the fix i see in the reply above) .. so still not working

LE: You have to type kilo config in terminal. it will provide the json config where you swap the first lines with what you get in the ZAi Config Docs (see url above)

sant3e avatar Oct 23 '25 06:10 sant3e

We're now properly supporting zAI. Let me know if the issue still persists!

RSO avatar Nov 07 '25 15:11 RSO

this isse still persists when installing the KiloCode CLI however it can be fixed by the workaround @kanishka-sahoo provided , thanks for that!

misterdojo777 avatar Nov 18 '25 08:11 misterdojo777

I concur with @misterdojo777 ; This issue still exists, when selecting the option "zAI" and providing key.

Upon inspection of the config.json, kilo code CLI appears to write a generic config.json, specifically noting the header section (Trimmed for berevity):

{ "version": "1.0.0", "mode": "code", "telemetry": true, "provider": "default", "providers": [ { "id": "default", "provider": "kilocode", "kilocodeToken": "", "kilocodeModel": "x-ai/grok-code-fast-1" } ] }

Does not appear to save out, nor use the key provided when launching for first time.

As with @misterdojo777 , @kanishka-sahoo fix works by manually manipulating your own config.json.

bladedthoth avatar Nov 29 '25 14:11 bladedthoth

The outcome is the same when providing zaiApiLine directly in the kilocode cli config. It gets an error 401 no matter what URL is in zaiApiLine.

{ "id": "default", "provider": "zai", "zaiApiKey": "", "zaiApiLine": "https://api.z.ai/api/coding/paas/v4/", "apiModelId": "glm-4.6" }

greghavens avatar Dec 01 '25 18:12 greghavens

{ "id": "default", "provider": "zai", "zaiApiKey": "", "zaiApiLine": "https://api.z.ai/api/coding/paas/v4/", "apiModelId": "glm-4.6" }

zaiApiLine should be "zaiApiLine": "international_coding",

Your options are: international international_coding china china_coding

bladedthoth avatar Dec 01 '25 19:12 bladedthoth

{ "id": "default", "provider": "zai", "zaiApiKey": "", "zaiApiLine": "https://api.z.ai/api/coding/paas/v4/", "apiModelId": "glm-4.6" }

zaiApiLine should be "zaiApiLine": "international_coding",

Your options are: international international_coding china china_coding

Thank you. I updated it to "international_coding" and that corrects it.

greghavens avatar Dec 01 '25 19:12 greghavens