librechat-data-provider 0.8.504 → 0.8.505
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/dist/{data-service-Dk-uLruo.js → data-service-CG5e1FOi.js} +80 -5
- package/dist/data-service-CG5e1FOi.js.map +1 -0
- package/dist/{data-service-BFGYAHRx.mjs → data-service-CwM4Cew0.mjs} +69 -6
- package/dist/data-service-CwM4Cew0.mjs.map +1 -0
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react-query/index.js +5 -1
- package/dist/react-query/index.js.map +1 -1
- package/dist/react-query/index.mjs +5 -1
- package/dist/react-query/index.mjs.map +1 -1
- package/dist/types/api-endpoints.d.ts +1 -0
- package/dist/types/config.d.ts +611 -90
- package/dist/types/data-service.d.ts +1 -0
- package/dist/types/keys.d.ts +1 -0
- package/dist/types/models.d.ts +10 -0
- package/dist/types/react-query/react-query-service.d.ts +2 -2
- package/dist/types/schemas.d.ts +14 -0
- package/dist/types/types/agents.d.ts +5 -0
- package/dist/types/types/runs.d.ts +81 -0
- package/dist/types/types.d.ts +10 -0
- package/package.json +1 -1
- package/dist/data-service-BFGYAHRx.mjs.map +0 -1
- package/dist/data-service-Dk-uLruo.js.map +0 -1
|
@@ -392,6 +392,27 @@ const openAILikeProviders = new Set([
|
|
|
392
392
|
const isOpenAILikeProvider = (provider) => {
|
|
393
393
|
return openAILikeProviders.has(provider ?? "");
|
|
394
394
|
};
|
|
395
|
+
/**
|
|
396
|
+
* Providers whose `usage_metadata.input_tokens` ALREADY INCLUDES cached tokens
|
|
397
|
+
* (`input_token_details.cache_*` is a subset, not an additional charge):
|
|
398
|
+
* Google/Vertex (`promptTokenCount`), OpenAI/Azure (`prompt_tokens`), and the
|
|
399
|
+
* OpenAI-compatible family. Anthropic/Bedrock keep cache values separate and
|
|
400
|
+
* additive. Single source of truth shared by the backend billing path
|
|
401
|
+
* (`packages/api/src/agents/usage.ts`) and the client usage normalization.
|
|
402
|
+
*/
|
|
403
|
+
const cacheSubsetProviders = new Set([
|
|
404
|
+
"openAI",
|
|
405
|
+
"azureOpenAI",
|
|
406
|
+
"google",
|
|
407
|
+
"vertexai",
|
|
408
|
+
"xai",
|
|
409
|
+
"deepseek",
|
|
410
|
+
"openrouter",
|
|
411
|
+
"moonshot"
|
|
412
|
+
]);
|
|
413
|
+
const inputTokensIncludesCache = (provider) => {
|
|
414
|
+
return cacheSubsetProviders.has(provider ?? "");
|
|
415
|
+
};
|
|
395
416
|
const isDocumentSupportedProvider = (provider) => {
|
|
396
417
|
return documentSupportedProviders.has(provider ?? "");
|
|
397
418
|
};
|
|
@@ -909,6 +930,8 @@ const tMessageSchema = zod.z.object({
|
|
|
909
930
|
feedback: feedbackSchema.optional(),
|
|
910
931
|
/** metadata */
|
|
911
932
|
metadata: zod.z.record(zod.z.unknown()).optional(),
|
|
933
|
+
/** Output tokens for assistant messages, calibrated prompt-side estimate for user messages */
|
|
934
|
+
tokenCount: zod.z.number().optional(),
|
|
912
935
|
contextMeta: zod.z.object({
|
|
913
936
|
calibrationRatio: zod.z.number().optional().describe("EMA ratio of provider-reported vs local token estimates; seeds the pruner on subsequent runs"),
|
|
914
937
|
encoding: zod.z.string().optional().describe("Tokenizer encoding used when this ratio was computed (e.g. \"claude\", \"o200k_base\")")
|
|
@@ -1767,6 +1790,7 @@ const tModelSpecSchema = zod.z.object({
|
|
|
1767
1790
|
showIconInMenu: zod.z.boolean().optional(),
|
|
1768
1791
|
showIconInHeader: zod.z.boolean().optional(),
|
|
1769
1792
|
showOnLanding: zod.z.boolean().optional(),
|
|
1793
|
+
conversation_starters: zod.z.array(zod.z.string()).optional(),
|
|
1770
1794
|
iconURL: zod.z.union([zod.z.string(), eModelEndpointSchema]).optional(),
|
|
1771
1795
|
authType: authTypeSchema.optional(),
|
|
1772
1796
|
hideBadgeRow: zod.z.boolean().optional(),
|
|
@@ -2453,6 +2477,7 @@ const searchEnabled = () => `${BASE_URL}/api/search/enable`;
|
|
|
2453
2477
|
const presets = () => `${BASE_URL}/api/presets`;
|
|
2454
2478
|
const deletePreset$1 = () => `${BASE_URL}/api/presets/delete`;
|
|
2455
2479
|
const aiEndpoints = () => `${BASE_URL}/api/endpoints`;
|
|
2480
|
+
const tokenConfig = () => `${BASE_URL}/api/endpoints/token-config`;
|
|
2456
2481
|
const models = () => `${BASE_URL}/api/models`;
|
|
2457
2482
|
const tokenizer = () => `${BASE_URL}/api/tokenizer`;
|
|
2458
2483
|
const login$1 = () => `${BASE_URL}/api/auth/login`;
|
|
@@ -3360,6 +3385,15 @@ const defaultAssistantsVersion = {
|
|
|
3360
3385
|
const baseEndpointSchema = zod.z.object({
|
|
3361
3386
|
streamRate: zod.z.number().optional(),
|
|
3362
3387
|
baseURL: zod.z.string().optional(),
|
|
3388
|
+
/**
|
|
3389
|
+
* Custom request headers forwarded to the provider on every request. Values
|
|
3390
|
+
* support the same placeholder resolution as custom endpoints — env vars
|
|
3391
|
+
* (`${VAR}`), user fields (`{{LIBRECHAT_USER_*}}`), and request-body fields
|
|
3392
|
+
* (`{{LIBRECHAT_BODY_CONVERSATIONID}}`). Primarily for routing built-in
|
|
3393
|
+
* providers through an AI gateway / reverse proxy that consumes metadata
|
|
3394
|
+
* headers (provider-native request shaping is preserved).
|
|
3395
|
+
*/
|
|
3396
|
+
headers: zod.z.record(zod.z.string()).optional(),
|
|
3363
3397
|
titlePrompt: zod.z.string().optional(),
|
|
3364
3398
|
titleModel: zod.z.string().optional(),
|
|
3365
3399
|
titleConvo: zod.z.boolean().optional(),
|
|
@@ -3556,6 +3590,14 @@ const endpointSchema = baseEndpointSchema.merge(zod.z.object({
|
|
|
3556
3590
|
}),
|
|
3557
3591
|
iconURL: zod.z.string().optional(),
|
|
3558
3592
|
modelDisplayLabel: zod.z.string().optional(),
|
|
3593
|
+
/**
|
|
3594
|
+
* Forces the endpoint to use a provider's native client / request format
|
|
3595
|
+
* instead of the default OpenAI-compatible client. Currently supports
|
|
3596
|
+
* `anthropic`, for endpoints that speak the Anthropic `/v1/messages` API
|
|
3597
|
+
* (Anthropic itself or Anthropic-compatible gateways). Omit for
|
|
3598
|
+
* OpenAI-compatible endpoints.
|
|
3599
|
+
*/
|
|
3600
|
+
provider: zod.z.literal("anthropic").optional(),
|
|
3559
3601
|
headers: zod.z.record(zod.z.string()).optional(),
|
|
3560
3602
|
addParams: addParamsSchema.optional(),
|
|
3561
3603
|
dropParams: zod.z.array(zod.z.string()).optional(),
|
|
@@ -3570,7 +3612,15 @@ const endpointSchema = baseEndpointSchema.merge(zod.z.object({
|
|
|
3570
3612
|
"system",
|
|
3571
3613
|
"user",
|
|
3572
3614
|
"assistant"
|
|
3573
|
-
]).optional()
|
|
3615
|
+
]).optional(),
|
|
3616
|
+
/** Static per-model token config: context window and per-million-token rates */
|
|
3617
|
+
tokenConfig: zod.z.record(zod.z.object({
|
|
3618
|
+
prompt: zod.z.number(),
|
|
3619
|
+
completion: zod.z.number(),
|
|
3620
|
+
context: zod.z.number(),
|
|
3621
|
+
cacheRead: zod.z.number().optional(),
|
|
3622
|
+
cacheWrite: zod.z.number().optional()
|
|
3623
|
+
})).optional()
|
|
3574
3624
|
}));
|
|
3575
3625
|
const azureEndpointSchema = zod.z.object({
|
|
3576
3626
|
groups: azureGroupConfigsSchema,
|
|
@@ -3797,6 +3847,12 @@ const interfaceSchema = zod.z.object({
|
|
|
3797
3847
|
retainAgentFiles: zod.z.boolean().optional(),
|
|
3798
3848
|
runCode: zod.z.boolean().optional(),
|
|
3799
3849
|
webSearch: zod.z.boolean().optional(),
|
|
3850
|
+
contextUsage: zod.z.boolean().optional(),
|
|
3851
|
+
contextCost: zod.z.boolean().optional(),
|
|
3852
|
+
currency: zod.z.object({
|
|
3853
|
+
code: zod.z.string(),
|
|
3854
|
+
rate: zod.z.number().positive()
|
|
3855
|
+
}).optional(),
|
|
3800
3856
|
peoplePicker: zod.z.object({
|
|
3801
3857
|
users: zod.z.boolean().optional(),
|
|
3802
3858
|
groups: zod.z.boolean().optional(),
|
|
@@ -3847,6 +3903,8 @@ const interfaceSchema = zod.z.object({
|
|
|
3847
3903
|
autoSubmitFromUrl: true,
|
|
3848
3904
|
runCode: true,
|
|
3849
3905
|
webSearch: true,
|
|
3906
|
+
contextUsage: true,
|
|
3907
|
+
contextCost: true,
|
|
3850
3908
|
peoplePicker: {
|
|
3851
3909
|
users: true,
|
|
3852
3910
|
groups: true,
|
|
@@ -4830,7 +4888,7 @@ let TTSProviders = /* @__PURE__ */ function(TTSProviders) {
|
|
|
4830
4888
|
/** Enum for app-wide constants */
|
|
4831
4889
|
let Constants = /* @__PURE__ */ function(Constants) {
|
|
4832
4890
|
/**
|
|
4833
|
-
* Key for the app's version. The placeholder `v0.8.
|
|
4891
|
+
* Key for the app's version. The placeholder `v0.8.7-rc1` is
|
|
4834
4892
|
* swapped in by `@rollup/plugin-replace` during `npm run build:data-provider`
|
|
4835
4893
|
* using the value of the root `package.json`'s `version` field. Consumers
|
|
4836
4894
|
* always import this via the built dist bundle (see `main` field in
|
|
@@ -4838,9 +4896,9 @@ let Constants = /* @__PURE__ */ function(Constants) {
|
|
|
4838
4896
|
* substituted value. Only tests that import the TypeScript source directly
|
|
4839
4897
|
* would observe the raw placeholder.
|
|
4840
4898
|
*/
|
|
4841
|
-
Constants["VERSION"] = "v0.8.
|
|
4899
|
+
Constants["VERSION"] = "v0.8.7-rc1";
|
|
4842
4900
|
/** Key for the Custom Config's version (librechat.yaml). */
|
|
4843
|
-
Constants["CONFIG_VERSION"] = "1.3.
|
|
4901
|
+
Constants["CONFIG_VERSION"] = "1.3.13";
|
|
4844
4902
|
/** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
|
|
4845
4903
|
Constants["NO_PARENT"] = "00000000-0000-0000-0000-000000000000";
|
|
4846
4904
|
/** Standard value to use whatever the submission prelim. `responseMessageId` is */
|
|
@@ -5267,6 +5325,7 @@ let QueryKeys = /* @__PURE__ */ function(QueryKeys) {
|
|
|
5267
5325
|
QueryKeys["models"] = "models";
|
|
5268
5326
|
QueryKeys["balance"] = "balance";
|
|
5269
5327
|
QueryKeys["endpoints"] = "endpoints";
|
|
5328
|
+
QueryKeys["tokenConfig"] = "tokenConfig";
|
|
5270
5329
|
QueryKeys["presets"] = "presets";
|
|
5271
5330
|
QueryKeys["searchResults"] = "searchResults";
|
|
5272
5331
|
QueryKeys["tokenCount"] = "tokenCount";
|
|
@@ -5692,6 +5751,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
|
|
|
5692
5751
|
getSkillStates: () => getSkillStates,
|
|
5693
5752
|
getSkillTree: () => getSkillTree,
|
|
5694
5753
|
getStartupConfig: () => getStartupConfig,
|
|
5754
|
+
getTokenConfig: () => getTokenConfig,
|
|
5695
5755
|
getToolCalls: () => getToolCalls,
|
|
5696
5756
|
getUser: () => getUser,
|
|
5697
5757
|
getUserBalance: () => getUserBalance,
|
|
@@ -5923,6 +5983,9 @@ const getStartupConfig = (options) => {
|
|
|
5923
5983
|
const getAIEndpoints = () => {
|
|
5924
5984
|
return request_default.get(aiEndpoints());
|
|
5925
5985
|
};
|
|
5986
|
+
const getTokenConfig = () => {
|
|
5987
|
+
return request_default.get(tokenConfig());
|
|
5988
|
+
};
|
|
5926
5989
|
const getModels = async () => {
|
|
5927
5990
|
return request_default.get(models());
|
|
5928
5991
|
};
|
|
@@ -7290,6 +7353,12 @@ Object.defineProperty(exports, "buildLoginRedirectUrl", {
|
|
|
7290
7353
|
return buildLoginRedirectUrl;
|
|
7291
7354
|
}
|
|
7292
7355
|
});
|
|
7356
|
+
Object.defineProperty(exports, "cacheSubsetProviders", {
|
|
7357
|
+
enumerable: true,
|
|
7358
|
+
get: function() {
|
|
7359
|
+
return cacheSubsetProviders;
|
|
7360
|
+
}
|
|
7361
|
+
});
|
|
7293
7362
|
Object.defineProperty(exports, "cancelMCPOAuth", {
|
|
7294
7363
|
enumerable: true,
|
|
7295
7364
|
get: function() {
|
|
@@ -7926,6 +7995,12 @@ Object.defineProperty(exports, "initialModelsConfig", {
|
|
|
7926
7995
|
return initialModelsConfig;
|
|
7927
7996
|
}
|
|
7928
7997
|
});
|
|
7998
|
+
Object.defineProperty(exports, "inputTokensIncludesCache", {
|
|
7999
|
+
enumerable: true,
|
|
8000
|
+
get: function() {
|
|
8001
|
+
return inputTokensIncludesCache;
|
|
8002
|
+
}
|
|
8003
|
+
});
|
|
7929
8004
|
Object.defineProperty(exports, "interfaceSchema", {
|
|
7930
8005
|
enumerable: true,
|
|
7931
8006
|
get: function() {
|
|
@@ -8515,4 +8590,4 @@ Object.defineProperty(exports, "webSearchSchema", {
|
|
|
8515
8590
|
}
|
|
8516
8591
|
});
|
|
8517
8592
|
|
|
8518
|
-
//# sourceMappingURL=data-service-
|
|
8593
|
+
//# sourceMappingURL=data-service-CG5e1FOi.js.map
|