aixxai 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aixxai",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "AIXX CLI - 让你的AI调用万物。安装:npx aixxai install",
5
5
  "type": "module",
6
6
  "bin": {
@@ -49,7 +49,28 @@ export async function balance(subArgs) {
49
49
  console.log(`使用Key: ${maskKey(apiKey)}`);
50
50
  console.log(`后端地址: ${baseUrl}\n`);
51
51
 
52
- // 1. 查总额度(subscription
52
+ // 0. 优先调 /v1/account(2026-08-28新增,能拿到真实账户余额,包括unlimited token
53
+ try {
54
+ const acctResp = await fetch(`${baseUrl}/account`, {
55
+ headers: { Authorization: `Bearer ${apiKey}` },
56
+ signal: AbortSignal.timeout(FETCH_TIMEOUT),
57
+ });
58
+ if (acctResp.ok) {
59
+ const acct = await acctResp.json();
60
+ console.log('────────────────────────────────────');
61
+ console.log(`👤 账户:${acct.username || '未知'}`);
62
+ console.log(`💰 账户余额:¥${(acct.balance_cny ?? 0).toFixed(2)}($${(acct.balance_usd ?? 0).toFixed(2)})`);
63
+ console.log(`📊 已用额度:¥${(acct.used_cny ?? 0).toFixed(2)}`);
64
+ if (acct.unlimited_token) console.log(`♾️ Token模式:不限量(按账户余额扣费)`);
65
+ console.log('────────────────────────────────────');
66
+ console.log(`\n💡 充值入口:${acct.topup_url || baseUrl.replace(/\/v1$/, '') + '/console/topup'}\n`);
67
+ return;
68
+ }
69
+ } catch {
70
+ // /v1/account 不可用 → 降级到旧的 billing 接口
71
+ }
72
+
73
+ // 1. 降级:查总额度(subscription)
53
74
  let hardLimitUsd = 0;
54
75
  try {
55
76
  const resp = await fetch(`${baseUrl}/dashboard/billing/subscription`, {