Skip to content

Commit

Permalink
Add balance information when boot the kimi CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian committed Apr 24, 2024
1 parent 41f0c74 commit 3e76859
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const response = await client.models();
- `getFileContent()`
- `deleteFile()`
- `estimateTokenCount()`
- `getBalance()`
The detail of parameters can be found at <https://platform.moonshot.cn/docs/api-reference> or [`test/kimi.test.js`](./test/kimi.test.js).
Expand Down
4 changes: 4 additions & 0 deletions bin/kimi.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ const pkg = loadJSONSync(path.join(__dirname, '../package.json'));
console.log(`Welcome to KIMI CLI(v${pkg.version}), type ${chalk.bgGray('.help')} for more information.`);
console.log(`Current model is ${chalk.bgGreen(config.model)}.`);

const balance = await kimi.getBalance();
const {available_balance, cash_balance, voucher_balance } = balance.data;
console.log(`Current balance: ¥${available_balance}(Cash: ¥${cash_balance}, Voucher: ¥${voucher_balance}}).`);

// eslint-disable-next-line no-constant-condition
while (true) {
const answer = await rl.question('What is your query: ');
Expand Down

0 comments on commit 3e76859

Please sign in to comment.