@adaptic/lumic-utils 1.0.20 → 1.0.22

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.
Files changed (24) hide show
  1. package/dist/{apollo-client.client-DRk6kygw.js → apollo-client.client-Bu5mc2I8.js} +4 -4
  2. package/dist/{apollo-client.client-DRk6kygw.js.map → apollo-client.client-Bu5mc2I8.js.map} +1 -1
  3. package/dist/{apollo-client.client-DVsbR05r.js → apollo-client.client-YzlpL7kf.js} +3 -3
  4. package/dist/{apollo-client.client-DVsbR05r.js.map → apollo-client.client-YzlpL7kf.js.map} +1 -1
  5. package/dist/{apollo-client.server-Djh4v__C.js → apollo-client.server-BTHAQqYl.js} +3 -3
  6. package/dist/{apollo-client.server-Djh4v__C.js.map → apollo-client.server-BTHAQqYl.js.map} +1 -1
  7. package/dist/{apollo-client.server-L8JR2ko_.js → apollo-client.server-sD1QteQO.js} +3 -3
  8. package/dist/{apollo-client.server-L8JR2ko_.js.map → apollo-client.server-sD1QteQO.js.map} +1 -1
  9. package/dist/{index-eU6Q74W8.js → index-B_4Q2noT.js} +2 -2
  10. package/dist/{index-eU6Q74W8.js.map → index-B_4Q2noT.js.map} +1 -1
  11. package/dist/{index-Cs56Fq24.js → index-CWx6sW9a.js} +2 -2
  12. package/dist/{index-Cs56Fq24.js.map → index-CWx6sW9a.js.map} +1 -1
  13. package/dist/{index-CSOg0U0R.js → index-DPaCMqua.js} +211 -23
  14. package/dist/{index-BVl0tRmx.js.map → index-DPaCMqua.js.map} +1 -1
  15. package/dist/{index-BVl0tRmx.js → index-DfuMX-MS.js} +211 -23
  16. package/dist/{index-CSOg0U0R.js.map → index-DfuMX-MS.js.map} +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.mjs +1 -1
  19. package/dist/test.cjs +1 -1
  20. package/dist/test.mjs +1 -1
  21. package/dist/types/functions/llm-config.d.ts +9 -1
  22. package/dist/types/types/openai-types.d.ts +95 -5
  23. package/dist/types/utils/llm-cost-tracker.d.ts +3 -0
  24. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BVl0tRmx.js');
3
+ var index = require('./index-DfuMX-MS.js');
4
4
  require('openai');
5
5
  require('zod');
6
6
  require('@aws-sdk/client-s3');
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { bW as AWSLambdaError, bX as AWSS3Error, c5 as AWS_LAMBDA_TIMEOUT_MS, c6 as AWS_S3_TIMEOUT_MS, aV as CircuitBreaker, aX as CircuitBreakerOpenError, aW as CircuitBreakerState, aY as DEFAULT_CIRCUIT_BREAKER_CONFIG, c8 as GENERIC_FETCH_TIMEOUT_MS, c3 as GOOGLE_SHEETS_TIMEOUT_MS, bY as GoogleSheetsError, b_ as JsonParseError, b0 as LLMCostTracker, bV as LLMError, bt as LLM_ADVANCED_PROVIDER, bq as LLM_DEFAULT_PROVIDER, br as LLM_MINI_PROVIDER, bx as LLM_MODEL_ADVANCED, bv as LLM_MODEL_MINI, bw as LLM_MODEL_NORMAL, bs as LLM_NORMAL_PROVIDER, bu as LLM_PROVIDER, c4 as LLM_TIMEOUT_MS, bT as LumicError, bn as MODEL_ALIASES, bo as OPENAI_COMPATIBLE_PROVIDERS, c7 as OPENWEATHER_TIMEOUT_MS, b$ as PDFError, c2 as PERPLEXITY_TIMEOUT_MS, bp as PROVIDER_DEFAULT_MODELS, bZ as PerplexityError, be as RATE_LIMIT_PROFILES, c1 as SLACK_TIMEOUT_MS, bj as SUPPORTED_MODELS, bU as SlackError, bd as TokenBucketRateLimiter, c0 as ZipError, bi as checkIntegrationHealth, bS as createSafeValidator, bR as createValidator, b8 as generateCorrelationId, ba as getCorrelationContext, bc as getCorrelationHeaders, b9 as getCorrelationId, b1 as getLLMCostTracker, aM as getLumicLogger, b5 as getMetricsCollector, bl as getModelCapabilities, bm as getModelProvider, bf as getRateLimiter, aR as getSecrets, bH as googleSheetsValueRangeSchema, bk as isValidModel, bM as lambdaInvokeResponseSchema, l as lumic, by as makeAnthropicCall, bz as makeOpenAICompatibleCall, bA as openAIChatCompletionSchema, bB as openAIImageResponseSchema, bE as perplexityResponseSchema, aT as requireSecret, bg as resetAllRateLimiters, b3 as resetLLMCostTracker, b6 as resetMetricsCollector, aS as resetSecrets, bL as s3GetObjectSchema, bK as s3ListObjectsSchema, bJ as safeValidateGoogleSheetsResponse, bQ as safeValidateLambdaResponse, bD as safeValidateOpenAIChatCompletion, bG as safeValidatePerplexityResponse, bO as safeValidateS3ListObjects, aP as sanitizeAWSAuth, aO as sanitizeError, aN as sanitizeForLog, aQ as sanitizeObject, b2 as setLLMCostTracker, aL as setLumicLogger, b4 as setMetricsCollector, a$ as validateGoogleSheetsRange, bI as validateGoogleSheetsResponse, bP as validateLambdaResponse, bC as validateOpenAIChatCompletion, bF as validatePerplexityResponse, a_ as validateS3Key, bN as validateS3ListObjects, aZ as validateSlackChannel, bb as withCorrelationId, b7 as withMetrics, bh as withRateLimit, aU as withRetry } from './index-CSOg0U0R.js';
1
+ export { bW as AWSLambdaError, bX as AWSS3Error, c5 as AWS_LAMBDA_TIMEOUT_MS, c6 as AWS_S3_TIMEOUT_MS, aV as CircuitBreaker, aX as CircuitBreakerOpenError, aW as CircuitBreakerState, aY as DEFAULT_CIRCUIT_BREAKER_CONFIG, c8 as GENERIC_FETCH_TIMEOUT_MS, c3 as GOOGLE_SHEETS_TIMEOUT_MS, bY as GoogleSheetsError, b_ as JsonParseError, b0 as LLMCostTracker, bV as LLMError, bt as LLM_ADVANCED_PROVIDER, bq as LLM_DEFAULT_PROVIDER, br as LLM_MINI_PROVIDER, bx as LLM_MODEL_ADVANCED, bv as LLM_MODEL_MINI, bw as LLM_MODEL_NORMAL, bs as LLM_NORMAL_PROVIDER, bu as LLM_PROVIDER, c4 as LLM_TIMEOUT_MS, bT as LumicError, bn as MODEL_ALIASES, bo as OPENAI_COMPATIBLE_PROVIDERS, c7 as OPENWEATHER_TIMEOUT_MS, b$ as PDFError, c2 as PERPLEXITY_TIMEOUT_MS, bp as PROVIDER_DEFAULT_MODELS, bZ as PerplexityError, be as RATE_LIMIT_PROFILES, c1 as SLACK_TIMEOUT_MS, bj as SUPPORTED_MODELS, bU as SlackError, bd as TokenBucketRateLimiter, c0 as ZipError, bi as checkIntegrationHealth, bS as createSafeValidator, bR as createValidator, b8 as generateCorrelationId, ba as getCorrelationContext, bc as getCorrelationHeaders, b9 as getCorrelationId, b1 as getLLMCostTracker, aM as getLumicLogger, b5 as getMetricsCollector, bl as getModelCapabilities, bm as getModelProvider, bf as getRateLimiter, aR as getSecrets, bH as googleSheetsValueRangeSchema, bk as isValidModel, bM as lambdaInvokeResponseSchema, l as lumic, by as makeAnthropicCall, bz as makeOpenAICompatibleCall, bA as openAIChatCompletionSchema, bB as openAIImageResponseSchema, bE as perplexityResponseSchema, aT as requireSecret, bg as resetAllRateLimiters, b3 as resetLLMCostTracker, b6 as resetMetricsCollector, aS as resetSecrets, bL as s3GetObjectSchema, bK as s3ListObjectsSchema, bJ as safeValidateGoogleSheetsResponse, bQ as safeValidateLambdaResponse, bD as safeValidateOpenAIChatCompletion, bG as safeValidatePerplexityResponse, bO as safeValidateS3ListObjects, aP as sanitizeAWSAuth, aO as sanitizeError, aN as sanitizeForLog, aQ as sanitizeObject, b2 as setLLMCostTracker, aL as setLumicLogger, b4 as setMetricsCollector, a$ as validateGoogleSheetsRange, bI as validateGoogleSheetsResponse, bP as validateLambdaResponse, bC as validateOpenAIChatCompletion, bF as validatePerplexityResponse, a_ as validateS3Key, bN as validateS3ListObjects, aZ as validateSlackChannel, bb as withCorrelationId, b7 as withMetrics, bh as withRateLimit, aU as withRetry } from './index-DPaCMqua.js';
2
2
  import 'openai';
3
3
  import 'zod';
4
4
  import '@aws-sdk/client-s3';
package/dist/test.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BVl0tRmx.js');
3
+ var index = require('./index-DfuMX-MS.js');
4
4
  require('openai');
5
5
  require('zod');
6
6
  require('@aws-sdk/client-s3');
package/dist/test.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { l as lumic } from './index-CSOg0U0R.js';
1
+ import { l as lumic } from './index-DPaCMqua.js';
2
2
  import 'openai';
3
3
  import 'zod';
4
4
  import '@aws-sdk/client-s3';
@@ -6,7 +6,15 @@ interface AIModelCosts {
6
6
  cacheHitCost?: number;
7
7
  };
8
8
  }
9
- /** Token costs in USD per token. Last updated Mar 2026. */
9
+ /**
10
+ * Token costs in USD per token. Last updated May 2026.
11
+ *
12
+ * `cacheHitCost` reflects OpenAI's cached-input billing rate (~50% of the
13
+ * standard input rate per OpenAI's prompt caching documentation). When set,
14
+ * `calculateCost` splits prompt tokens into cached vs non-cached buckets and
15
+ * applies the discount; when omitted, cached tokens are billed at full input
16
+ * rate (a silent ~50% cost overstatement for cache-friendly workloads).
17
+ */
10
18
  export declare const openAiModelCosts: AIModelCosts;
11
19
  export declare const anthropicModelCosts: AIModelCosts;
12
20
  export declare const deepseekModelCosts: AIModelCosts;
@@ -34,6 +34,24 @@ export declare const OPENAI_COMPATIBLE_PROVIDERS: Record<string, OpenAICompatibl
34
34
  * Supported models with their capabilities
35
35
  */
36
36
  export declare const SUPPORTED_MODELS: {
37
+ readonly 'gpt-5.5': {
38
+ readonly provider: "openai";
39
+ readonly supportsTools: true;
40
+ readonly supportsJson: true;
41
+ readonly supportsStructuredOutput: true;
42
+ readonly supportsDeveloperPrompt: true;
43
+ readonly supportsTemperature: true;
44
+ readonly isReasoningModel: false;
45
+ };
46
+ readonly 'gpt-5.5-pro': {
47
+ readonly provider: "openai";
48
+ readonly supportsTools: true;
49
+ readonly supportsJson: true;
50
+ readonly supportsStructuredOutput: true;
51
+ readonly supportsDeveloperPrompt: true;
52
+ readonly supportsTemperature: true;
53
+ readonly isReasoningModel: false;
54
+ };
37
55
  readonly 'gpt-5.4': {
38
56
  readonly provider: "openai";
39
57
  readonly supportsTools: true;
@@ -151,6 +169,15 @@ export declare const SUPPORTED_MODELS: {
151
169
  readonly supportsTemperature: false;
152
170
  readonly isReasoningModel: true;
153
171
  };
172
+ readonly 'claude-opus-4-7': {
173
+ readonly provider: "anthropic";
174
+ readonly supportsTools: true;
175
+ readonly supportsJson: false;
176
+ readonly supportsStructuredOutput: false;
177
+ readonly supportsDeveloperPrompt: true;
178
+ readonly supportsTemperature: true;
179
+ readonly isReasoningModel: false;
180
+ };
154
181
  readonly 'claude-opus-4-6': {
155
182
  readonly provider: "anthropic";
156
183
  readonly supportsTools: true;
@@ -178,6 +205,24 @@ export declare const SUPPORTED_MODELS: {
178
205
  readonly supportsTemperature: true;
179
206
  readonly isReasoningModel: false;
180
207
  };
208
+ readonly 'deepseek-v4-pro': {
209
+ readonly provider: "deepseek";
210
+ readonly supportsTools: true;
211
+ readonly supportsJson: true;
212
+ readonly supportsStructuredOutput: false;
213
+ readonly supportsDeveloperPrompt: true;
214
+ readonly supportsTemperature: true;
215
+ readonly isReasoningModel: true;
216
+ };
217
+ readonly 'deepseek-v4-flash': {
218
+ readonly provider: "deepseek";
219
+ readonly supportsTools: true;
220
+ readonly supportsJson: true;
221
+ readonly supportsStructuredOutput: false;
222
+ readonly supportsDeveloperPrompt: true;
223
+ readonly supportsTemperature: true;
224
+ readonly isReasoningModel: true;
225
+ };
181
226
  readonly 'deepseek-chat': {
182
227
  readonly provider: "deepseek";
183
228
  readonly supportsTools: true;
@@ -196,6 +241,24 @@ export declare const SUPPORTED_MODELS: {
196
241
  readonly supportsTemperature: true;
197
242
  readonly isReasoningModel: true;
198
243
  };
244
+ readonly 'kimi-k2.6': {
245
+ readonly provider: "kimi";
246
+ readonly supportsTools: true;
247
+ readonly supportsJson: true;
248
+ readonly supportsStructuredOutput: false;
249
+ readonly supportsDeveloperPrompt: true;
250
+ readonly supportsTemperature: true;
251
+ readonly isReasoningModel: false;
252
+ };
253
+ readonly 'kimi-k2.5': {
254
+ readonly provider: "kimi";
255
+ readonly supportsTools: true;
256
+ readonly supportsJson: true;
257
+ readonly supportsStructuredOutput: false;
258
+ readonly supportsDeveloperPrompt: true;
259
+ readonly supportsTemperature: true;
260
+ readonly isReasoningModel: false;
261
+ };
199
262
  readonly 'kimi-k2-0905-preview': {
200
263
  readonly provider: "kimi";
201
264
  readonly supportsTools: true;
@@ -259,6 +322,33 @@ export declare const SUPPORTED_MODELS: {
259
322
  readonly supportsTemperature: true;
260
323
  readonly isReasoningModel: false;
261
324
  };
325
+ readonly 'grok-4.3': {
326
+ readonly provider: "xai";
327
+ readonly supportsTools: true;
328
+ readonly supportsJson: true;
329
+ readonly supportsStructuredOutput: true;
330
+ readonly supportsDeveloperPrompt: true;
331
+ readonly supportsTemperature: true;
332
+ readonly isReasoningModel: false;
333
+ };
334
+ readonly 'grok-4.20': {
335
+ readonly provider: "xai";
336
+ readonly supportsTools: true;
337
+ readonly supportsJson: true;
338
+ readonly supportsStructuredOutput: true;
339
+ readonly supportsDeveloperPrompt: true;
340
+ readonly supportsTemperature: true;
341
+ readonly isReasoningModel: false;
342
+ };
343
+ readonly 'grok-4.1-fast': {
344
+ readonly provider: "xai";
345
+ readonly supportsTools: true;
346
+ readonly supportsJson: true;
347
+ readonly supportsStructuredOutput: true;
348
+ readonly supportsDeveloperPrompt: true;
349
+ readonly supportsTemperature: true;
350
+ readonly isReasoningModel: false;
351
+ };
262
352
  readonly 'grok-4': {
263
353
  readonly provider: "xai";
264
354
  readonly supportsTools: true;
@@ -339,19 +429,19 @@ export type SupportedModel = keyof typeof SUPPORTED_MODELS;
339
429
  /**
340
430
  * Represents OpenAI models
341
431
  */
342
- export type OpenAIModel = Extract<SupportedModel, 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5.4-nano' | 'gpt-5' | 'gpt-5-mini' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'o1' | 'o1-mini' | 'o3' | 'o3-mini' | 'o4-mini'>;
432
+ export type OpenAIModel = Extract<SupportedModel, 'gpt-5.5' | 'gpt-5.5-pro' | 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5.4-nano' | 'gpt-5' | 'gpt-5-mini' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'o1' | 'o1-mini' | 'o3' | 'o3-mini' | 'o4-mini'>;
343
433
  /**
344
434
  * Represents Anthropic Claude models
345
435
  */
346
- export type AnthropicModel = Extract<SupportedModel, 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5'>;
436
+ export type AnthropicModel = Extract<SupportedModel, 'claude-opus-4-7' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5'>;
347
437
  /**
348
438
  * Represents Deepseek models
349
439
  */
350
- export type DeepseekModel = Extract<SupportedModel, 'deepseek-chat' | 'deepseek-reasoner'>;
440
+ export type DeepseekModel = Extract<SupportedModel, 'deepseek-v4-pro' | 'deepseek-v4-flash' | 'deepseek-chat' | 'deepseek-reasoner'>;
351
441
  /**
352
442
  * Represents Kimi (Moonshot) models
353
443
  */
354
- export type KimiModel = Extract<SupportedModel, 'kimi-k2-0905-preview' | 'kimi-k2-turbo-preview' | 'kimi-k2-thinking' | 'kimi-k2-thinking-turbo'>;
444
+ export type KimiModel = Extract<SupportedModel, 'kimi-k2.6' | 'kimi-k2.5' | 'kimi-k2-0905-preview' | 'kimi-k2-turbo-preview' | 'kimi-k2-thinking' | 'kimi-k2-thinking-turbo'>;
355
445
  /**
356
446
  * Represents Qwen (Alibaba DashScope) models
357
447
  */
@@ -359,7 +449,7 @@ export type QwenModel = Extract<SupportedModel, 'qwen3.5-plus' | 'qwen3.5-flash'
359
449
  /**
360
450
  * Represents xAI Grok models
361
451
  */
362
- export type XAIModel = Extract<SupportedModel, 'grok-4' | 'grok-4-fast-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-3' | 'grok-3-mini'>;
452
+ export type XAIModel = Extract<SupportedModel, 'grok-4.3' | 'grok-4.20' | 'grok-4.1-fast' | 'grok-4' | 'grok-4-fast-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-3' | 'grok-3-mini'>;
363
453
  /**
364
454
  * Represents Google Gemini models
365
455
  */
@@ -49,6 +49,7 @@ export interface CostSummary {
49
49
  totalCost: number;
50
50
  totalCalls: number;
51
51
  totalInputTokens: number;
52
+ totalCacheHitTokens: number;
52
53
  totalOutputTokens: number;
53
54
  totalReasoningTokens: number;
54
55
  byModel: Record<string, ModelCostSummary>;
@@ -70,7 +71,9 @@ export interface FormattedCostSummary {
70
71
  cost: string;
71
72
  calls: number;
72
73
  inputTokens: number;
74
+ cachedTokens: number;
73
75
  outputTokens: number;
76
+ reasoningTokens: number;
74
77
  }>;
75
78
  images: Array<{
76
79
  model: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptic/lumic-utils",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "NPM repo set of utility functions usable across the entire organisation.",
5
5
  "always-build-npm": false,
6
6
  "type": "module",