aixxai 1.5.2 → 1.5.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/aixxai-1.5.2.tgz +0 -0
- package/aixxai-1.5.3.tgz +0 -0
- package/package.json +1 -1
- package/src/commands/balance.js +22 -1
- package/src/commands/models.js +63 -83
package/aixxai-1.5.2.tgz
ADDED
|
Binary file
|
package/aixxai-1.5.3.tgz
ADDED
|
Binary file
|
package/package.json
CHANGED
package/src/commands/balance.js
CHANGED
|
@@ -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
|
-
//
|
|
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`, {
|
package/src/commands/models.js
CHANGED
|
@@ -1,62 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AIXX CLI - models 命令
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 数据来源:GET /v1/models
|
|
7
|
-
* 后端返回的模型列表是动态的,但分组规则是固定的(按模型名前缀分类)。
|
|
3
|
+
* 列出AIXX支持的所有模型,按场景分组展示。
|
|
4
|
+
* 2026-08-28 更新:按"日常推荐/通用/旗舰/嵌入"分组,用户一眼知道选哪个。
|
|
8
5
|
*/
|
|
9
6
|
|
|
10
7
|
import { DEFAULT_BASE_URL } from '../../bin/aixx.js';
|
|
11
8
|
import { loadApiKey, maskKey } from '../utils/env.js';
|
|
12
9
|
|
|
13
|
-
// 所有对外请求统一 15 秒超时
|
|
14
10
|
const FETCH_TIMEOUT = 15000;
|
|
15
|
-
// 网络/超时异常统一成友好提示
|
|
16
|
-
function friendlyNetErr(err) {
|
|
17
|
-
return err?.name === 'TimeoutError' || err?.name === 'AbortError'
|
|
18
|
-
? '连接超时,请检查网络'
|
|
19
|
-
: err?.message || String(err);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* apiKey 读取统一走 src/utils/env.js 的 loadApiKey:
|
|
24
|
-
* 环境变量 AIXX_API_KEY → ~/.aixx/config.json → ~/.aixx/account.json
|
|
25
|
-
*/
|
|
26
11
|
|
|
27
|
-
// 给每个模型加一句人话说明,让用户知道怎么选
|
|
28
12
|
const MODEL_DESC = {
|
|
29
|
-
'deepseek-chat': '
|
|
30
|
-
'deepseek-
|
|
31
|
-
'
|
|
32
|
-
'glm-4-
|
|
33
|
-
'glm-4': '
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
13
|
+
'deepseek-chat': '最便宜,日常首选',
|
|
14
|
+
'deepseek-v4-pro': 'DeepSeek 旗舰,推理强',
|
|
15
|
+
'deepseek-ai/DeepSeek-V3': 'DeepSeek V3',
|
|
16
|
+
'glm-4-flash': '智谱免费,速度快',
|
|
17
|
+
'glm-4-plus': '智谱旗舰,中文写作强',
|
|
18
|
+
'glm-4-air': '智谱轻量,便宜',
|
|
19
|
+
'glm-4-long': '智谱超长文本',
|
|
20
|
+
'glm-5-2-260617': 'GLM-5.2',
|
|
21
|
+
'moonshot-v1-8k': 'Kimi 短文本',
|
|
22
|
+
'moonshot-v1-32k': 'Kimi 中文本',
|
|
23
|
+
'moonshot-v1-128k': 'Kimi 超长文本',
|
|
24
|
+
'kimi-latest': 'Kimi 最新',
|
|
25
|
+
'kimi-k2.6': 'Kimi K2.6 代码强',
|
|
26
|
+
'claude-fable-5': 'Claude Fable 5 最强写作',
|
|
27
|
+
'claude-opus-4-8': 'Claude Opus 4.8',
|
|
28
|
+
'claude-opus-5': 'Claude Opus 5 最新旗舰',
|
|
29
|
+
'claude-sonnet-5': 'Claude Sonnet 5 性价比',
|
|
30
|
+
'claude-haiku-4-5': '便宜快速',
|
|
31
|
+
'gpt-5.4': 'GPT-5.4 通用',
|
|
32
|
+
'gpt-5.4-mini': 'GPT-5.4 便宜',
|
|
33
|
+
'gpt-5.5': 'GPT-5.5',
|
|
34
|
+
'gpt-5.6-sol': 'GPT-5.6 Sol 旗舰',
|
|
35
|
+
'gpt-5.6-luna': 'GPT-5.6 Luna 创意',
|
|
36
|
+
'gpt-5.6-terra': 'GPT-5.6 Terra 分析',
|
|
37
|
+
'doubao-pro': '豆包 Pro 中文',
|
|
38
|
+
'doubao-seed-2-0-pro-260215': '豆包 Seed 2.0',
|
|
39
|
+
'abab6.5-chat': 'MiniMax 6.5',
|
|
40
|
+
'bge-m3': '嵌入模型',
|
|
41
|
+
'embedding-3': '智谱嵌入',
|
|
47
42
|
};
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
function classifyModel(id) {
|
|
51
|
-
const domestic = ['deepseek', 'glm', 'moonshot', 'qwen', 'ernie', 'spark', 'hunyuan', 'baichuan', 'yi-', 'step'];
|
|
44
|
+
function classifyScenario(id) {
|
|
52
45
|
const lower = id.toLowerCase();
|
|
53
|
-
if (
|
|
54
|
-
|
|
46
|
+
if (lower.includes('embed') || lower.includes('bge')) return 'embedding';
|
|
47
|
+
const budget = ['deepseek-chat', 'glm-4-flash', 'glm-4-air', 'claude-haiku'];
|
|
48
|
+
if (budget.some(p => lower.startsWith(p) || lower.includes(p))) return 'budget';
|
|
49
|
+
const flagship = ['opus-5', 'gpt-5.6', 'gpt-5.5', 'fable-5', 'deepseek-v4-pro'];
|
|
50
|
+
if (flagship.some(p => lower.includes(p))) return 'flagship';
|
|
51
|
+
return 'general';
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
function descOf(id) {
|
|
58
|
-
return MODEL_DESC[id] || '';
|
|
59
|
-
}
|
|
54
|
+
function descOf(id) { return MODEL_DESC[id] || ''; }
|
|
60
55
|
|
|
61
56
|
export async function models(subArgs) {
|
|
62
57
|
console.log('╔══════════════════════════════════════════╗');
|
|
@@ -68,11 +63,10 @@ export async function models(subArgs) {
|
|
|
68
63
|
|
|
69
64
|
if (!apiKey) {
|
|
70
65
|
console.error('❌ 未找到AIXX API Key');
|
|
71
|
-
console.error(' 请先运行 npx aixxai install
|
|
66
|
+
console.error(' 请先运行 npx aixxai install');
|
|
72
67
|
process.exit(1);
|
|
73
68
|
}
|
|
74
69
|
|
|
75
|
-
// 拉模型列表
|
|
76
70
|
let modelIds = [];
|
|
77
71
|
try {
|
|
78
72
|
const resp = await fetch(`${baseUrl}/models`, {
|
|
@@ -80,61 +74,47 @@ export async function models(subArgs) {
|
|
|
80
74
|
signal: AbortSignal.timeout(FETCH_TIMEOUT),
|
|
81
75
|
});
|
|
82
76
|
if (!resp.ok) {
|
|
83
|
-
if (resp.status === 401) {
|
|
84
|
-
console.error('❌ API Key 无效(401),请重新 install 或检查 key');
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
77
|
console.error(`❌ 获取模型列表失败: HTTP ${resp.status}`);
|
|
88
78
|
process.exit(1);
|
|
89
79
|
}
|
|
90
80
|
const data = await resp.json();
|
|
91
81
|
const arr = data.data || data.models || [];
|
|
92
|
-
modelIds = arr
|
|
93
|
-
.map((m) => (typeof m === 'string' ? m : m.id))
|
|
94
|
-
.filter(Boolean)
|
|
95
|
-
.sort();
|
|
82
|
+
modelIds = arr.map(m => (typeof m === 'string' ? m : m.id)).filter(Boolean).sort();
|
|
96
83
|
} catch (err) {
|
|
97
|
-
console.error(`❌ ${
|
|
84
|
+
console.error(`❌ ${err?.message || err}`);
|
|
98
85
|
process.exit(1);
|
|
99
86
|
}
|
|
100
87
|
|
|
101
88
|
if (modelIds.length === 0) {
|
|
102
|
-
console.log('⚠️
|
|
89
|
+
console.log('⚠️ 后端未返回任何模型');
|
|
103
90
|
return;
|
|
104
91
|
}
|
|
105
92
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
// 海外组
|
|
122
|
-
console.log('\n🚀 海外模型(强):');
|
|
123
|
-
if (overseas.length > 0) {
|
|
124
|
-
overseas.forEach((id) => {
|
|
93
|
+
const groups = { budget: [], general: [], flagship: [], embedding: [] };
|
|
94
|
+
modelIds.forEach(id => groups[classifyScenario(id)].push(id));
|
|
95
|
+
|
|
96
|
+
const groupMeta = {
|
|
97
|
+
budget: { title: '💡 日常推荐(便宜好用)' },
|
|
98
|
+
general: { title: '🔧 通用模型(按需选)' },
|
|
99
|
+
flagship: { title: '🚀 旗舰模型(最强但贵)' },
|
|
100
|
+
embedding:{ title: '📐 嵌入模型(向量化/搜索)' },
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
for (const [key, meta] of Object.entries(groupMeta)) {
|
|
104
|
+
const ids = groups[key];
|
|
105
|
+
if (ids.length === 0) continue;
|
|
106
|
+
console.log(`\n${meta.title}:`);
|
|
107
|
+
ids.forEach(id => {
|
|
125
108
|
const desc = descOf(id);
|
|
126
109
|
console.log(` • ${id}${desc ? ' —— ' + desc : ''}`);
|
|
127
110
|
});
|
|
128
|
-
} else {
|
|
129
|
-
console.log(' (暂无)');
|
|
130
111
|
}
|
|
131
112
|
|
|
132
113
|
console.log(`\n📊 共 ${modelIds.length} 个模型\n`);
|
|
133
|
-
|
|
134
114
|
console.log('💡 选模型小抄:');
|
|
135
|
-
console.log(' -
|
|
136
|
-
console.log(' -
|
|
137
|
-
console.log(' -
|
|
138
|
-
console.log(' - 复杂推理/代码 →
|
|
139
|
-
console.log(' -
|
|
115
|
+
console.log(' - 日常聊天/写文案 → deepseek-chat(最便宜)');
|
|
116
|
+
console.log(' - 中文写作 → glm-4-plus 或 claude-fable-5');
|
|
117
|
+
console.log(' - 读超长文档 → moonshot-v1-128k');
|
|
118
|
+
console.log(' - 复杂推理/代码 → claude-opus-5 或 gpt-5.6-sol');
|
|
119
|
+
console.log(' - 嵌入/搜索 → bge-m3\n');
|
|
140
120
|
}
|