@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.
- package/README.md +2 -2
- package/dist/api/routes.d.ts +1 -0
- package/dist/ccr/chat-completion-capture.d.ts +3 -0
- package/dist/ccr/config.d.ts +2 -0
- package/dist/ccr/effective-input-usage.d.ts +35 -0
- package/dist/ccr/plugin-install-routes.d.ts +6 -1
- package/dist/ccr/request-pipeline.d.ts +0 -23
- package/dist/ccr/usage-merge.d.ts +2 -0
- package/dist/ccr/usage-store.d.ts +21 -43
- package/dist/cjs/server.cjs +228 -234
- package/dist/cjs/server.cjs.map +4 -4
- package/dist/esm/server.mjs +228 -234
- package/dist/esm/server.mjs.map +4 -4
- package/dist/index.html +29 -29
- package/dist/provider-plugins/host.d.ts +1 -1
- package/dist/provider-plugins/types.d.ts +6 -0
- package/dist/services/quota-adapters.d.ts +10 -1
- package/dist/services/step-plan-quota.d.ts +35 -0
- package/dist/types/llm.d.ts +19 -0
- package/dist/utils/cache.d.ts +1 -0
- package/package.json +2 -2
|
@@ -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
|
|
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 {};
|
package/dist/types/llm.d.ts
CHANGED
|
@@ -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
|
} & {
|
package/dist/utils/cache.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wengine-ai/llms",
|
|
3
|
-
"version": "2.3.
|
|
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.
|
|
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",
|