@adaptic/lumic-utils 1.0.20 → 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-DVsbR05r.js → apollo-client.client-ByADDB46.js} +3 -3
- package/dist/{apollo-client.client-DVsbR05r.js.map → apollo-client.client-ByADDB46.js.map} +1 -1
- package/dist/{apollo-client.client-DRk6kygw.js → apollo-client.client-CUIakkzs.js} +4 -4
- package/dist/{apollo-client.client-DRk6kygw.js.map → apollo-client.client-CUIakkzs.js.map} +1 -1
- package/dist/{apollo-client.server-Djh4v__C.js → apollo-client.server-BnZhh39o.js} +3 -3
- package/dist/{apollo-client.server-Djh4v__C.js.map → apollo-client.server-BnZhh39o.js.map} +1 -1
- package/dist/{apollo-client.server-L8JR2ko_.js → apollo-client.server-JucuAyrj.js} +3 -3
- package/dist/{apollo-client.server-L8JR2ko_.js.map → apollo-client.server-JucuAyrj.js.map} +1 -1
- package/dist/{index-eU6Q74W8.js → index-BLXN1stF.js} +2 -2
- package/dist/{index-eU6Q74W8.js.map → index-BLXN1stF.js.map} +1 -1
- package/dist/{index-BVl0tRmx.js → index-Ca3x8X5U.js} +34 -5
- package/dist/{index-BVl0tRmx.js.map → index-Ca3x8X5U.js.map} +1 -1
- package/dist/{index-Cs56Fq24.js → index-DT0dXUtn.js} +2 -2
- package/dist/{index-Cs56Fq24.js.map → index-DT0dXUtn.js.map} +1 -1
- package/dist/{index-CSOg0U0R.js → index-DYehXKUX.js} +34 -5
- package/dist/{index-CSOg0U0R.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/utils/llm-cost-tracker.d.ts +3 -0
- package/package.json +1 -1
|
@@ -748,58 +748,79 @@ const DEFAULT_DEVELOPER_PROMPT = `
|
|
|
748
748
|
Present complete, high-confidence, final answers only. Do not rephrase to be more brief or omit parts of answers.
|
|
749
749
|
Respond only with final content (e.g. code, a json or yaml object, a formatted string, or a markdown document) and nothing else. Do not reply with a preamble, introduction, or conclusion.
|
|
750
750
|
`;
|
|
751
|
-
/**
|
|
751
|
+
/**
|
|
752
|
+
* Token costs in USD per token. Last updated Apr 2026.
|
|
753
|
+
*
|
|
754
|
+
* `cacheHitCost` reflects OpenAI's cached-input billing rate (~50% of the
|
|
755
|
+
* standard input rate per OpenAI's prompt caching documentation). When set,
|
|
756
|
+
* `calculateCost` splits prompt tokens into cached vs non-cached buckets and
|
|
757
|
+
* applies the discount; when omitted, cached tokens are billed at full input
|
|
758
|
+
* rate (a silent ~50% cost overstatement for cache-friendly workloads).
|
|
759
|
+
*/
|
|
752
760
|
const openAiModelCosts = {
|
|
753
761
|
'gpt-5.4': {
|
|
754
762
|
inputCost: 2.5 / 1_000_000,
|
|
763
|
+
cacheHitCost: 1.25 / 1_000_000,
|
|
755
764
|
outputCost: 15 / 1_000_000,
|
|
756
765
|
},
|
|
757
766
|
'gpt-5.4-mini': {
|
|
758
767
|
inputCost: 0.75 / 1_000_000,
|
|
768
|
+
cacheHitCost: 0.375 / 1_000_000,
|
|
759
769
|
outputCost: 4.5 / 1_000_000,
|
|
760
770
|
},
|
|
761
771
|
'gpt-5.4-nano': {
|
|
762
772
|
inputCost: 0.2 / 1_000_000,
|
|
773
|
+
cacheHitCost: 0.1 / 1_000_000,
|
|
763
774
|
outputCost: 1.25 / 1_000_000,
|
|
764
775
|
},
|
|
765
776
|
'gpt-5': {
|
|
766
777
|
inputCost: 2.5 / 1_000_000,
|
|
778
|
+
cacheHitCost: 1.25 / 1_000_000,
|
|
767
779
|
outputCost: 10 / 1_000_000,
|
|
768
780
|
},
|
|
769
781
|
'gpt-5-mini': {
|
|
770
782
|
inputCost: 0.15 / 1_000_000,
|
|
783
|
+
cacheHitCost: 0.075 / 1_000_000,
|
|
771
784
|
outputCost: 0.6 / 1_000_000,
|
|
772
785
|
},
|
|
773
786
|
'o1-mini': {
|
|
774
787
|
inputCost: 1.1 / 1_000_000,
|
|
788
|
+
cacheHitCost: 0.55 / 1_000_000,
|
|
775
789
|
outputCost: 4.4 / 1_000_000,
|
|
776
790
|
},
|
|
777
791
|
'o1': {
|
|
778
792
|
inputCost: 15 / 1_000_000,
|
|
793
|
+
cacheHitCost: 7.5 / 1_000_000,
|
|
779
794
|
outputCost: 60 / 1_000_000,
|
|
780
795
|
},
|
|
781
796
|
'o3-mini': {
|
|
782
797
|
inputCost: 1.1 / 1_000_000,
|
|
798
|
+
cacheHitCost: 0.55 / 1_000_000,
|
|
783
799
|
outputCost: 4.4 / 1_000_000,
|
|
784
800
|
},
|
|
785
801
|
'o3': {
|
|
786
802
|
inputCost: 2 / 1_000_000,
|
|
803
|
+
cacheHitCost: 1 / 1_000_000,
|
|
787
804
|
outputCost: 8 / 1_000_000,
|
|
788
805
|
},
|
|
789
806
|
'gpt-4.1': {
|
|
790
807
|
inputCost: 2 / 1_000_000,
|
|
808
|
+
cacheHitCost: 1 / 1_000_000,
|
|
791
809
|
outputCost: 8 / 1_000_000,
|
|
792
810
|
},
|
|
793
811
|
'gpt-4.1-mini': {
|
|
794
812
|
inputCost: 0.4 / 1_000_000,
|
|
813
|
+
cacheHitCost: 0.2 / 1_000_000,
|
|
795
814
|
outputCost: 1.6 / 1_000_000,
|
|
796
815
|
},
|
|
797
816
|
'gpt-4.1-nano': {
|
|
798
817
|
inputCost: 0.1 / 1_000_000,
|
|
818
|
+
cacheHitCost: 0.05 / 1_000_000,
|
|
799
819
|
outputCost: 0.4 / 1_000_000,
|
|
800
820
|
},
|
|
801
821
|
'o4-mini': {
|
|
802
822
|
inputCost: 1.1 / 1_000_000,
|
|
823
|
+
cacheHitCost: 0.55 / 1_000_000,
|
|
803
824
|
outputCost: 4.4 / 1_000_000,
|
|
804
825
|
},
|
|
805
826
|
};
|
|
@@ -1874,7 +1895,10 @@ class LLMCostTracker {
|
|
|
1874
1895
|
timestamp: Date.now(),
|
|
1875
1896
|
};
|
|
1876
1897
|
this.usageRecords.push(record);
|
|
1877
|
-
|
|
1898
|
+
// Emit cachedTokens and reasoningTokens explicitly so operators can
|
|
1899
|
+
// verify cache effectiveness from logs alone (the prior log shape only
|
|
1900
|
+
// surfaced inputTokens and outputTokens, hiding the cache discount).
|
|
1901
|
+
getLumicLogger().info(`LLM cost tracked: ${provider}/${model} - $${cost.toFixed(6)}`, { provider, model, inputTokens, cachedTokens: cacheHitTokens, outputTokens, reasoningTokens, cost });
|
|
1878
1902
|
}
|
|
1879
1903
|
/**
|
|
1880
1904
|
* Records usage from an image generation call.
|
|
@@ -1955,11 +1979,13 @@ class LLMCostTracker {
|
|
|
1955
1979
|
const images = this.getImageCosts();
|
|
1956
1980
|
let totalCost = 0;
|
|
1957
1981
|
let totalInputTokens = 0;
|
|
1982
|
+
let totalCacheHitTokens = 0;
|
|
1958
1983
|
let totalOutputTokens = 0;
|
|
1959
1984
|
let totalReasoningTokens = 0;
|
|
1960
1985
|
for (const summary of Object.values(byModel)) {
|
|
1961
1986
|
totalCost += summary.totalCost;
|
|
1962
1987
|
totalInputTokens += summary.totalInputTokens;
|
|
1988
|
+
totalCacheHitTokens += summary.totalCacheHitTokens;
|
|
1963
1989
|
totalOutputTokens += summary.totalOutputTokens;
|
|
1964
1990
|
totalReasoningTokens += summary.totalReasoningTokens;
|
|
1965
1991
|
}
|
|
@@ -1976,6 +2002,7 @@ class LLMCostTracker {
|
|
|
1976
2002
|
totalCost,
|
|
1977
2003
|
totalCalls: this.usageRecords.length + this.imageRecords.length,
|
|
1978
2004
|
totalInputTokens,
|
|
2005
|
+
totalCacheHitTokens,
|
|
1979
2006
|
totalOutputTokens,
|
|
1980
2007
|
totalReasoningTokens,
|
|
1981
2008
|
byModel,
|
|
@@ -1998,7 +2025,9 @@ class LLMCostTracker {
|
|
|
1998
2025
|
cost: `$${m.totalCost.toFixed(6)}`,
|
|
1999
2026
|
calls: m.callCount,
|
|
2000
2027
|
inputTokens: m.totalInputTokens,
|
|
2028
|
+
cachedTokens: m.totalCacheHitTokens,
|
|
2001
2029
|
outputTokens: m.totalOutputTokens,
|
|
2030
|
+
reasoningTokens: m.totalReasoningTokens,
|
|
2002
2031
|
}));
|
|
2003
2032
|
const images = Object.values(summary.images).map((img) => ({
|
|
2004
2033
|
model: img.model,
|
|
@@ -22801,11 +22830,11 @@ let poolConfig = DEFAULT_POOL_CONFIG;
|
|
|
22801
22830
|
async function loadApolloModules() {
|
|
22802
22831
|
if (typeof window === "undefined" || process.env.AWS_EXECUTION_ENV) {
|
|
22803
22832
|
// Server-side (or Lambda): load the CommonJS‑based implementation.
|
|
22804
|
-
return (await import('./apollo-client.server-
|
|
22833
|
+
return (await import('./apollo-client.server-JucuAyrj.js'));
|
|
22805
22834
|
}
|
|
22806
22835
|
else {
|
|
22807
22836
|
// Client-side: load the ESM‑based implementation.
|
|
22808
|
-
return (await import('./apollo-client.client-
|
|
22837
|
+
return (await import('./apollo-client.client-CUIakkzs.js'));
|
|
22809
22838
|
}
|
|
22810
22839
|
}
|
|
22811
22840
|
/**
|
|
@@ -81329,4 +81358,4 @@ const lumic = {
|
|
|
81329
81358
|
};
|
|
81330
81359
|
|
|
81331
81360
|
export { GraphQLInterfaceType as $, print as A, getNamedType as B, isInputType as C, isRequiredArgument as D, isNamedType as E, GraphQLError as F, GraphQLNonNull as G, isOutputType as H, isRequiredInputField as I, isCompositeType as J, Kind as K, getNullableType as L, getEnterLeaveForKind as M, isNode as N, OperationTypeNode as O, didYouMean as P, naturalCompare as Q, suggestionList as R, specifiedScalarTypes as S, keyMap as T, isType as U, isNullableType as V, visit as W, visitInParallel as X, keyValMap as Y, assertObjectType as Z, GraphQLScalarType as _, isListType as a, validateGoogleSheetsRange as a$, GraphQLUnionType as a0, GraphQLInputObjectType as a1, assertNullableType as a2, assertInterfaceType as a3, mapValue as a4, isSpecifiedScalarType as a5, isPrintableAsBlockString as a6, printBlockString as a7, BREAK as a8, GRAPHQL_MAX_INT as a9, printSourceLocation as aA, resolveObjMapThunk as aB, resolveReadonlyArrayThunk as aC, valueFromASTUntyped as aD, version$4 as aE, versionInfo as aF, getAugmentedNamespace as aG, isDigit$1 as aH, isNameStart as aI, dedentBlockStringLines as aJ, isNameContinue as aK, setLumicLogger as aL, getLumicLogger as aM, sanitizeForLog as aN, sanitizeError as aO, sanitizeAWSAuth as aP, sanitizeObject as aQ, getSecrets as aR, resetSecrets as aS, requireSecret as aT, withRetry as aU, CircuitBreaker as aV, CircuitBreakerState as aW, CircuitBreakerOpenError as aX, DEFAULT_CIRCUIT_BREAKER_CONFIG as aY, validateSlackChannel as aZ, validateS3Key as a_, GRAPHQL_MIN_INT as aa, GraphQLFloat as ab, GraphQLInt as ac, Location as ad, Token as ae, assertAbstractType as af, assertCompositeType as ag, assertEnumType as ah, assertEnumValueName as ai, assertInputObjectType as aj, assertInputType as ak, assertLeafType as al, assertListType as am, assertNamedType as an, assertNonNullType as ao, assertOutputType as ap, assertScalarType as aq, assertType as ar, assertUnionType as as, assertWrappingType as at, formatError as au, getLocation as av, getVisitFn as aw, isWrappingType as ax, printError as ay, printLocation as az, isAbstractType as b, PDFError as b$, LLMCostTracker as b0, getLLMCostTracker as b1, setLLMCostTracker as b2, resetLLMCostTracker as b3, setMetricsCollector as b4, getMetricsCollector as b5, resetMetricsCollector as b6, withMetrics as b7, generateCorrelationId as b8, getCorrelationId as b9, openAIChatCompletionSchema as bA, openAIImageResponseSchema as bB, validateOpenAIChatCompletion as bC, safeValidateOpenAIChatCompletion as bD, perplexityResponseSchema as bE, validatePerplexityResponse as bF, safeValidatePerplexityResponse as bG, googleSheetsValueRangeSchema as bH, validateGoogleSheetsResponse as bI, safeValidateGoogleSheetsResponse as bJ, s3ListObjectsSchema as bK, s3GetObjectSchema as bL, lambdaInvokeResponseSchema as bM, validateS3ListObjects as bN, safeValidateS3ListObjects as bO, validateLambdaResponse as bP, safeValidateLambdaResponse as bQ, createValidator as bR, createSafeValidator as bS, LumicError as bT, SlackError as bU, LLMError as bV, AWSLambdaError as bW, AWSS3Error as bX, GoogleSheetsError as bY, PerplexityError as bZ, JsonParseError as b_, getCorrelationContext as ba, withCorrelationId as bb, getCorrelationHeaders as bc, TokenBucketRateLimiter as bd, RATE_LIMIT_PROFILES as be, getRateLimiter as bf, resetAllRateLimiters as bg, withRateLimit as bh, checkIntegrationHealth as bi, SUPPORTED_MODELS as bj, isValidModel as bk, getModelCapabilities as bl, getModelProvider as bm, MODEL_ALIASES as bn, OPENAI_COMPATIBLE_PROVIDERS as bo, PROVIDER_DEFAULT_MODELS as bp, LLM_DEFAULT_PROVIDER as bq, LLM_MINI_PROVIDER as br, LLM_NORMAL_PROVIDER as bs, LLM_ADVANCED_PROVIDER as bt, LLM_PROVIDER as bu, LLM_MODEL_MINI as bv, LLM_MODEL_NORMAL as bw, LLM_MODEL_ADVANCED as bx, makeAnthropicCall as by, makeOpenAICompatibleCall as bz, isInterfaceType as c, ZipError as c0, SLACK_TIMEOUT_MS as c1, PERPLEXITY_TIMEOUT_MS as c2, GOOGLE_SHEETS_TIMEOUT_MS as c3, LLM_TIMEOUT_MS as c4, AWS_LAMBDA_TIMEOUT_MS as c5, AWS_S3_TIMEOUT_MS as c6, OPENWEATHER_TIMEOUT_MS as c7, GENERIC_FETCH_TIMEOUT_MS as c8, isObjectType as d, assertName as e, devAssert as f, isObjectLike as g, defineArguments as h, isNonNullType as i, argsToArgsConfig as j, GraphQLBoolean as k, lumic as l, GraphQLString as m, instanceOf as n, inspect as o, isInputObjectType as p, isLeafType as q, isEnumType as r, GraphQLID as s, toObjMap as t, invariant as u, GraphQLObjectType as v, GraphQLEnumType as w, GraphQLList as x, isScalarType as y, isUnionType as z };
|
|
81332
|
-
//# sourceMappingURL=index-
|
|
81361
|
+
//# sourceMappingURL=index-DYehXKUX.js.map
|