librechat-data-provider 0.8.505 → 0.8.506

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.
@@ -396,8 +396,11 @@ const isOpenAILikeProvider = (provider) => {
396
396
  * Providers whose `usage_metadata.input_tokens` ALREADY INCLUDES cached tokens
397
397
  * (`input_token_details.cache_*` is a subset, not an additional charge):
398
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
399
+ * OpenAI-compatible family. `@librechat/agents`' `getAnthropicUsageMetadata`
400
+ * folds `cache_creation` + `cache_read` into `input_tokens`, so Anthropic is a
401
+ * subset provider too; without this the cache portion is billed twice. Bedrock
402
+ * stays additive — its Converse path passes AWS `inputTokens` through unmodified.
403
+ * Single source of truth shared by the backend billing path
401
404
  * (`packages/api/src/agents/usage.ts`) and the client usage normalization.
402
405
  */
403
406
  const cacheSubsetProviders = new Set([
@@ -408,7 +411,8 @@ const cacheSubsetProviders = new Set([
408
411
  "xai",
409
412
  "deepseek",
410
413
  "openrouter",
411
- "moonshot"
414
+ "moonshot",
415
+ "anthropic"
412
416
  ]);
413
417
  const inputTokensIncludesCache = (provider) => {
414
418
  return cacheSubsetProviders.has(provider ?? "");
@@ -755,6 +759,7 @@ const anthropicSettings = {
755
759
  default: 1
756
760
  },
757
761
  promptCache: { default: true },
762
+ promptCacheTtl: { default: void 0 },
758
763
  thinking: { default: true },
759
764
  thinkingBudget: {
760
765
  min: 1024,
@@ -971,6 +976,7 @@ const tConversationSchema = zod.z.object({
971
976
  endpoint: eModelEndpointSchema.nullable(),
972
977
  endpointType: eModelEndpointSchema.nullable().optional(),
973
978
  isArchived: zod.z.boolean().optional(),
979
+ pinned: zod.z.boolean().optional(),
974
980
  title: zod.z.string().nullable().or(zod.z.literal("New Chat")).default("New Chat"),
975
981
  user: zod.z.string().optional(),
976
982
  messages: zod.z.array(zod.z.string()).optional(),
@@ -990,6 +996,7 @@ const tConversationSchema = zod.z.object({
990
996
  maxContextTokens: coerceNumber.optional(),
991
997
  max_tokens: coerceNumber.optional(),
992
998
  promptCache: zod.z.boolean().optional(),
999
+ promptCacheTtl: zod.z.enum(["5m", "1h"]).optional(),
993
1000
  system: zod.z.string().optional(),
994
1001
  thinking: zod.z.boolean().optional(),
995
1002
  thinkingBudget: coerceNumber.optional(),
@@ -1112,6 +1119,7 @@ const tQueryParamsSchema = tConversationSchema.pick({
1112
1119
  maxOutputTokens: true,
1113
1120
  /** @endpoints anthropic */
1114
1121
  promptCache: true,
1122
+ promptCacheTtl: true,
1115
1123
  thinking: true,
1116
1124
  thinkingBudget: true,
1117
1125
  thinkingLevel: true,
@@ -1354,7 +1362,10 @@ const openAIBaseSchema = tConversationSchema.pick({
1354
1362
  fileTokenLimit: true
1355
1363
  });
1356
1364
  const openAISchema = openAIBaseSchema.transform((obj) => removeNullishValues(obj, true)).catch(() => ({}));
1357
- const openRouterSchema = openAIBaseSchema.merge(tConversationSchema.pick({ promptCache: true })).transform((obj) => removeNullishValues(obj, true)).catch(() => ({}));
1365
+ const openRouterSchema = openAIBaseSchema.merge(tConversationSchema.pick({
1366
+ promptCache: true,
1367
+ promptCacheTtl: true
1368
+ })).transform((obj) => removeNullishValues(obj, true)).catch(() => ({}));
1358
1369
  const compactGoogleSchema = googleBaseSchema.transform((obj) => {
1359
1370
  const newObj = { ...obj };
1360
1371
  if (newObj.temperature === google.temperature.default) delete newObj.temperature;
@@ -1374,6 +1385,7 @@ const anthropicBaseSchema = tConversationSchema.pick({
1374
1385
  topK: true,
1375
1386
  resendFiles: true,
1376
1387
  promptCache: true,
1388
+ promptCacheTtl: true,
1377
1389
  thinking: true,
1378
1390
  thinkingBudget: true,
1379
1391
  effort: true,
@@ -1900,6 +1912,7 @@ const fullMimeTypesList = [
1900
1912
  "application/vnd.coffeescript",
1901
1913
  "application/xml",
1902
1914
  "application/zip",
1915
+ "application/x-zip-compressed",
1903
1916
  "application/x-parquet",
1904
1917
  "application/vnd.oasis.opendocument.text",
1905
1918
  "application/vnd.oasis.opendocument.spreadsheet",
@@ -1957,6 +1970,7 @@ const codeInterpreterMimeTypesList = [
1957
1970
  "application/typescript",
1958
1971
  "application/xml",
1959
1972
  "application/zip",
1973
+ "application/x-zip-compressed",
1960
1974
  "application/x-parquet",
1961
1975
  ...excelFileTypes
1962
1976
  ];
@@ -1996,7 +2010,7 @@ const isBedrockDocumentType = (mimeType) => mimeType != null && mimeType in bedr
1996
2010
  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";
1997
2011
  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)$/;
1998
2012
  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))$/;
1999
- 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))$/;
2013
+ 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))$/;
2000
2014
  const imageMimeTypes = /^image\/(jpeg|gif|png|webp|heic|heif)$/;
2001
2015
  const audioMimeTypes = /^audio\/(mp3|mpeg|mpeg3|wav|wave|x-wav|ogg|vorbis|mp4|m4a|x-m4a|flac|x-flac|webm|aac|wma|opus)$/;
2002
2016
  const videoMimeTypes = /^video\/(mp4|avi|mov|wmv|flv|webm|mkv|m4v|3gp|ogv)$/;
@@ -2164,6 +2178,7 @@ const imageTypeMapping = {
2164
2178
  };
2165
2179
  /** Normalizes non-standard MIME types that browsers may report to their canonical forms */
2166
2180
  const mimeTypeAliases = {
2181
+ "application/x-zip-compressed": "application/zip",
2167
2182
  "text/x-python-script": "text/x-python",
2168
2183
  "text/x-markdown": "text/markdown"
2169
2184
  };
@@ -2462,6 +2477,7 @@ const conversationById = (id) => `${conversationsRoot}/${id}`;
2462
2477
  const genTitle$1 = (conversationId) => `${conversationsRoot}/gen_title/${encodeURIComponent(conversationId)}`;
2463
2478
  const updateConversation$1 = () => `${conversationsRoot}/update`;
2464
2479
  const archiveConversation$1 = () => `${conversationsRoot}/archive`;
2480
+ const pinConversation$1 = () => `${conversationsRoot}/pin`;
2465
2481
  const deleteConversation$1 = () => `${conversationsRoot}`;
2466
2482
  const deleteAllConversation = () => `${conversationsRoot}/all`;
2467
2483
  const importConversation = () => `${conversationsRoot}/import`;
@@ -2478,6 +2494,7 @@ const presets = () => `${BASE_URL}/api/presets`;
2478
2494
  const deletePreset$1 = () => `${BASE_URL}/api/presets/delete`;
2479
2495
  const aiEndpoints = () => `${BASE_URL}/api/endpoints`;
2480
2496
  const tokenConfig = () => `${BASE_URL}/api/endpoints/token-config`;
2497
+ const contextProjection = () => `${BASE_URL}/api/endpoints/context-projection`;
2481
2498
  const models = () => `${BASE_URL}/api/models`;
2482
2499
  const tokenizer = () => `${BASE_URL}/api/tokenizer`;
2483
2500
  const login$1 = () => `${BASE_URL}/api/auth/login`;
@@ -3904,7 +3921,7 @@ const interfaceSchema = zod.z.object({
3904
3921
  runCode: true,
3905
3922
  webSearch: true,
3906
3923
  contextUsage: true,
3907
- contextCost: true,
3924
+ contextCost: false,
3908
3925
  peoplePicker: {
3909
3926
  users: true,
3910
3927
  groups: true,
@@ -5326,6 +5343,7 @@ let QueryKeys = /* @__PURE__ */ function(QueryKeys) {
5326
5343
  QueryKeys["balance"] = "balance";
5327
5344
  QueryKeys["endpoints"] = "endpoints";
5328
5345
  QueryKeys["tokenConfig"] = "tokenConfig";
5346
+ QueryKeys["contextProjection"] = "contextProjection";
5329
5347
  QueryKeys["presets"] = "presets";
5330
5348
  QueryKeys["searchResults"] = "searchResults";
5331
5349
  QueryKeys["tokenCount"] = "tokenCount";
@@ -5424,6 +5442,7 @@ let MutationKeys = /* @__PURE__ */ function(MutationKeys) {
5424
5442
  MutationKeys["updateSkillNode"] = "updateSkillNode";
5425
5443
  MutationKeys["deleteSkillNode"] = "deleteSkillNode";
5426
5444
  MutationKeys["updateSkillNodeContent"] = "updateSkillNodeContent";
5445
+ MutationKeys["convoPin"] = "convoPin";
5427
5446
  return MutationKeys;
5428
5447
  }({});
5429
5448
  //#endregion
@@ -5706,6 +5725,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5706
5725
  getBanner: () => getBanner,
5707
5726
  getCategories: () => getCategories,
5708
5727
  getCodeOutputDownload: () => getCodeOutputDownload,
5728
+ getContextProjection: () => getContextProjection,
5709
5729
  getConversationById: () => getConversationById,
5710
5730
  getConversationTags: () => getConversationTags,
5711
5731
  getConversations: () => getConversations,
@@ -5773,6 +5793,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5773
5793
  login: () => login,
5774
5794
  logout: () => logout,
5775
5795
  makePromptProduction: () => makePromptProduction,
5796
+ pinConversation: () => pinConversation,
5776
5797
  rebuildConversationTags: () => rebuildConversationTags,
5777
5798
  recordPromptGroupUsage: () => recordPromptGroupUsage,
5778
5799
  regenerateBackupCodes: () => regenerateBackupCodes,
@@ -5986,6 +6007,9 @@ const getAIEndpoints = () => {
5986
6007
  const getTokenConfig = () => {
5987
6008
  return request_default.get(tokenConfig());
5988
6009
  };
6010
+ const getContextProjection = (payload) => {
6011
+ return request_default.post(contextProjection(), payload);
6012
+ };
5989
6013
  const getModels = async () => {
5990
6014
  return request_default.get(models());
5991
6015
  };
@@ -6284,6 +6308,9 @@ function assignConversationToProject(payload) {
6284
6308
  const { conversationId, projectId } = payload;
6285
6309
  return request_default.put(projectConversation(conversationId), { projectId });
6286
6310
  }
6311
+ function pinConversation(payload) {
6312
+ return request_default.post(pinConversation$1(), { arg: payload });
6313
+ }
6287
6314
  function genTitle(payload) {
6288
6315
  return request_default.get(genTitle$1(payload.conversationId));
6289
6316
  }
@@ -8590,4 +8617,4 @@ Object.defineProperty(exports, "webSearchSchema", {
8590
8617
  }
8591
8618
  });
8592
8619
 
8593
- //# sourceMappingURL=data-service-CG5e1FOi.js.map
8620
+ //# sourceMappingURL=data-service-CCdWvcRd.js.map