@adaptic/lumic-utils 1.0.19 → 1.0.21
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/{apollo-client.client-guxMwplM.js → apollo-client.client-ByADDB46.js} +3 -3
- package/dist/{apollo-client.client-guxMwplM.js.map → apollo-client.client-ByADDB46.js.map} +1 -1
- package/dist/{apollo-client.client-Dfi-rHW-.js → apollo-client.client-CUIakkzs.js} +4 -4
- package/dist/{apollo-client.client-Dfi-rHW-.js.map → apollo-client.client-CUIakkzs.js.map} +1 -1
- package/dist/{apollo-client.server-HwHIFnVk.js → apollo-client.server-BnZhh39o.js} +3 -3
- package/dist/{apollo-client.server-HwHIFnVk.js.map → apollo-client.server-BnZhh39o.js.map} +1 -1
- package/dist/{apollo-client.server-Blxbp1Gf.js → apollo-client.server-JucuAyrj.js} +3 -3
- package/dist/{apollo-client.server-Blxbp1Gf.js.map → apollo-client.server-JucuAyrj.js.map} +1 -1
- package/dist/{index-B4tfLvHx.js → index-BLXN1stF.js} +2 -2
- package/dist/{index-B4tfLvHx.js.map → index-BLXN1stF.js.map} +1 -1
- package/dist/{index-Dr85zRZC.js → index-Ca3x8X5U.js} +85 -31
- package/dist/{index-CSQmloZ-.js.map → index-Ca3x8X5U.js.map} +1 -1
- package/dist/{index-DollRUHQ.js → index-DT0dXUtn.js} +2 -2
- package/dist/{index-DollRUHQ.js.map → index-DT0dXUtn.js.map} +1 -1
- package/dist/{index-CSQmloZ-.js → index-DYehXKUX.js} +85 -31
- package/dist/{index-Dr85zRZC.js.map → index-DYehXKUX.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test.cjs +1 -1
- package/dist/test.mjs +1 -1
- package/dist/types/functions/llm-config.d.ts +9 -1
- package/dist/types/types/openai-types.d.ts +8 -1
- package/dist/types/utils/llm-cost-tracker.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
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-
|
|
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-DYehXKUX.js';
|
|
2
2
|
import 'openai';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '@aws-sdk/client-s3';
|
package/dist/test.cjs
CHANGED
package/dist/test.mjs
CHANGED
|
@@ -6,7 +6,15 @@ interface AIModelCosts {
|
|
|
6
6
|
cacheHitCost?: number;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Token costs in USD per token. Last updated Apr 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;
|
|
@@ -392,6 +392,13 @@ export declare function getModelCapabilities(model: SupportedModel): Readonly<Mo
|
|
|
392
392
|
export declare function getModelProvider(model: SupportedModel): LLMProvider;
|
|
393
393
|
/**
|
|
394
394
|
* Represents the usage of the LLM.
|
|
395
|
+
*
|
|
396
|
+
* `cached_tokens` is the canonical OpenAI naming for input tokens served from
|
|
397
|
+
* the prompt cache. It is populated from `usage.prompt_tokens_details.cached_tokens`
|
|
398
|
+
* (Chat Completions API) or `usage.input_tokens_details.cached_tokens`
|
|
399
|
+
* (Responses API). DeepSeek emits both `prompt_cache_hit_tokens` and the
|
|
400
|
+
* OpenAI-compatible `prompt_tokens_details.cached_tokens`; we always read the
|
|
401
|
+
* OpenAI-compatible field so a single canonical name covers all providers.
|
|
395
402
|
*/
|
|
396
403
|
export interface LLMUsage {
|
|
397
404
|
prompt_tokens: number;
|
|
@@ -399,7 +406,7 @@ export interface LLMUsage {
|
|
|
399
406
|
reasoning_tokens?: number;
|
|
400
407
|
provider: string;
|
|
401
408
|
model: LLMModel;
|
|
402
|
-
|
|
409
|
+
cached_tokens?: number;
|
|
403
410
|
cost: number;
|
|
404
411
|
}
|
|
405
412
|
/**
|
|
@@ -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;
|