librechat-data-provider 0.8.505 → 0.8.507

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.
@@ -376,8 +376,11 @@ const isOpenAILikeProvider = (provider) => {
376
376
  * Providers whose `usage_metadata.input_tokens` ALREADY INCLUDES cached tokens
377
377
  * (`input_token_details.cache_*` is a subset, not an additional charge):
378
378
  * Google/Vertex (`promptTokenCount`), OpenAI/Azure (`prompt_tokens`), and the
379
- * OpenAI-compatible family. Anthropic/Bedrock keep cache values separate and
380
- * additive. Single source of truth shared by the backend billing path
379
+ * OpenAI-compatible family. `@librechat/agents`' `getAnthropicUsageMetadata`
380
+ * folds `cache_creation` + `cache_read` into `input_tokens`, so Anthropic is a
381
+ * subset provider too; without this the cache portion is billed twice. Bedrock
382
+ * stays additive — its Converse path passes AWS `inputTokens` through unmodified.
383
+ * Single source of truth shared by the backend billing path
381
384
  * (`packages/api/src/agents/usage.ts`) and the client usage normalization.
382
385
  */
383
386
  const cacheSubsetProviders = new Set([
@@ -388,7 +391,8 @@ const cacheSubsetProviders = new Set([
388
391
  "xai",
389
392
  "deepseek",
390
393
  "openrouter",
391
- "moonshot"
394
+ "moonshot",
395
+ "anthropic"
392
396
  ]);
393
397
  const inputTokensIncludesCache = (provider) => {
394
398
  return cacheSubsetProviders.has(provider ?? "");
@@ -735,6 +739,7 @@ const anthropicSettings = {
735
739
  default: 1
736
740
  },
737
741
  promptCache: { default: true },
742
+ promptCacheTtl: { default: void 0 },
738
743
  thinking: { default: true },
739
744
  thinkingBudget: {
740
745
  min: 1024,
@@ -951,6 +956,7 @@ const tConversationSchema = z.object({
951
956
  endpoint: eModelEndpointSchema.nullable(),
952
957
  endpointType: eModelEndpointSchema.nullable().optional(),
953
958
  isArchived: z.boolean().optional(),
959
+ pinned: z.boolean().optional(),
954
960
  title: z.string().nullable().or(z.literal("New Chat")).default("New Chat"),
955
961
  user: z.string().optional(),
956
962
  messages: z.array(z.string()).optional(),
@@ -970,6 +976,7 @@ const tConversationSchema = z.object({
970
976
  maxContextTokens: coerceNumber.optional(),
971
977
  max_tokens: coerceNumber.optional(),
972
978
  promptCache: z.boolean().optional(),
979
+ promptCacheTtl: z.enum(["5m", "1h"]).optional(),
973
980
  system: z.string().optional(),
974
981
  thinking: z.boolean().optional(),
975
982
  thinkingBudget: coerceNumber.optional(),
@@ -1092,6 +1099,7 @@ const tQueryParamsSchema = tConversationSchema.pick({
1092
1099
  maxOutputTokens: true,
1093
1100
  /** @endpoints anthropic */
1094
1101
  promptCache: true,
1102
+ promptCacheTtl: true,
1095
1103
  thinking: true,
1096
1104
  thinkingBudget: true,
1097
1105
  thinkingLevel: true,
@@ -1334,7 +1342,10 @@ const openAIBaseSchema = tConversationSchema.pick({
1334
1342
  fileTokenLimit: true
1335
1343
  });
1336
1344
  const openAISchema = openAIBaseSchema.transform((obj) => removeNullishValues(obj, true)).catch(() => ({}));
1337
- const openRouterSchema = openAIBaseSchema.merge(tConversationSchema.pick({ promptCache: true })).transform((obj) => removeNullishValues(obj, true)).catch(() => ({}));
1345
+ const openRouterSchema = openAIBaseSchema.merge(tConversationSchema.pick({
1346
+ promptCache: true,
1347
+ promptCacheTtl: true
1348
+ })).transform((obj) => removeNullishValues(obj, true)).catch(() => ({}));
1338
1349
  const compactGoogleSchema = googleBaseSchema.transform((obj) => {
1339
1350
  const newObj = { ...obj };
1340
1351
  if (newObj.temperature === google.temperature.default) delete newObj.temperature;
@@ -1354,6 +1365,7 @@ const anthropicBaseSchema = tConversationSchema.pick({
1354
1365
  topK: true,
1355
1366
  resendFiles: true,
1356
1367
  promptCache: true,
1368
+ promptCacheTtl: true,
1357
1369
  thinking: true,
1358
1370
  thinkingBudget: true,
1359
1371
  effort: true,
@@ -1880,6 +1892,7 @@ const fullMimeTypesList = [
1880
1892
  "application/vnd.coffeescript",
1881
1893
  "application/xml",
1882
1894
  "application/zip",
1895
+ "application/x-zip-compressed",
1883
1896
  "application/x-parquet",
1884
1897
  "application/vnd.oasis.opendocument.text",
1885
1898
  "application/vnd.oasis.opendocument.spreadsheet",
@@ -1937,6 +1950,7 @@ const codeInterpreterMimeTypesList = [
1937
1950
  "application/typescript",
1938
1951
  "application/xml",
1939
1952
  "application/zip",
1953
+ "application/x-zip-compressed",
1940
1954
  "application/x-parquet",
1941
1955
  ...excelFileTypes
1942
1956
  ];
@@ -1976,7 +1990,7 @@ const isBedrockDocumentType = (mimeType) => mimeType != null && mimeType in bedr
1976
1990
  const bedrockDocumentExtensions = ".pdf,.csv,.doc,.docx,.xls,.xlsx,.html,.htm,.txt,.md,application/pdf,text/csv,application/csv,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,text/html,text/plain,text/markdown";
1977
1991
  const excelMimeTypes = /^application\/(vnd\.ms-excel|msexcel|x-msexcel|x-ms-excel|x-excel|x-dos_ms_excel|xls|x-xls|vnd\.openxmlformats-officedocument\.spreadsheetml\.sheet)$/;
1978
1992
  const textMimeTypes = /^(text\/(x-c|x-csharp|tab-separated-values|x-c\+\+|x-h|x-java|html|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|css|vtt|javascript|csv|xml|calendar))$/;
1979
- const applicationMimeTypes = /^(application\/(epub\+zip|csv|json|msword|pdf|x-tar|x-sh|typescript|sql|yaml|x-parquet|vnd\.apache\.parquet|vnd\.coffeescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)|vnd\.oasis\.opendocument\.(text|spreadsheet|presentation|graphics)|xml|zip))$/;
1993
+ const applicationMimeTypes = /^(application\/(epub\+zip|csv|json|msword|pdf|x-tar|x-sh|x-zip-compressed|typescript|sql|yaml|x-parquet|vnd\.apache\.parquet|vnd\.coffeescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)|vnd\.oasis\.opendocument\.(text|spreadsheet|presentation|graphics)|xml|zip))$/;
1980
1994
  const imageMimeTypes = /^image\/(jpeg|gif|png|webp|heic|heif)$/;
1981
1995
  const audioMimeTypes = /^audio\/(mp3|mpeg|mpeg3|wav|wave|x-wav|ogg|vorbis|mp4|m4a|x-m4a|flac|x-flac|webm|aac|wma|opus)$/;
1982
1996
  const videoMimeTypes = /^video\/(mp4|avi|mov|wmv|flv|webm|mkv|m4v|3gp|ogv)$/;
@@ -2144,6 +2158,7 @@ const imageTypeMapping = {
2144
2158
  };
2145
2159
  /** Normalizes non-standard MIME types that browsers may report to their canonical forms */
2146
2160
  const mimeTypeAliases = {
2161
+ "application/x-zip-compressed": "application/zip",
2147
2162
  "text/x-python-script": "text/x-python",
2148
2163
  "text/x-markdown": "text/markdown"
2149
2164
  };
@@ -2442,6 +2457,7 @@ const conversationById = (id) => `${conversationsRoot}/${id}`;
2442
2457
  const genTitle$1 = (conversationId) => `${conversationsRoot}/gen_title/${encodeURIComponent(conversationId)}`;
2443
2458
  const updateConversation$1 = () => `${conversationsRoot}/update`;
2444
2459
  const archiveConversation$1 = () => `${conversationsRoot}/archive`;
2460
+ const pinConversation$1 = () => `${conversationsRoot}/pin`;
2445
2461
  const deleteConversation$1 = () => `${conversationsRoot}`;
2446
2462
  const deleteAllConversation = () => `${conversationsRoot}/all`;
2447
2463
  const importConversation = () => `${conversationsRoot}/import`;
@@ -2458,6 +2474,7 @@ const presets = () => `${BASE_URL}/api/presets`;
2458
2474
  const deletePreset$1 = () => `${BASE_URL}/api/presets/delete`;
2459
2475
  const aiEndpoints = () => `${BASE_URL}/api/endpoints`;
2460
2476
  const tokenConfig = () => `${BASE_URL}/api/endpoints/token-config`;
2477
+ const contextProjection = () => `${BASE_URL}/api/endpoints/context-projection`;
2461
2478
  const models = () => `${BASE_URL}/api/models`;
2462
2479
  const tokenizer = () => `${BASE_URL}/api/tokenizer`;
2463
2480
  const login$1 = () => `${BASE_URL}/api/auth/login`;
@@ -3884,7 +3901,7 @@ const interfaceSchema = z.object({
3884
3901
  runCode: true,
3885
3902
  webSearch: true,
3886
3903
  contextUsage: true,
3887
- contextCost: true,
3904
+ contextCost: false,
3888
3905
  peoplePicker: {
3889
3906
  users: true,
3890
3907
  groups: true,
@@ -5306,6 +5323,7 @@ let QueryKeys = /* @__PURE__ */ function(QueryKeys) {
5306
5323
  QueryKeys["balance"] = "balance";
5307
5324
  QueryKeys["endpoints"] = "endpoints";
5308
5325
  QueryKeys["tokenConfig"] = "tokenConfig";
5326
+ QueryKeys["contextProjection"] = "contextProjection";
5309
5327
  QueryKeys["presets"] = "presets";
5310
5328
  QueryKeys["searchResults"] = "searchResults";
5311
5329
  QueryKeys["tokenCount"] = "tokenCount";
@@ -5404,6 +5422,7 @@ let MutationKeys = /* @__PURE__ */ function(MutationKeys) {
5404
5422
  MutationKeys["updateSkillNode"] = "updateSkillNode";
5405
5423
  MutationKeys["deleteSkillNode"] = "deleteSkillNode";
5406
5424
  MutationKeys["updateSkillNodeContent"] = "updateSkillNodeContent";
5425
+ MutationKeys["convoPin"] = "convoPin";
5407
5426
  return MutationKeys;
5408
5427
  }({});
5409
5428
  //#endregion
@@ -5686,6 +5705,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5686
5705
  getBanner: () => getBanner,
5687
5706
  getCategories: () => getCategories,
5688
5707
  getCodeOutputDownload: () => getCodeOutputDownload,
5708
+ getContextProjection: () => getContextProjection,
5689
5709
  getConversationById: () => getConversationById,
5690
5710
  getConversationTags: () => getConversationTags,
5691
5711
  getConversations: () => getConversations,
@@ -5753,6 +5773,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5753
5773
  login: () => login,
5754
5774
  logout: () => logout,
5755
5775
  makePromptProduction: () => makePromptProduction,
5776
+ pinConversation: () => pinConversation,
5756
5777
  rebuildConversationTags: () => rebuildConversationTags,
5757
5778
  recordPromptGroupUsage: () => recordPromptGroupUsage,
5758
5779
  regenerateBackupCodes: () => regenerateBackupCodes,
@@ -5966,6 +5987,9 @@ const getAIEndpoints = () => {
5966
5987
  const getTokenConfig = () => {
5967
5988
  return request_default.get(tokenConfig());
5968
5989
  };
5990
+ const getContextProjection = (payload) => {
5991
+ return request_default.post(contextProjection(), payload);
5992
+ };
5969
5993
  const getModels = async () => {
5970
5994
  return request_default.get(models());
5971
5995
  };
@@ -6264,6 +6288,9 @@ function assignConversationToProject(payload) {
6264
6288
  const { conversationId, projectId } = payload;
6265
6289
  return request_default.put(projectConversation(conversationId), { projectId });
6266
6290
  }
6291
+ function pinConversation(payload) {
6292
+ return request_default.post(pinConversation$1(), { arg: payload });
6293
+ }
6267
6294
  function genTitle(payload) {
6268
6295
  return request_default.get(genTitle$1(payload.conversationId));
6269
6296
  }
@@ -6579,4 +6606,4 @@ const getActiveJobs = () => {
6579
6606
  //#endregion
6580
6607
  export { permissionEntrySchema as $, feedbackTagKeySchema as $a, getModelKey as $i, MCP_USER_INPUT_FIELDS as $n, tModelSpecSchema as $r, balanceSchema as $t, updateResourcePermissions as A, tPluginSchema as Aa, assistantSchema as Ai, modularEndpoints as An, fileConfigSchema as Ar, SKILL_SYNC_MAX_INTERVAL_MINUTES as At, MutationKeys as B, StepStatus as Ba, documentSupportedProviders as Bi, summarizationTriggerSchema as Bn, megabyte as Br, TTSProviders as Bt, resetPassword as C, tConversationSchema as Ca, Verbosity as Ci, initialModelsConfig as Cn, defaultSTTMimeTypes as Cr, MAX_SUBAGENT_RUN_CONFIGS as Ct, updateFeedback as D, tMessageSchema as Da, anthropicBaseSchema as Di, messageFilterPiiSchema as Dn, excelFileTypes as Dr, RetentionMode as Dt, searchPrincipals as E, tExampleSchema as Ea, agentsSettings as Ei, memorySchema as En, endpointFileConfigSchema as Er, RerankerTypes as Et, request_default as F, AssistantStreamEvents as Fa, compactAgentsSchema as Fi, resolveEndpointType as Fn, imageTypeMapping as Fr, SearchCategories as Ft, PrincipalType as G, hostImageIdSuffix as Ga, eReasoningParameterFormatSchema as Gi, validateVisionModel as Gn, supportedMimeTypes as Gr, allowedAddressesSchema as Gt, AccessRoleIds as H, actionDelimiter as Ha, eImageDetailSchema as Hi, transactionsSchema as Hn, mimeTypeAliases as Hr, ViolationTypes as Ht, getTokenHeader as I, EToolResources as Ia, compactAssistantSchema as Ii, skillSyncConfigSchema as In, inferMimeType as Ir, SearchProviders as It, accessRoleToPermBits as J, FEEDBACK_RATINGS as Ja, eThinkingDisplaySchema as Ji, visionModels as Jn, videoMimeTypes as Jr, assistantEndpointSchema as Jt, ResourceType as K, hostImageNamePrefix as Ka, eReasoningResponseKeySchema as Ki, vertexAISchema as Kn, supportsFiles as Kr, alternateName as Kt, setAcceptLanguageHeader as L, FilePurpose as La, compactGoogleSchema as Li, skillSyncGitHubSourceSchema as Ln, isBedrockDocumentType as Lr, SettingsTabValues as Lt, updateUserKey as M, tQueryParamsSchema as Ma, cacheSubsetProviders as Mi, paramDefinitionSchema as Mn, getEndpointFileConfig as Mr, STTProviders as Mt, updateUserPlugins as N, tSharedLinkSchema as Na, coerceNumber as Ni, providerEndpointMap as Nn, imageExtRegex as Nr, SafeSearchTypes as Nt, updateMessage as O, tModelSpecPresetSchema as Oa, anthropicSchema as Oi, messageFilterSchema as On, excelMimeTypes as Or, SKILL_SYNC_DEFAULT_DISCOVERY_DEPTH as Ot, userKeyQuery as P, AnnotationTypes as Pa, compactAgentsBaseSchema as Pi, rateLimitSchema as Pn, imageMimeTypes as Pr, ScraperProviders as Pt, permBitsToAccessLevel as Q, feedbackSchema as Qa, extendedModelEndpointSchema as Qi, MCPServersSchema as Qn, specsConfigSchema as Qr, azureGroupSchema as Qt, setTokenHeader as R, MessageContentTypes as Ra, defaultAgentFormValues as Ri, specialVariables as Rn, isPermissiveMimeConfig as Rr, SettingsViews as Rt, requestPasswordReset as S, tBannerSchema as Sa, ThinkingLevel as Si, imageGenTools as Sn, defaultOCRMimeTypes as Sr, MAX_SUBAGENT_GRAPH_NODES as St, revokeUserKey as T, tConvoUpdateSchema as Ta, agentsSchema as Ti, isRemoteOidcUrlAllowed as Tn, documentParserMimeTypes as Tr, RateLimitPrefix as Tt, PermissionBits as U, actionDomainSeparator as Ua, eModelEndpointSchema as Ui, turnstileOptionsSchema as Un, retrievalMimeTypes as Ur, VisionModes as Ut, QueryKeys as V, Tools as Va, eAnthropicEffortSchema as Vi, supportsBalanceCheck as Vn, mergeFileConfig as Vr, Time as Vt, PrincipalModel as W, defaultOrderQuery as Wa, eReasoningEffortSchema as Wi, turnstileSchema as Wn, retrievalMimeTypesList as Wr, agentsEndpointSchema as Wt, getResourcePermissionsResponseSchema as X, FEEDBACK_TAGS as Xa, eVerbositySchema as Xi, MCPOptionsSchema as Xn, getRefillEligibilityDate as Xr, azureEndpointSchema as Xt, effectivePermissionsResponseSchema as Y, FEEDBACK_REASON_KEYS as Ya, eThinkingLevelSchema as Yi, webSearchSchema as Yn, REFILL_INTERVAL_UNITS as Yr, azureBaseSchema as Yt, hasPermissions as Z, feedbackRatingSchema as Za, endpointSettings as Zi, MCPServerUserInputSchema as Zn, modelSpecSubagentsSchema as Zr, azureGroupConfigsSchema as Zt, getResourcePermissions as _, openAISchema as _a, ReasoningEffort as _i, fileStrategiesSchema as _n, bedrockDocumentFormats as _r, ImageDetailCost as _t, data_service_exports as a, imageDetailNumeric as aa, generateGoogleSchema as ai, configSchema as an, extractVariableName as ao, AuthorizationTypeEnum as ar, AuthKeys as at, register as b, paramEndpoints as ba, ReasoningSummary as bi, getEndpointField as bn, codeTypeMapping as br, LocalStorageKeys as bt, getAccessRoles as c, isAgentsEndpoint as ca, AnthropicEffort as ci, defaultAssistantsVersion as cn, FileSources as cr, Capabilities as ct, getAvailablePlugins as d, isImageVisionTool as da, BedrockReasoningConfig as di, defaultRetrievalModels as dn, buildLoginRedirectUrl as dr, DEFAULT_MEMORY_MAX_INPUT_TOKENS as dt, getSettingsKeys as ea, MAX_SUBAGENTS as ei, baseEndpointSchema as en, getTagByKey as eo, SSEOptionsSchema as er, principalSchema as et, getConversationById as f, isMythosClassModel as fa, EModelEndpoint as fi, defaultSocialLogins as fn, loginPage as fr, EImageOutputType as ft, getModels as g, openAIBaseSchema as ga, Providers as gi, fileStorageSchema as gn, bedrockDocumentExtensions as gr, ForkOptions as gt, getMCPServerConnectionStatus as h, isUUID as ha, MYTHOS_CLASS_FAMILIES as hi, fileSourceSchema as hn, audioMimeTypes as hr, FetchTokenConfig as ht, createPreset as i, googleSettings as ia, generateDynamicSchema as ii, cloudfrontConfigSchema as in, extractEnvVariable as io, AuthTypeEnum as ir, AgentCapabilities as it, updateTokenCount as j, tPresetSchema as ja, authTypeSchema as ji, ocrSchema as jn, fullMimeTypesList as jr, SKILL_SYNC_MIN_INTERVAL_MINUTES as jt, updateMessageContent as k, tPluginAuthConfigSchema as ka, anthropicSettings as ki, modelConfigSchema as kn, fileConfig as kr, SKILL_SYNC_MAX_DISCOVERY_DEPTH as kt, getAgentApiKeys as l, isAssistantsEndpoint as la, AuthType as li, defaultEndpoints as ln, checkOpenAIStorage as lr, CohereConstants as lt, getEffectivePermissions as m, isParamEndpoint as ma, ImageVisionTool as mi, excludedKeys as mn, applicationMimeTypes as mr, ErrorTypes as mt, clearAllConversations as n, googleGenConfigSchema as na, OptionTypes as ni, bedrockGuardrailConfigSchema as nn, toMinimalFeedback as no, StreamableHTTPOptionsSchema as nr, updateResourcePermissionsRequestSchema as nt, deleteAgentApiKey as o, imageDetailValue as oa, generateOpenAISchema as oi, contextPruningSchema as on, isSensitiveEnvVar as oo, TokenExchangeMethodEnum as or, BASE_ONLY_CONFIG_SECTIONS as ot, getCustomConfigSpeech as p, isOpenAILikeProvider as pa, ImageDetail as pi, endpointSchema as pn, registerPage as pr, EndpointURLs as pt, accessRoleSchema as q, isActionTool as qa, eReasoningSummarySchema as qi, vertexModelConfigSchema as qn, textMimeTypes as qr, anthropicEndpointSchema as qt, createAgentApiKey as r, googleSchema as ra, SettingTypes as ri, bedrockModels as rn, envVarRegex as ro, WebSocketOptionsSchema as rr, updateResourcePermissionsResponseSchema as rt, deletePreset as s, inputTokensIncludesCache as sa, validateSettingDefinitions as si, defaultAgentCapabilities as sn, normalizeEndpointName as so, FileContext as sr, CacheKeys as st, cancelMCPOAuth as t, googleBaseSchema as ta, ComponentTypes as ti, bedrockEndpointSchema as tn, getTagsForRating as to, StdioOptionsSchema as tr, resourcePermissionsResponseSchema as tt, getAllEffectivePermissions as u, isDocumentSupportedProvider as ua, BedrockProviders as ui, defaultModels as un, apiBaseUrl as ur, Constants as ut, getSharedLink as v, openAISettings as va, ReasoningParameterFormat as vi, getConfigDefaults as vn, codeInterpreterMimeTypes as vr, InfiniteCollections as vt, revokeAllUserKeys as w, tConversationTagSchema as wa, agentsBaseSchema as wi, interfaceSchema as wn, defaultTextMimeTypes as wr, OCRStrategy as wt, reinitializeMCPServer as x, removeNullishValues as xa, ThinkingDisplay as xi, getSchemaDefaults as xn, convertStringsToRegex as xr, MAX_SUBAGENT_DEPTH as xt, getSharedMessages as y, openRouterSchema as ya, ReasoningResponseKey as yi, getDefaultParamsEndpoint as yn, codeInterpreterMimeTypesList as yr, KnownEndpoints as yt, DynamicQueryKeys as z, RunStatus as za, defaultAssistantFormValues as zi, summarizationConfigSchema as zn, mbToBytes as zr, SystemCategories as zt };
6581
6608
 
6582
- //# sourceMappingURL=data-service-CwM4Cew0.mjs.map
6609
+ //# sourceMappingURL=data-service-D7mtXwG5.mjs.map