aixxai 1.7.1 → 1.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aixxai",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "AIXX CLI - 让你的AI调用万物。One command, every AI model. By AIXX (Wanan Exchange), the verification-first compute exchange. 安装:npx aixxai",
5
5
  "type": "module",
6
6
  "bin": {
@@ -46,31 +46,36 @@ export async function balance(subArgs) {
46
46
  process.exit(1);
47
47
  }
48
48
 
49
- console.log(`使用Key: ${maskKey(apiKey)}`);
50
- console.log(`后端地址: ${baseUrl}\n`);
51
-
52
- // 0. 优先调 /v1/account(2026-08-28新增,能拿到真实账户余额,包括unlimited token)
49
+ // 0.5 数据API额度预取(1121千问终检⑥顺序优化:先打快的,展示也排前面)
50
+ let dataApi = null;
53
51
  try {
54
- const acctResp = await fetch(`${baseUrl}/account`, {
52
+ const c = new AbortController();
53
+ const t0 = setTimeout(() => c.abort(), 8000);
54
+ const u = await fetch('https://www.aixx.vip/api/v1/account/usage', {
55
55
  headers: { Authorization: `Bearer ${apiKey}` },
56
- signal: AbortSignal.timeout(FETCH_TIMEOUT),
56
+ signal: c.signal,
57
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 接口
58
+ clearTimeout(t0);
59
+ const j = await u.json();
60
+ if (j && j.ok) dataApi = j;
61
+ } catch { /* 数据API额度查询失败不影响主流程 */ }
62
+
63
+ console.log(`使用Key: ${maskKey(apiKey)}`);
64
+ console.log(`后端地址: ${baseUrl}\n`);
65
+
66
+ // 4. GPU行情数据API额度先上屏(预取于下方0.5段完成·千问终检⑥:最快的先显示)
67
+ if (dataApi) {
68
+ const left = dataApi.free_quota - dataApi.free_used;
69
+ console.log('── GPU 行情数据 API ──');
70
+ console.log(`📊 档位:${dataApi.tier === 'sub' ? '订阅中' : '免费档'}${dataApi.sub_expires_at ? `(至 ${String(dataApi.sub_expires_at).slice(0, 10)})` : ''}`);
71
+ console.log(`📊 免费额度:剩 ${left} / ${dataApi.free_quota} 次(今日已用 ${dataApi.today_counted})`);
72
+ console.log('────────────────────────────────────\n');
71
73
  }
72
74
 
73
- // 1. 降级:查总额度(subscription)
75
+ // 0. /v1/account 端点已退役(1121千问终检:console/v1/account=404死路,白耗一次请求)
76
+ // 直接走 /dashboard/billing/subscription(1121实测200活)
77
+
78
+ // 1. 查总额度(subscription)
74
79
  let hardLimitUsd = 0;
75
80
  try {
76
81
  const resp = await fetch(`${baseUrl}/dashboard/billing/subscription`, {
@@ -149,9 +154,7 @@ export async function balance(subArgs) {
149
154
  // 所以这里如实告知用户,引导去后台查精确余额。
150
155
  console.log(`💰 计费方式:按账户余额扣费(注册送$0.5试用额度,用完需充值)`);
151
156
  // 1120 WorkBuddy实测: unlimited档下dashboard/billing/usage返回的单位不可信(曾显示¥58969虚惊)
152
- // 按账户余额扣费时"已用"以账户维度为准——这里不再展示误算值, 引导官方端点
153
- console.log(`📊 已用额度:以账户维度计(请用下方官方入口查看精确值)`);
154
- console.log(`💡 精确余额请登录AIXX后台查看:${baseUrl.replace(/\/v1$/, '')}`);
157
+ // 按账户余额扣费时"已用"以账户维度为准——不展示误算值;1121千问终检:死文案删除
155
158
  } else {
156
159
  // 正常有限额度
157
160
  const remainingUsd = Math.max(0, hardLimitUsd - usedUsd);
@@ -164,25 +167,13 @@ export async function balance(subArgs) {
164
167
  }
165
168
  console.log('────────────────────────────────────');
166
169
 
167
- // 4. GPU行情数据API额度(1121千问终检③"最后一跳":/api/v1/account/usage @ www.aixx.vip)
168
- if (apiKey) {
169
- try {
170
- const ctrl = new AbortController();
171
- const t4 = setTimeout(() => ctrl.abort(), 12000);
172
- const u = await fetch('https://www.aixx.vip/api/v1/account/usage', {
173
- headers: { Authorization: `Bearer ${apiKey}` },
174
- signal: ctrl.signal,
175
- });
176
- clearTimeout(t4);
177
- const j = await u.json();
178
- if (j && j.ok) {
179
- const left = j.free_quota - j.free_used;
180
- console.log('\n── GPU 行情数据 API ──');
181
- console.log(`📊 档位:${j.tier === 'sub' ? '订阅中' : '免费档'}${j.sub_expires_at ? `(至 ${String(j.sub_expires_at).slice(0, 10)})` : ''}`);
182
- console.log(`📊 免费额度:剩 ${left} / ${j.free_quota} 次(今日已用 ${j.today_counted})`);
183
- console.log('────────────────────────────────────');
184
- }
185
- } catch { /* 数据API额度查询失败不影响主流程 */ }
170
+ // 4. GPU行情数据API额度(预取结果上屏——千问终检⑥:数据API段排前·展示顺序=数据API→模型余额)
171
+ if (dataApi) {
172
+ const left = dataApi.free_quota - dataApi.free_used;
173
+ console.log('\n── GPU 行情数据 API ──');
174
+ console.log(`📊 档位:${dataApi.tier === 'sub' ? '订阅中' : '免费档'}${dataApi.sub_expires_at ? `(至 ${String(dataApi.sub_expires_at).slice(0, 10)})` : ''}`);
175
+ console.log(`📊 免费额度:剩 ${left} / ${dataApi.free_quota} 次(今日已用 ${dataApi.today_counted})`);
176
+ console.log('────────────────────────────────────');
186
177
  }
187
178
 
188
179
  console.log('\n💡 提示:');