@wengine-ai/llms 2.3.2435 → 2.3.2437

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.
@@ -8,4 +8,4 @@ export declare function reloadProviderRuntime(server: any, config: any, log: {
8
8
  info(msg: string): void;
9
9
  warn(msg: string): void;
10
10
  error(msg: string): void;
11
- }): void;
11
+ }, sourceLabel?: string): boolean;
@@ -44,6 +44,12 @@ export interface ProviderQuotaFigures {
44
44
  totalBalance?: number;
45
45
  /** ISO timestamp at which the 7d window resets. */
46
46
  resetTime7d?: string;
47
+ /** Explicit limit for the monthly (30d) window, when exposed. */
48
+ limitMonthly?: number;
49
+ /** Spend inside the monthly (30d) window. */
50
+ usedMonthlyBalance?: number;
51
+ /** ISO timestamp at which the monthly window resets. */
52
+ resetTimeMonthly?: string;
47
53
  /** Currency code; when absent the UI renders the figures as rate-limit units. */
48
54
  currency?: string;
49
55
  }
@@ -9,8 +9,15 @@ export interface ProviderQuotaResult {
9
9
  currency?: string;
10
10
  resetTime?: string;
11
11
  resetTime7d?: string;
12
+ /** Explicit limit for the monthly (30d) window, when the endpoint exposes one. */
13
+ limitMonthly?: number;
14
+ /** Spend/usage inside the monthly (30d) window. */
15
+ usedMonthlyBalance?: number;
16
+ /** ISO timestamp at which the monthly window resets. */
17
+ resetTimeMonthly?: string;
12
18
  }
13
19
  export interface QuotaAdapter {
20
+ readonly usesVolcengineCredentials?: boolean;
14
21
  queryQuota(provider: LLMProvider, timeoutMs: number, proxyUrl?: string): Promise<ProviderQuotaResult | null>;
15
22
  }
16
23
  /**
@@ -52,4 +59,6 @@ export declare function volcengineSigV4Sign(options: {
52
59
  /** UTC timestamp in YYYYMMDDTHHMMSSZ format (the X-Date header value) */
53
60
  xDate: string;
54
61
  }): Record<string, string>;
55
- export declare function getQuotaAdapter(baseUrl: string): QuotaAdapter | null;
62
+ export declare function parseLitellmUserBudgetUsage(payload: any): ProviderQuotaResult | null;
63
+ export declare function parseOneApiBillingUsage(subscription: any, usage: any): ProviderQuotaResult | null;
64
+ export declare function getQuotaAdapter(baseUrl: string, provider?: LLMProvider): QuotaAdapter | null;
@@ -0,0 +1,35 @@
1
+ import type { ConfigProvider } from "../types/llm";
2
+ import { resolveProviderProxyUrl } from "./proxy";
3
+ export interface StepPlanQuota {
4
+ state: "known" | "partial" | "stale" | "unavailable";
5
+ family: "token" | "coding" | "none";
6
+ name: string | null;
7
+ observedAt: number | null;
8
+ allowed: boolean | null;
9
+ windows: Array<{
10
+ id: "five_hour" | "weekly";
11
+ limited: boolean;
12
+ usedPercent: number | null;
13
+ resetsAt: number | null;
14
+ }>;
15
+ creditBuckets: Array<{
16
+ type: "subscription" | "topup";
17
+ total: string;
18
+ remaining: string;
19
+ usedPercent: number | null;
20
+ resetsAt: number | null;
21
+ expiresAt: number | null;
22
+ }>;
23
+ }
24
+ type Provider = Pick<ConfigProvider, "name" | "enabled" | "api_key" | "api_base_url" | "proxy_enabled">;
25
+ interface StepPlanQuotaRead {
26
+ get(providerName: string): StepPlanQuota | undefined;
27
+ }
28
+ /** Route-local account snapshots. These must never enter the model quota/health store. */
29
+ export declare class StepPlanQuotaCache {
30
+ private readonly entries;
31
+ poll(providers: Provider[], config: Parameters<typeof resolveProviderProxyUrl>[0]): Promise<StepPlanQuotaRead>;
32
+ private readCurrent;
33
+ private refresh;
34
+ }
35
+ export {};
@@ -52,7 +52,9 @@ export interface UnifiedMessage {
52
52
  signature?: string;
53
53
  };
54
54
  }
55
+ export declare const builtinWebSearch: unique symbol;
55
56
  export interface UnifiedTool {
57
+ [builtinWebSearch]?: true;
56
58
  type: "function";
57
59
  function: {
58
60
  name: string;
@@ -191,6 +193,16 @@ export interface LLMProvider {
191
193
  /** Optional Volcengine account Secret Access Key paired with quotaAccessKey.
192
194
  * Never projected into desktop DTOs, logs, or error messages. */
193
195
  quotaSecretKey?: string;
196
+ /** Optional LiteLLM personal access token for the relay GET /user/info
197
+ * budget API (self-user budget behind a LiteLLM proxy). The inference
198
+ * apiKey is normally route-restricted by such relays, so this separate
199
+ * token is required. Never projected into desktop DTOs, logs, or errors. */
200
+ quotaLitellmToken?: string;
201
+ /** Optional quota backend framework for private relays without a fixed
202
+ * public hostname: 'litellm' | 'newapi' | 'oneapi' (hyphenated aliases
203
+ * accepted). Selects the matching quota adapter ahead of hostname
204
+ * detection; unknown values are ignored. */
205
+ quotaFramework?: string;
194
206
  transformer?: {
195
207
  [key: string]: {
196
208
  use?: Transformer[];
@@ -234,6 +246,13 @@ export interface ConfigProvider {
234
246
  quota_token?: string;
235
247
  /** Optional sec_token for the Aliyun Bailian console official quota API (efm-fe 3.5.613 format) */
236
248
  quota_sec_token?: string;
249
+ /** Optional LiteLLM personal access token for the relay GET /user/info budget API */
250
+ quota_litellm_token?: string;
251
+ /** Optional quota backend framework selector (litellm | newapi | oneapi) */
252
+ quota_framework?: string;
253
+ /** Control-plane credentials for Volcengine Coding Plan quota probes. */
254
+ quotaAccessKey?: string;
255
+ quotaSecretKey?: string;
237
256
  transformer: {
238
257
  use?: string[] | Array<any>[];
239
258
  } & {
@@ -3,6 +3,7 @@ export interface Usage {
3
3
  output_tokens: number;
4
4
  cache_read_input_tokens: number;
5
5
  cache_creation_input_tokens: number;
6
+ usage_estimated?: boolean;
6
7
  }
7
8
  declare class LRUCache<K, V> {
8
9
  private capacity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wengine-ai/llms",
3
- "version": "2.3.2435",
3
+ "version": "2.3.2437",
4
4
  "description": "A universal LLM API transformation server",
5
5
  "main": "dist/cjs/server.cjs",
6
6
  "module": "dist/esm/server.mjs",
@@ -53,7 +53,7 @@
53
53
  "@fastify/static": "^8.2.0",
54
54
  "@google/genai": "^1.7.0",
55
55
  "@huggingface/tokenizers": "^0.0.6",
56
- "@wengine-ai/claude-code-router-shared": "^2.3.2435",
56
+ "@wengine-ai/claude-code-router-shared": "^2.3.2437",
57
57
  "adm-zip": "^0.5.16",
58
58
  "better-sqlite3": "^12.10.0",
59
59
  "dotenv": "^16.5.0",