aixxai 1.7.2 → 1.7.4
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 +1 -1
- package/src/commands/balance.js +33 -24
- package/src/commands/market.js +13 -0
package/package.json
CHANGED
package/src/commands/balance.js
CHANGED
|
@@ -46,9 +46,41 @@ export async function balance(subArgs) {
|
|
|
46
46
|
process.exit(1);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
// 0.5 数据API额度预取(1121千问终检⑥顺序优化:先打快的,展示也排前面)
|
|
50
|
+
let dataApi = null;
|
|
51
|
+
try {
|
|
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
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
56
|
+
signal: c.signal,
|
|
57
|
+
});
|
|
58
|
+
clearTimeout(t0);
|
|
59
|
+
const j = await u.json();
|
|
60
|
+
if (j && j.ok) dataApi = j;
|
|
61
|
+
} catch { /* 数据API额度查询失败不影响主流程 */ }
|
|
62
|
+
|
|
49
63
|
console.log(`使用Key: ${maskKey(apiKey)}`);
|
|
50
64
|
console.log(`后端地址: ${baseUrl}\n`);
|
|
51
65
|
|
|
66
|
+
// 4. GPU行情数据API额度先上屏(预取于下方0.5段完成·千问终检⑥:最快的先显示)
|
|
67
|
+
if (dataApi) {
|
|
68
|
+
const left = dataApi.free_quota - dataApi.free_used;
|
|
69
|
+
const dRem = typeof dataApi.daily_remaining === 'number' ? dataApi.daily_remaining
|
|
70
|
+
: Math.max(40 - (dataApi.today_counted || 0), 0);
|
|
71
|
+
console.log('── GPU 行情数据 API ──');
|
|
72
|
+
console.log(`📊 档位:${dataApi.tier === 'sub' ? '订阅中' : '免费档'}${dataApi.sub_expires_at ? `(至 ${String(dataApi.sub_expires_at).slice(0, 10)})` : ''}`);
|
|
73
|
+
console.log(`📊 免费额度:剩 ${left} / ${dataApi.free_quota} 次(今日已用 ${dataApi.today_counted})`);
|
|
74
|
+
if (dRem <= 0) {
|
|
75
|
+
// 1121千问P0-3: 额度用尽时置顶引导(通用文案用户读完不知道该干嘛)
|
|
76
|
+
console.log('⚠️ 今日免费额度已用尽——北京时间次日00:00自动重置,现在重试无意义');
|
|
77
|
+
console.log(' 需要现在继续? 订阅档: https://aixx.ai/data-api.html#price');
|
|
78
|
+
} else if (dataApi.tier !== 'sub' && dRem <= 10) {
|
|
79
|
+
console.log(`💡 今日剩余 ${dRem} 次,快到日上限(40/日)——省着点用`);
|
|
80
|
+
}
|
|
81
|
+
console.log('────────────────────────────────────\n');
|
|
82
|
+
}
|
|
83
|
+
|
|
52
84
|
// 0. /v1/account 端点已退役(1121千问终检:console/v1/account=404死路,白耗一次请求)
|
|
53
85
|
// 直接走 /dashboard/billing/subscription(1121实测200活)
|
|
54
86
|
|
|
@@ -131,9 +163,7 @@ export async function balance(subArgs) {
|
|
|
131
163
|
// 所以这里如实告知用户,引导去后台查精确余额。
|
|
132
164
|
console.log(`💰 计费方式:按账户余额扣费(注册送$0.5试用额度,用完需充值)`);
|
|
133
165
|
// 1120 WorkBuddy实测: unlimited档下dashboard/billing/usage返回的单位不可信(曾显示¥58969虚惊)
|
|
134
|
-
// 按账户余额扣费时"已用"
|
|
135
|
-
console.log(`📊 已用额度:以账户维度计(请用下方官方入口查看精确值)`);
|
|
136
|
-
console.log(`💡 精确余额请登录AIXX后台查看:${baseUrl.replace(/\/v1$/, '')}`);
|
|
166
|
+
// 按账户余额扣费时"已用"以账户维度为准——不展示误算值;1121千问终检:死文案删除
|
|
137
167
|
} else {
|
|
138
168
|
// 正常有限额度
|
|
139
169
|
const remainingUsd = Math.max(0, hardLimitUsd - usedUsd);
|
|
@@ -146,27 +176,6 @@ export async function balance(subArgs) {
|
|
|
146
176
|
}
|
|
147
177
|
console.log('────────────────────────────────────');
|
|
148
178
|
|
|
149
|
-
// 4. GPU行情数据API额度(1121千问终检③"最后一跳":/api/v1/account/usage @ www.aixx.vip)
|
|
150
|
-
if (apiKey) {
|
|
151
|
-
try {
|
|
152
|
-
const ctrl = new AbortController();
|
|
153
|
-
const t4 = setTimeout(() => ctrl.abort(), 12000);
|
|
154
|
-
const u = await fetch('https://www.aixx.vip/api/v1/account/usage', {
|
|
155
|
-
headers: { Authorization: `Bearer ${apiKey}` },
|
|
156
|
-
signal: ctrl.signal,
|
|
157
|
-
});
|
|
158
|
-
clearTimeout(t4);
|
|
159
|
-
const j = await u.json();
|
|
160
|
-
if (j && j.ok) {
|
|
161
|
-
const left = j.free_quota - j.free_used;
|
|
162
|
-
console.log('\n── GPU 行情数据 API ──');
|
|
163
|
-
console.log(`📊 档位:${j.tier === 'sub' ? '订阅中' : '免费档'}${j.sub_expires_at ? `(至 ${String(j.sub_expires_at).slice(0, 10)})` : ''}`);
|
|
164
|
-
console.log(`📊 免费额度:剩 ${left} / ${j.free_quota} 次(今日已用 ${j.today_counted})`);
|
|
165
|
-
console.log('────────────────────────────────────');
|
|
166
|
-
}
|
|
167
|
-
} catch { /* 数据API额度查询失败不影响主流程 */ }
|
|
168
|
-
}
|
|
169
|
-
|
|
170
179
|
console.log('\n💡 提示:');
|
|
171
180
|
console.log(' - 新用户注册送 $0.5 试用额度');
|
|
172
181
|
console.log(' - glm-4-air 便宜,省着用能聊很久');
|
package/src/commands/market.js
CHANGED
|
@@ -62,6 +62,19 @@ async function mFetch(path) {
|
|
|
62
62
|
console.error('当前订阅档位不包含该数据 —— 如需升级请访问 aixx.ai 或联系客服');
|
|
63
63
|
process.exit(1);
|
|
64
64
|
}
|
|
65
|
+
if (res.status === 429) {
|
|
66
|
+
// 1121千问P0-2: 解析429体分流——quota_exhausted=额度墙(引导)·rate_limited=太快(等待)
|
|
67
|
+
let eb = {};
|
|
68
|
+
try { eb = await res.json(); } catch { /* 无体走默认 */ }
|
|
69
|
+
if (eb && eb.error === 'quota_exhausted') {
|
|
70
|
+
console.error('🔥 今日免费数据额度已用完(北京时间次日00:00自动重置)');
|
|
71
|
+
console.error(' 现在重试无意义。额度账目: aixx balance');
|
|
72
|
+
console.error(' 需要现在继续? 订阅档: https://aixx.ai/data-api.html#price');
|
|
73
|
+
} else {
|
|
74
|
+
console.error('⏳ 请求太快,' + ((eb && eb.retry_after) || 60) + '秒后可继续');
|
|
75
|
+
}
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
65
78
|
if (res.status === 404) {
|
|
66
79
|
console.error('未查询到该数据(请核对标的代码)');
|
|
67
80
|
process.exit(1);
|