dsh-multi-router 0.6.8 → 0.6.9

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.
@@ -6,20 +6,20 @@ import {
6
6
  refreshWorkBuddyCheckinCredential,
7
7
  supportsCheckin,
8
8
  workbuddyToken
9
- } from "./chunk-TKVFF7LN.js";
9
+ } from "./chunk-RMIZSZ6B.js";
10
10
  import {
11
11
  discoverLocalAccounts,
12
12
  importAccount,
13
13
  localAccountKey,
14
14
  normalizeLocalAccountKey,
15
15
  readPortableCredential
16
- } from "./chunk-YZIARLWT.js";
16
+ } from "./chunk-2UM45OXY.js";
17
17
  import {
18
18
  modelWithCurrentPromotion
19
19
  } from "./chunk-KWXLQJS5.js";
20
20
  import {
21
21
  ApiService
22
- } from "./chunk-A4OIPIFX.js";
22
+ } from "./chunk-BK2JVL3Q.js";
23
23
  import {
24
24
  hostIsLoopback
25
25
  } from "./chunk-DNQPZMPF.js";
@@ -28,23 +28,24 @@ import {
28
28
  contextInfo,
29
29
  matchModel,
30
30
  resolveContext
31
- } from "./chunk-Q6A57FN3.js";
31
+ } from "./chunk-D726WROP.js";
32
32
  import {
33
33
  PROVIDERS,
34
34
  PROVIDER_NAMES,
35
35
  ROUTE_PRESETS,
36
36
  beijingDay,
37
+ creditRate,
37
38
  isFreeModel,
38
39
  routeReasoning,
39
40
  validateConfig,
40
41
  writePrivateJson
41
- } from "./chunk-XD52ZGZ5.js";
42
+ } from "./chunk-GEBZMIMA.js";
42
43
 
43
44
  // src/manager.mjs
44
45
  import { createHash, randomBytes as randomBytes3, timingSafeEqual } from "node:crypto";
45
46
 
46
47
  // package.json
47
- var version = "0.6.8";
48
+ var version = "0.6.9";
48
49
 
49
50
  // src/manager.mjs
50
51
  import { readFile as readFile4, mkdir as mkdir2, mkdtemp as mkdtemp2, rm as rm3 } from "node:fs/promises";
@@ -1387,6 +1388,12 @@ var Manager = class {
1387
1388
  const context = resolveContext(sources.map((s) => s.model), row.contextMode === "custom" ? row.contextWindow : null, row.contextWindow);
1388
1389
  const eligible = sources.filter((s) => contextInfo(s.model).maxContextWindow >= context.contextWindow);
1389
1390
  const models = eligible.map((s) => s.model), reasoning = routeReasoning(eligible);
1391
+ const rates = {};
1392
+ for (const source of eligible) {
1393
+ const rate = creditRate(source.model, this.telemetry.now());
1394
+ if (rate === void 0) continue;
1395
+ rates[source.accountId] = rates[source.accountId] === void 0 ? rate : Math.min(rates[source.accountId], rate);
1396
+ }
1390
1397
  return {
1391
1398
  ...row,
1392
1399
  ...context,
@@ -1394,6 +1401,7 @@ var Manager = class {
1394
1401
  supportsImages: models.length > 0 && models.every((m) => m.supportsImages),
1395
1402
  reasoning,
1396
1403
  eligibleAccountIds: [...new Set(eligible.map((s) => s.accountId))],
1404
+ creditRates: rates,
1397
1405
  maxTokens: Math.min(row.maxTokens, context.contextWindow, ...models.map((m) => m.maxTokens)),
1398
1406
  id,
1399
1407
  name: row.name ?? id,
@@ -2048,4 +2056,4 @@ export {
2048
2056
  Manager,
2049
2057
  managementHandler
2050
2058
  };
2051
- //# sourceMappingURL=chunk-JV4DLVV4.js.map
2059
+ //# sourceMappingURL=chunk-I2CZXH2A.js.map