aixxai 1.6.9 → 1.7.0

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,38 +1,38 @@
1
- {
2
- "name": "aixxai",
3
- "version": "1.6.9",
4
- "description": "AIXX CLI - 让你的AI调用万物。One command, every AI model. By AIXX (Wanan Exchange), the verification-first compute exchange. 安装:npx aixxai",
5
- "type": "module",
6
- "bin": {
7
- "aixx": "./bin/aixx.js"
8
- },
9
- "scripts": {
10
- "test": "node bin/aixx.js --version"
11
- },
12
- "keywords": [
13
- "aixx",
14
- "aixxai",
15
- "ai",
16
- "llm",
17
- "gateway",
18
- "openai",
19
- "glm",
20
- "kimi",
21
- "skill",
22
- "agent",
23
- "mcp",
24
- "claude",
25
- "cursor",
26
- "api-gateway",
27
- "compute",
28
- "gpu",
29
- "marketplace",
30
- "exchange",
31
- "wanan"
32
- ],
33
- "author": "AIXX (Wanan Exchange)",
34
- "license": "ISC",
35
- "engines": {
36
- "node": ">=18"
37
- }
38
- }
1
+ {
2
+ "name": "aixxai",
3
+ "version": "1.7.0",
4
+ "description": "AIXX CLI - 让你的AI调用万物。One command, every AI model. By AIXX (Wanan Exchange), the verification-first compute exchange. 安装:npx aixxai",
5
+ "type": "module",
6
+ "bin": {
7
+ "aixx": "./bin/aixx.js"
8
+ },
9
+ "scripts": {
10
+ "test": "node bin/aixx.js --version"
11
+ },
12
+ "keywords": [
13
+ "aixx",
14
+ "aixxai",
15
+ "ai",
16
+ "llm",
17
+ "gateway",
18
+ "openai",
19
+ "glm",
20
+ "kimi",
21
+ "skill",
22
+ "agent",
23
+ "mcp",
24
+ "claude",
25
+ "cursor",
26
+ "api-gateway",
27
+ "compute",
28
+ "gpu",
29
+ "marketplace",
30
+ "exchange",
31
+ "wanan"
32
+ ],
33
+ "author": "AIXX (Wanan Exchange)",
34
+ "license": "ISC",
35
+ "engines": {
36
+ "node": ">=18"
37
+ }
38
+ }
@@ -163,8 +163,31 @@ export async function balance(subArgs) {
163
163
  console.log(`💳 账户总额度:¥${totalCny.toFixed(2)}($${hardLimitUsd.toFixed(2)})`);
164
164
  }
165
165
  console.log('────────────────────────────────────');
166
+
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额度查询失败不影响主流程 */ }
186
+ }
187
+
166
188
  console.log('\n💡 提示:');
167
189
  console.log(' - 新用户注册送 $0.5 试用额度');
168
190
  console.log(' - glm-4-air 便宜,省着用能聊很久');
169
- console.log(' - 余额不足时运行 aixx recharge 查看充值方式\n');
191
+ console.log(' - 余额不足时运行 aixx recharge 查看充值方式');
192
+ console.log(' - 一条命令看全貌:aixx status\n');
170
193
  }
@@ -1,96 +1,84 @@
1
- /**
2
- * AIXX CLI - search 命令
3
- *
4
- * 搜索AIXX能力库(数据/技能)。免key接口,未注册也能搜——
5
- * 目的:让用户先看到"有什么、多少钱",再决定要不要装。
6
- *
7
- * 接口:POST {DEFAULT_BASE_URL}/capability body: {need: 关键词}
8
- * 响应:{matched, capabilities:[{id,name,description,pricing:{per_use,weekly,monthly,free_quota},
9
- * match_score,estimated_time}]},可能带 compliance_blocked(合规拦截,服务端会给message)
10
- *
11
- * 注意:搜到的能力不是装到本地的,装好AIXX技能后AI直接说需求即可调用。
12
- */
13
-
14
- import { DEFAULT_BASE_URL } from '../../bin/aixx.js';
15
- import { detectAixxSkillDirs } from './install.js';
16
-
17
- // 与 install/balance 同款:统一 15 秒超时 + 网络/超时异常转友好提示
18
- const FETCH_TIMEOUT = 15000;
19
- function friendlyNetErr(err) {
20
- return err?.name === 'TimeoutError' || err?.name === 'AbortError'
21
- ? '连接超时,请检查网络'
22
- : err?.message || String(err);
23
- }
24
-
25
- // 描述压成一句话并截断(≤60字)
26
- function oneLine(text, max = 60) {
27
- const line = String(text || '').replace(/\s+/g, ' ').trim();
28
- return line.length > max ? line.slice(0, max) + '…' : line;
29
- }
30
-
31
- export async function search(subArgs) {
32
- const keyword = subArgs.filter(a => a && !a.startsWith('-')).join(' ').trim();
33
-
34
- // 无关键词:给用法示例,别让用户干瞪眼
35
- if (!keyword) {
36
- console.log('用法: aixx search <关键词>\n');
37
- console.log('示例:');
38
- console.log(' aixx search 抖音数据 查抖音相关的数据能力');
39
- console.log(' aixx search UI设计 查设计相关的技能');
40
- return;
41
- }
42
-
43
- console.log(`🔍 搜索AIXX能力: ${keyword}\n`);
44
-
45
- // 免key接口,不加任何认证头
46
- const baseUrl = process.env.AIXX_BASE_URL || DEFAULT_BASE_URL;
47
- let data;
48
- try {
49
- const resp = await fetch(`${baseUrl}/capability`, {
50
- method: 'POST',
51
- headers: { 'Content-Type': 'application/json' },
52
- body: JSON.stringify({ need: keyword }),
53
- signal: AbortSignal.timeout(FETCH_TIMEOUT),
54
- });
55
- if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
56
- data = await resp.json();
57
- } catch (err) {
58
- console.error(`❌ 搜索失败: ${friendlyNetErr(err)}`);
59
- console.error(' 也可以直接到官网浏览全部能力: https://www.aixx.vip/cloud.html');
60
- process.exit(1);
61
- }
62
-
63
- // 合规拦截:如实转达服务端说法
64
- if (data?.compliance_blocked) {
65
- console.log(`⛔ ${data.message || '该关键词被合规策略拦截,换个说法试试'}`);
66
- return;
67
- }
68
-
69
- const caps = Array.isArray(data?.capabilities) ? data.capabilities : [];
70
- if (!data?.matched || caps.length === 0) {
71
- console.log(`没有找到与"${keyword}"相关的能力。`);
72
- console.log('建议换个关键词再试试,比如:抖音数据、小红书、UI设计、视频脚本。');
73
- return;
74
- }
75
-
76
- caps.forEach((cap, i) => {
77
- // data-*前缀的id是数据接口,其余是技能
78
- const type = cap.id?.startsWith('data-') ? '数据' : '技能';
79
- console.log(`${i + 1}. ${cap.name || '未命名'} [${type}]`);
80
- console.log(` ${oneLine(cap.description)}`);
81
- const tags = [];
82
- if (cap.pricing?.per_use !== undefined && cap.pricing?.per_use !== null) {
83
- tags.push("$1.99 一次买断·永久使用");
84
- }
85
- if ((cap.pricing?.free_quota || 0) > 0) {
86
-
87
- }
88
- tags.push(`ID: ${cap.id}`);
89
- console.log(` ${tags.join(' · ')}`);
90
- });
91
-
92
- console.log('\n以上能力无需单独安装——安装AIXX技能后,你的AI直接说需求即可调用(能力ID给AI看就行)');
93
- if (detectAixxSkillDirs().length === 0) {
94
- console.log('还没安装AIXX技能?运行 npx aixxai install 一键开通');
95
- }
96
- }
1
+ /**
2
+ * AIXX CLI - search 命令
3
+ *
4
+ * 搜索AIXX可用AI模型。GET {DEFAULT_BASE_URL}/models(OpenAI兼容·装机key可查),
5
+ * 客户端按关键词过滤——1121千问终检③:旧 /capability 端点已退役404,换本端点。
6
+ *
7
+ * 响应:{data:[{id,object,created,owned_by}]}(159+模型)
8
+ *
9
+ * 注意:模型列表只读展示;调用走你自己的agent(key已在本地)。
10
+ */
11
+
12
+ import { DEFAULT_BASE_URL } from '../../bin/aixx.js';
13
+ import { existsSync, readFileSync } from 'fs';
14
+ import { join } from 'path';
15
+ import { homedir } from 'os';
16
+
17
+ // 与 install/balance 同款:统一 15 秒超时 + 网络/超时异常转友好提示
18
+ const FETCH_TIMEOUT = 15000;
19
+ function friendlyNetErr(err) {
20
+ return err?.name === 'TimeoutError' || err?.name === 'AbortError'
21
+ ? '连接超时,请检查网络'
22
+ : err?.message || String(err);
23
+ }
24
+
25
+ function loadKey() {
26
+ if (process.env.AIXX_API_KEY) return process.env.AIXX_API_KEY;
27
+ try {
28
+ const f = join(homedir(), '.aixx', 'config.json');
29
+ if (existsSync(f)) return JSON.parse(readFileSync(f, 'utf-8')).AIXX_API_KEY || '';
30
+ } catch { /* 无key走未登录路径 */ }
31
+ return '';
32
+ }
33
+
34
+ export async function search(subArgs) {
35
+ const keyword = subArgs.filter(a => a && !a.startsWith('-')).join(' ').trim();
36
+
37
+ // 无关键词:给用法示例,别让用户干瞪眼
38
+ if (!keyword) {
39
+ console.log('用法: aixx search <关键词>\n');
40
+ console.log('示例:');
41
+ console.log(' aixx search glm 查GLM系模型');
42
+ console.log(' aixx search deepseek 查DeepSeek系模型');
43
+ console.log(' aixx market tickers 查GPU行情标的');
44
+ return;
45
+ }
46
+
47
+ console.log(`🔍 搜索AIXX模型: ${keyword}\n`);
48
+
49
+ // /v1/models(OpenAI兼容)——装机key即身份,与对话同源
50
+ const baseUrl = process.env.AIXX_BASE_URL || DEFAULT_BASE_URL;
51
+ const apiKey = loadKey();
52
+
53
+ let data;
54
+ try {
55
+ const resp = await fetch(`${baseUrl}/models`, {
56
+ headers: apiKey ? { Authorization: `Bearer ${apiKey}` } : {},
57
+ signal: AbortSignal.timeout(FETCH_TIMEOUT),
58
+ });
59
+ if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
60
+ data = await resp.json();
61
+ } catch (err) {
62
+ console.error(`❌ 搜索失败: ${friendlyNetErr(err)}`);
63
+ console.error(' 也可以直接到官网浏览全部模型: https://console.aixx.ai');
64
+ process.exit(1);
65
+ }
66
+
67
+ const caps = (Array.isArray(data?.data) ? data.data : [])
68
+ .filter((m) => String(m.id || '').toLowerCase().includes(keyword.toLowerCase()));
69
+
70
+ if (caps.length === 0) {
71
+ console.log(`没有找到与"${keyword}"相关的模型。`);
72
+ console.log('建议换个关键词再试试,比如:glm、deepseek、kimi、qwen、llama。');
73
+ console.log('找GPU行情数据?用 aixx market tickers 或 aixx market consumer <型号>。');
74
+ return;
75
+ }
76
+
77
+ console.log(`共 ${caps.length} 个匹配:\n`);
78
+ caps.slice(0, 10).forEach((m, i) => {
79
+ console.log(`${i + 1}. ${m.id} (${m.owned_by || 'aixx'})`);
80
+ });
81
+ if (caps.length > 10) console.log(`… 其余 ${caps.length - 10} 个略(调 aixx search <更精确关键词>)`);
82
+
83
+ console.log('\n以上模型你的AI已可直接调用(key在本地);行情数据用 aixx market / aixx status 查看。');
84
+ }