aixxai 1.5.3 → 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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aixxai",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "AIXX CLI - 让你的AI调用万物。安装:npx aixxai install",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,62 +1,57 @@
1
1
  /**
2
2
  * AIXX CLI - models 命令
3
- *
4
- * 列出AIXX支持的所有模型,按"国产/海外"分组展示。
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': '最便宜,¥0.001/千token,日常首选',
30
- 'deepseek-reasoner': '推理增强(带思考过程)',
31
- 'glm-4-flash': '智谱免费档,速度快',
32
- 'glm-4-plus': '中文写作强(渠道维护中,文案任务先用 deepseek-chat)',
33
- 'glm-4': '智谱通用',
34
- 'moonshot-v1-8k': 'Kimi,短上下文',
35
- 'moonshot-v1-32k': 'Kimi,中等上下文',
36
- 'moonshot-v1-128k': 'Kimi,超长文本(读整本书)',
37
- 'claude-sonnet-4-20250514': '日常主力,平衡性价比',
38
- 'claude-haiku-4-5-20251001': '便宜快速,简单任务',
39
- 'claude-opus-4-8': '最强,复杂任务',
40
- 'claude-3-5-sonnet': 'Claude 3.5 经典款',
41
- 'gpt-4o': 'OpenAI通用旗舰',
42
- 'gpt-4o-mini': 'OpenAI便宜款',
43
- 'gpt-4': 'GPT-4 经典',
44
- 'gpt-3.5-turbo': 'GPT-3.5,老牌便宜',
45
- 'grok-2-latest': 'xAI Grok,最新版',
46
- 'grok-beta': 'xAI Grok 测试版',
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
- // 模型分组规则:返回 'cn'(国产)或 'overseas'(海外)
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 (domestic.some((p) => lower.startsWith(p))) return 'cn';
54
- return 'overseas';
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,或设置环境变量 AIXX_API_KEY');
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(`❌ ${friendlyNetErr(err)}`);
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
- const cn = modelIds.filter((id) => classifyModel(id) === 'cn');
108
- const overseas = modelIds.filter((id) => classifyModel(id) === 'overseas');
109
-
110
- // 国产组
111
- console.log('🇨🇳 国产模型(便宜):');
112
- if (cn.length > 0) {
113
- cn.forEach((id) => {
114
- const desc = descOf(id);
115
- console.log(` • ${id}${desc ? ' —— ' + desc : ''}`);
116
- });
117
- } else {
118
- console.log(' (暂无)');
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(' - 最便宜日常任务 → deepseek-chat');
136
- console.log(' - 写中文文案/邮件deepseek-chat(glm渠道维护中)');
137
- console.log(' - 读超长文档/书籍 → moonshot-v1-128k');
138
- console.log(' - 复杂推理/代码 → deepseek-reasonerclaude-opus-4-8');
139
- console.log(' - 通用旗舰gpt-4o 或 claude-sonnet-4\n');
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-5gpt-5.6-sol');
119
+ console.log(' - 嵌入/搜索bge-m3\n');
140
120
  }