dsh-desktop-statusbar 3.0.7 → 3.0.8

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.
@@ -372,6 +372,28 @@
372
372
  "label": "OpenAI",
373
373
  "source": "https://platform.openai.com/docs/pricing",
374
374
  "models": [
375
+ {
376
+ "name": "gpt-6.2-astra",
377
+ "currency": "USD",
378
+ "input": 8,
379
+ "cacheRead": 0.4,
380
+ "cacheWrite": 10,
381
+ "output": 40,
382
+ "note": "Standard 档、短上下文档价格;Batch/Flex 为 5 折,Fast 为 2x,Ultrafast 2027-02-28 前 3x、之后 6x;30m 缓存写入价。",
383
+ "source": "https://platform.openai.com/docs/pricing",
384
+ "verifiedAt": "2026-11-22"
385
+ },
386
+ {
387
+ "name": "gpt-6.2-sol",
388
+ "currency": "USD",
389
+ "input": 2,
390
+ "cacheRead": 0.1,
391
+ "cacheWrite": 2.5,
392
+ "output": 10,
393
+ "note": "Standard 档、短上下文档价格;Batch/Flex 为 5 折,Fast 为 2x,Ultrafast 2027-02-28 前 3x、之后 6x;30m 缓存写入价。",
394
+ "source": "https://platform.openai.com/docs/pricing",
395
+ "verifiedAt": "2026-11-22"
396
+ },
375
397
  {
376
398
  "name": "gpt-6-astra",
377
399
  "currency": "USD",
@@ -417,8 +439,8 @@
417
439
  "verifiedAt": "2026-11-04"
418
440
  }
419
441
  ],
420
- "note": "o 系列仅 o3 / o3-pro 仍在价格页;gpt-5.6-sol 另在 Cyber 表中出现(同价)。图像/音频/转写/嵌入模型与微调价格未收录。",
421
- "retention": "官网“最新”折叠组 4 条:GPT-6 Astra 旗舰 + GPT-6.1 的 sol/terra + gpt-6-luna 轻量档;gpt-6-sol 被 6.1-sol 取代,5.x/4.x/o 系列及 cyber/rosalind/realtime 等专用档已删。"
442
+ "note": "o 系列仅 o3 / o3-pro 仍在价格页;gpt-5.6-sol 另在 Cyber 表中出现(同价)。GPT-6.2(Astra/Sol)已于 2026-11-22 补录。图像/音频/转写/嵌入模型与微调价格未收录。",
443
+ "retention": "官网“最新”折叠组 4 条:GPT-6 Astra 旗舰 + GPT-6.1 的 sol/terra + gpt-6-luna 轻量档;2026-11-22 补录 GPT-6.2 的 Astra/Sol 两条(共 6 条);gpt-6-sol 被 6.1-sol 取代,5.x/4.x/o 系列及 cyber/rosalind/realtime 等专用档已删。"
422
444
  }
423
445
  ],
424
446
  "verification": [
@@ -1,4 +1,4 @@
1
- # 官方模型目录(2026-11-04 核实;2026-11-10 补录 Anthropic Fable 5.2)
1
+ # 官方模型目录(2026-11-04 核实;2026-11-10 补录 Anthropic Fable 5.2;2026-11-22 补录 OpenAI GPT-6.2)
2
2
 
3
3
  数据来源均为各厂商官网定价页原文,价格单位为**每百万 tokens**,币种见表格。
4
4
  表格列含义:input = 缓存未命中的输入价;cacheRead = 缓存命中价;cacheWrite = 缓存写入价(Anthropic 取 5m TTL,Kimi 取 5min TTL);output = 输出价。`—` 表示官网未公布,未做任何推算。
@@ -20,7 +20,7 @@
20
20
  | xAI Grok | 1 | 1 | https://docs.x.ai/docs/pricing |
21
21
  | 小米 MiMo | 3 | 3 | https://mimo.mi.com/static/docs/price/pay-as-you-go.md |
22
22
  | Muse (Meta) | 2 | 2 | https://dev.meta.ai/docs/pricing-rate-limits |
23
- | OpenAI | 4 | 4 | https://platform.openai.com/docs/pricing |
23
+ | OpenAI | 6 | 6 | https://platform.openai.com/docs/pricing |
24
24
 
25
25
  ## DeepSeek
26
26
 
@@ -142,10 +142,12 @@
142
142
 
143
143
  来源:https://platform.openai.com/docs/pricing
144
144
 
145
- 保留依据:官网“最新”折叠组 4 条:GPT-6 Astra 旗舰 + GPT-6.1 的 sol/terra + gpt-6-luna 轻量档;gpt-6-sol 被 6.1-sol 取代,5.x/4.x/o 系列及 cyber/rosalind/realtime 等专用档已删。
145
+ 保留依据:官网“最新”折叠组 4 条 + 2026-11-22 补录的 GPT-6.2 Astra/Sol 两条(共 6 条):GPT-6 Astra 旗舰 + GPT-6.1 的 sol/terra + gpt-6-luna 轻量档;gpt-6-sol 被 6.1-sol 取代,5.x/4.x/o 系列及 cyber/rosalind/realtime 等专用档已删。
146
146
 
147
147
  | 模型(API 名) | 币种 | input / cacheRead / cacheWrite / output | 备注 |
148
148
  | --- | --- | --- | --- |
149
+ | `gpt-6.2-astra` | USD | 8 / 0.4 / 10 / 40 | Standard 档、短上下文档价格;Batch/Flex 为 5 折,Fast 为 2x,Ultrafast 2027-02-28 前 3x、之后 6x;30m 缓存写入价。 |
150
+ | `gpt-6.2-sol` | USD | 2 / 0.1 / 2.5 / 10 | Standard 档、短上下文档价格;Batch/Flex 为 5 折,Fast 为 2x,Ultrafast 2027-02-28 前 3x、之后 6x;30m 缓存写入价。 |
149
151
  | `gpt-6-astra` | USD | 10 / 1 / 12.5 / 50 | Standard 档、短上下文档价格;Batch/Flex 为 5 折,Fast 为 2x,Ultrafast 为 6x;30m 缓存写入价,12h 写入为 30m 的 2 倍。 |
150
152
  | `gpt-6.1-sol` | USD | 2 / 0.1 / 2.5 / 10 | Standard 档、短上下文档价格;Batch/Flex 为 5 折,Fast 为 2x,Ultrafast 为 6x;30m 缓存写入价,12h 写入为 30m 的 2 倍。 |
151
153
  | `gpt-6.1-terra` | USD | 1 / 0.05 / 1.25 / 5 | Standard 档、短上下文档价格;Batch/Flex 为 5 折,Fast 为 2x,Ultrafast 为 6x;30m 缓存写入价,12h 写入为 30m 的 2 倍。 |
@@ -858,6 +858,45 @@ function magpieModelPrefix(model) {
858
858
  return slash > 0 ? text.slice(0, slash) : null;
859
859
  }
860
860
 
861
+ /**
862
+ * 模型 id → quotas 里真实存在的 provider(通用最长前缀匹配,绝不写死任何站名)。
863
+ *
864
+ * 背景:Magpie 的 `/v1/models` 里 `owned_by` 与 quotas 的 `provider` **不一定同名**(实测
865
+ * `owned_by = work`,而 quotas 的 provider 是 `work/codex`)。当 owned_by / 前缀 / hint 都
866
+ * 找不到条目时,用「模型 id 的最长前缀」去和 quotas 的 provider 做**路径前缀**匹配:
867
+ * 模型 `work/codex/gpt-6-luna` 的 `work/codex` 前缀正好等于 provider `work/codex`。
868
+ * 任何形如 `<provider>/<model>` 的模型都适用。
869
+ *
870
+ * 只在**唯一**最长前缀命中时返回(多个 provider 同长度前缀命中则 null,不瞎挑);
871
+ * 匹配忽略大小写,先转小写再比。
872
+ */
873
+ function magpieModelQuotaProvider(quotasData, model) {
874
+ const want = String(model === undefined || model === null ? '' : model).trim().toLowerCase();
875
+ if (want.length === 0) return null;
876
+ const list = quotasData !== null && quotasData !== undefined && Array.isArray(quotasData.data) ? quotasData.data : [];
877
+ const providers = [];
878
+ for (let i = 0; i < list.length; i += 1) {
879
+ const one = list[i];
880
+ if (one === null || one === undefined || typeof one.provider !== 'string') continue;
881
+ const name = one.provider.trim().toLowerCase();
882
+ if (name.length === 0) continue;
883
+ if (providers.indexOf(name) < 0) providers.push(name);
884
+ }
885
+ let best = null;
886
+ for (let i = 0; i < providers.length; i += 1) {
887
+ const name = providers[i];
888
+ /* 必须作为「路径段前缀」命中:模型 = provider 或以 provider + '/' 开头。 */
889
+ if (want === name || want.startsWith(name + '/')) {
890
+ if (best === null || name.length > best.length) best = name;
891
+ }
892
+ }
893
+ if (best === null) return null;
894
+ /* 唯一性:长度相同但内容不同的前缀都算命中 ⇒ 拒绝(无法判定)。 */
895
+ const sameLen = providers.filter((one) => one.length === best.length && (want === one || want.startsWith(one + '/')));
896
+ if (sameLen.length > 1) return null;
897
+ return best;
898
+ }
899
+
861
900
  /** quotas 里属于某个 provider 的账号条目(provider 名大小写不敏感;orbi 是 DSH 侧对 orbis 的写法)。 */
862
901
  function magpieQuotaEntries(quotasData, provider) {
863
902
  let want = String(provider === undefined || provider === null ? '' : provider).trim().toLowerCase();
@@ -913,7 +952,51 @@ function magpieParseMoney(text) {
913
952
  return { currency, amount };
914
953
  }
915
954
 
916
- /** 一个账号 → 统一口径 `{ mode:'credits', remaining, limit }` / `{ mode:'money', currency, amount }`;认不出 null。 */
955
+ /**
956
+ * 订阅型配额窗口里的百分比:窗口同时给出有限数字的 used/remaining(0–100)时认作
957
+ * 「已用/剩余百分比」。判据与积分窗口互斥:
958
+ * · 带 unit === 'credits' 的窗口是积分,不是百分比(交给上面 credits 那条);
959
+ * · image-only / 文本占位窗口(例如 name 含 image、或 used/remaining 不是有限数字)不算。
960
+ * 认不出返回 null。多窗口取「已用最多(剩余最少)」的那个,与 zhipu-quota 取最紧窗口同口径。
961
+ */
962
+ function magpieSubscriptionPercentWindow(entry) {
963
+ const list = entry !== null && entry !== undefined && Array.isArray(entry.windows) ? entry.windows : [];
964
+ const windows = [];
965
+ for (let i = 0; i < list.length; i += 1) {
966
+ const one = list[i];
967
+ if (one === null || one === undefined || typeof one !== 'object') continue;
968
+ if (one.unit === 'credits') continue;
969
+ const rawName = typeof one.name === 'string' ? one.name : '';
970
+ const name = rawName.toLowerCase();
971
+ if (name.indexOf('image') >= 0) continue;
972
+ const used = Number(one.used);
973
+ const remaining = Number(one.remaining);
974
+ if (Number.isFinite(used) !== true || Number.isFinite(remaining) !== true) continue;
975
+ if (used < 0 || remaining < 0) continue;
976
+ /* 保留有限 limit>0:多账号合并时按 limit 加权(没有 limit 的窗口按账号数等权)。 */
977
+ const limit = Number(one.limit);
978
+ const window = { name: rawName, used: used, remaining: remaining };
979
+ if (Number.isFinite(limit) === true && limit > 0) window.limit = limit;
980
+ windows.push(window);
981
+ }
982
+ if (windows.length === 0) return null;
983
+ /* primary 优先「名字含 5 或 hour」的窗口(五小时额度);没有五小时再取已用最大窗口。 */
984
+ const fiveHour = windows.filter((one) => {
985
+ const name = one.name.toLowerCase();
986
+ return name.indexOf('5') >= 0 || name.indexOf('hour') >= 0;
987
+ })[0];
988
+ let primary = fiveHour;
989
+ if (primary === undefined) {
990
+ primary = windows[0];
991
+ for (let i = 1; i < windows.length; i += 1) {
992
+ if (windows[i].used > primary.used) primary = windows[i];
993
+ }
994
+ }
995
+ return { primary: primary, windows: windows };
996
+ }
997
+
998
+ /** 一个账号 → 统一口径 `{ mode:'credits', remaining, limit }` / `{ mode:'money', currency, amount }`
999
+ * / `{ mode:'percent', used, remaining }`;认不出 null。 */
917
1000
  function magpieEntryPrimary(entry) {
918
1001
  if (entry === null || entry === undefined || typeof entry !== 'object') return null;
919
1002
  if (typeof entry.balance === 'string' && entry.balance.trim().length > 0) {
@@ -926,6 +1009,11 @@ function magpieEntryPrimary(entry) {
926
1009
  const limit = Number(window.limit);
927
1010
  if (remaining !== null && Number.isFinite(limit) && limit > 0) return { mode: 'credits', remaining: remaining, limit: limit };
928
1011
  }
1012
+ /* 订阅型:没有 credits 窗口时,used/remaining 百分比窗口就是它的额度口径。 */
1013
+ const percent = magpieSubscriptionPercentWindow(entry);
1014
+ if (percent !== null) {
1015
+ return { mode: 'percent', used: percent.primary.used, remaining: percent.primary.remaining, windows: percent.windows };
1016
+ }
929
1017
  return null;
930
1018
  }
931
1019
 
@@ -956,7 +1044,7 @@ function magpieAccountRows(entries, providerName) {
956
1044
  *
957
1045
  * @param {object} quotasData `/v1/magpie/quotas` 的 JSON
958
1046
  * @param {{provider?:string, providerName?:string, account?:string|null}} options
959
- * @returns {{ok:true, mode:'credits'|'money', currency, total, isCredits?, rewards?, toppedUp?, granted?, parts?, providerName, account}
1047
+ * @returns {{ok:true, mode:'credits'|'money'|'percent', currency, total, isCredits?, isPercent?, rewards?, toppedUp?, granted?, parts?, providerName, account}
960
1048
  * |{ok:false, reason:string, detail?, providerName}}
961
1049
  */
962
1050
  function magpieBalanceOf(quotasData, options) {
@@ -1006,6 +1094,90 @@ function magpieBalanceOf(quotasData, options) {
1006
1094
  providerName: providerName, account: accountName,
1007
1095
  };
1008
1096
  }
1097
+ if (mode === 'percent') {
1098
+ /* 订阅型配额(多账号综合口径):收集 selected 所有账号的 percent windows,**按窗口名归为一类**
1099
+ (name 含 5/hour → fiveHour,含 7/day → sevenDay,其余按原始 name),同类窗口跨账号合并:
1100
+ · 有有限 limit>0 的窗口按 limit 加权平均 used/remaining;
1101
+ · 否则按账号数等权平均 used/remaining。
1102
+ total = fiveHour 合并后的已用百分比;没有 fiveHour 时取合并后 used 最大的一类。
1103
+ 返回的 windows 是合并后的列表(每条 name/used/remaining),供 creditsPanel 画条。
1104
+ 单账号时合并结果 = 该账号原窗口,行为不变。绝不写死任何站名 / 账号。 */
1105
+ const classify = (name) => {
1106
+ const text = String(name === undefined || name === null ? '' : name).toLowerCase();
1107
+ if (text.indexOf('5') >= 0 || text.indexOf('hour') >= 0) return 'fiveHour';
1108
+ if (text.indexOf('7') >= 0 || text.indexOf('day') >= 0) return 'sevenDay';
1109
+ return String(name === undefined || name === null ? '' : name);
1110
+ };
1111
+ /* 依出现顺序聚合各类。每类记录:各账号的窗口条目(带账号名)、是否全部带有限 limit>0。
1112
+ 账号名取 entry.user(其次 entry.plan,最后 'account'),供下钻时逐账号展示。
1113
+ ⚠ percent 口径**始终汇总全部账号**(与 WorkBuddy 积分统一口径):这里遍历 entries,
1114
+ 而不是 selected —— 否则 Magpie route 返回了某账号时,chosen 会只剩它一个、漏掉其他账号。
1115
+ 金额/积分分支仍按 chosen/selected 的既有语义,不受此影响。 */
1116
+ const whoOf = (entry) => (typeof entry.user === 'string' && entry.user.length > 0
1117
+ ? entry.user
1118
+ : (typeof entry.plan === 'string' && entry.plan.length > 0 ? entry.plan : 'account'));
1119
+ const groups = [];
1120
+ const groupOf = {};
1121
+ for (let a = 0; a < entries.length; a += 1) {
1122
+ const entry = entries[a];
1123
+ const who = whoOf(entry);
1124
+ const pct = magpieSubscriptionPercentWindow(entry);
1125
+ if (pct === null) continue;
1126
+ for (let w = 0; w < pct.windows.length; w += 1) {
1127
+ const one = pct.windows[w];
1128
+ const used = Number(one.used);
1129
+ const remaining = Number(one.remaining);
1130
+ if (Number.isFinite(used) !== true || Number.isFinite(remaining) !== true) continue;
1131
+ const key = classify(one.name);
1132
+ let acc = groupOf[key];
1133
+ if (acc === undefined) {
1134
+ acc = { key: key, name: typeof one.name === 'string' ? one.name : key, entries: [], allLimit: true };
1135
+ groupOf[key] = acc;
1136
+ groups.push(acc);
1137
+ }
1138
+ const limit = Number(one.limit);
1139
+ const useLimit = Number.isFinite(limit) === true && limit > 0;
1140
+ if (useLimit !== true) acc.allLimit = false;
1141
+ acc.entries.push({ name: who, used: used, remaining: remaining, limit: useLimit ? limit : 0 });
1142
+ }
1143
+ }
1144
+ const merged = [];
1145
+ for (let g = 0; g < groups.length; g += 1) {
1146
+ const acc = groups[g];
1147
+ if (acc.entries.length === 0) continue;
1148
+ let weight = 0;
1149
+ let sumUsed = 0;
1150
+ let sumRemain = 0;
1151
+ for (let e = 0; e < acc.entries.length; e += 1) {
1152
+ const one = acc.entries[e];
1153
+ /* 全部窗口都有有限 limit>0 ⇒ 按 limit 加权;否则按账号数(条目数)等权。 */
1154
+ const wgt = acc.allLimit ? one.limit : 1;
1155
+ weight += wgt;
1156
+ sumUsed += one.used * wgt;
1157
+ sumRemain += one.remaining * wgt;
1158
+ }
1159
+ if (weight <= 0) continue;
1160
+ /* 每个合并窗口带 items(逐账号明细):name=账号名、used/remaining=该账号本窗口值。 */
1161
+ const items = acc.entries.map((one) => ({ name: one.name, used: one.used, remaining: one.remaining }));
1162
+ merged.push({ key: acc.key, name: acc.name, used: sumUsed / weight, remaining: sumRemain / weight, items: items });
1163
+ }
1164
+ if (merged.length === 0) {
1165
+ return { ok: false, reason: 'magpie-no-balance-info', providerName: providerName };
1166
+ }
1167
+ const fiveHour = merged.filter((one) => one.key === 'fiveHour')[0];
1168
+ let primary = fiveHour;
1169
+ if (primary === undefined) {
1170
+ primary = merged[0];
1171
+ for (let i = 1; i < merged.length; i += 1) {
1172
+ if (merged[i].used > primary.used) primary = merged[i];
1173
+ }
1174
+ }
1175
+ return {
1176
+ ok: true, mode: 'percent', isPercent: true, total: primary.used.toFixed(2) + '%', currency: '',
1177
+ windows: merged.map((one) => ({ key: one.key, name: one.name, used: one.used, remaining: one.remaining, items: one.items })),
1178
+ parts: [], providerName: providerName, account: accountName,
1179
+ };
1180
+ }
1009
1181
  let remain = 0;
1010
1182
  for (let i = 0; i < same.length; i += 1) remain += same[i].remaining;
1011
1183
  return {
@@ -1037,6 +1209,6 @@ function magpieAccountFromRoute(routeData) {
1037
1209
 
1038
1210
  export {
1039
1211
  adapters, adapterFor, adaptersFor, BALANCE_PROVIDER_ENV, pluginRoutesIn, parseDeepSeekBalance, LOCAL_READONLY_VERBS, LOCAL_NEVER_PROBE,
1040
- magpieModelProvider, magpieModelPrefix, magpieQuotaEntries, magpieBalanceOf,
1212
+ magpieModelProvider, magpieModelPrefix, magpieModelQuotaProvider, magpieQuotaEntries, magpieBalanceOf,
1041
1213
  magpieAccountFromRoute, magpieParseMoney, magpieEntryPrimary,
1042
1214
  };