vibezcheck 0.5.11 → 0.5.13
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/ai-sdk/index.d.mts +5 -5
- package/dist/ai-sdk/index.d.ts +5 -5
- package/dist/ai-sdk/index.js +45 -5
- package/dist/ai-sdk/index.js.map +1 -1
- package/dist/ai-sdk/index.mjs +45 -5
- package/dist/ai-sdk/index.mjs.map +1 -1
- package/dist/ai-sdk/middleware.d.mts +3 -3
- package/dist/ai-sdk/middleware.d.ts +3 -3
- package/dist/ai-sdk/middleware.js +37 -3
- package/dist/ai-sdk/middleware.js.map +1 -1
- package/dist/ai-sdk/middleware.mjs +37 -3
- package/dist/ai-sdk/middleware.mjs.map +1 -1
- package/dist/billing/index.d.mts +8 -6
- package/dist/billing/index.d.ts +8 -6
- package/dist/billing/index.js +312 -6
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +319 -6
- package/dist/billing/index.mjs.map +1 -1
- package/dist/cli/index.js +8 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +8 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/{client-eXSwD_kI.d.ts → client-0CuOBECi.d.ts} +1 -1
- package/dist/{client-ttJwYM7x.d.mts → client-xP86Qg_b.d.mts} +1 -1
- package/dist/customers/index.d.mts +1 -1
- package/dist/customers/index.d.ts +1 -1
- package/dist/database/index.d.mts +1 -1
- package/dist/database/index.d.ts +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +52 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -6
- package/dist/index.mjs.map +1 -1
- package/dist/meter/index.d.mts +2 -2
- package/dist/meter/index.d.ts +2 -2
- package/dist/meter/index.js +35 -2
- package/dist/meter/index.js.map +1 -1
- package/dist/meter/index.mjs +35 -2
- package/dist/meter/index.mjs.map +1 -1
- package/dist/pricing/index.d.mts +27 -3
- package/dist/pricing/index.d.ts +27 -3
- package/dist/pricing/index.js +34 -1
- package/dist/pricing/index.js.map +1 -1
- package/dist/pricing/index.mjs +34 -1
- package/dist/pricing/index.mjs.map +1 -1
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/{session-D9fdP255.d.mts → session-CueUIV77.d.mts} +10 -4
- package/dist/{session-CUnv_muf.d.ts → session-YF67Yij2.d.ts} +10 -4
- package/dist/{types-DHlsaLvI.d.mts → types-CqXTmCNv.d.mts} +2 -0
- package/dist/{types-DHlsaLvI.d.ts → types-CqXTmCNv.d.ts} +2 -0
- package/dist/{with-billing-DhHGWCAp.d.mts → with-billing-Df6izlJ4.d.mts} +4 -2
- package/dist/{with-billing-CVGxl3ot.d.ts → with-billing-DgQ380Zl.d.ts} +4 -2
- package/examples/nextjs-app-router-openai/package.json +1 -1
- package/examples/nextjs-saas-starter/package.json +1 -1
- package/manifest/pricing-v1.json +4904 -974
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -808,6 +808,10 @@ var MODEL_PRICING_TABLE = {
|
|
|
808
808
|
"text-embedding-3-large": { inputPer1M: 0.13, outputPer1M: 0 },
|
|
809
809
|
"text-embedding-ada-002": { inputPer1M: 0.1, outputPer1M: 0 },
|
|
810
810
|
// --- Anthropic (Modern & Extended Thinking) ---
|
|
811
|
+
"claude-haiku-5.5": { inputPer1M: 0.1, outputPer1M: 0.5, cachedInputPer1M: 0.01 },
|
|
812
|
+
"claude-sonnet-5.5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.1 },
|
|
813
|
+
"claude-opus-5.5": { inputPer1M: 4, outputPer1M: 20, cachedInputPer1M: 0.2 },
|
|
814
|
+
"claude-opus-5.5-fast": { inputPer1M: 8, outputPer1M: 40, cachedInputPer1M: 0.4 },
|
|
811
815
|
"claude-3-7-sonnet": { inputPer1M: 0.59, outputPer1M: 2.93, cachedInputPer1M: 0.3 },
|
|
812
816
|
"claude-sonnet-5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.3 },
|
|
813
817
|
"claude-3-5-sonnet": { inputPer1M: 3, outputPer1M: 15, cachedInputPer1M: 0.3 },
|
|
@@ -822,6 +826,8 @@ var MODEL_PRICING_TABLE = {
|
|
|
822
826
|
"claude-2.0": { inputPer1M: 8, outputPer1M: 24 },
|
|
823
827
|
"claude-instant-1.2": { inputPer1M: 1.63, outputPer1M: 5.51 },
|
|
824
828
|
// --- Google Gemini (Modern & Thoughts) ---
|
|
829
|
+
"gemini-3.8-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.075 },
|
|
830
|
+
"gemini-nano-banana-2.1": { inputPer1M: 1.5, outputPer1M: 7.5, cachedInputPer1M: 0.15 },
|
|
825
831
|
"gemini-3.7-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.18 },
|
|
826
832
|
"gemini-3.1-pro": { inputPer1M: 2, outputPer1M: 12, cachedInputPer1M: 0.5 },
|
|
827
833
|
"gemini-3.5-flash": { inputPer1M: 1.5, outputPer1M: 9, cachedInputPer1M: 0.38 },
|
|
@@ -844,6 +850,7 @@ var MODEL_PRICING_TABLE = {
|
|
|
844
850
|
"grok-2-vision": { inputPer1M: 2, outputPer1M: 10 },
|
|
845
851
|
"grok-beta": { inputPer1M: 5, outputPer1M: 15 },
|
|
846
852
|
// --- Mistral ---
|
|
853
|
+
"mistral-large-4": { inputPer1M: 0.68, outputPer1M: 2.09, cachedInputPer1M: 0.07 },
|
|
847
854
|
"mistral-large-3": { inputPer1M: 2, outputPer1M: 6 },
|
|
848
855
|
"mistral-large-latest": { inputPer1M: 2, outputPer1M: 6 },
|
|
849
856
|
"mistral-large-2411": { inputPer1M: 2, outputPer1M: 6 },
|
|
@@ -925,6 +932,9 @@ var MODEL_ALIASES = {
|
|
|
925
932
|
"sonnet-3.5": "claude-3-5-sonnet",
|
|
926
933
|
"haiku": "claude-3-5-haiku",
|
|
927
934
|
"haiku-3.5": "claude-3-5-haiku",
|
|
935
|
+
"haiku-5.5": "claude-haiku-5.5",
|
|
936
|
+
"sonnet-5.5": "claude-sonnet-5.5",
|
|
937
|
+
"opus-5.5": "claude-opus-5.5",
|
|
928
938
|
"opus": "claude-3-opus",
|
|
929
939
|
"claude-2": "claude-2.0",
|
|
930
940
|
"claude-instant": "claude-instant-1.2",
|
|
@@ -934,6 +944,7 @@ var MODEL_ALIASES = {
|
|
|
934
944
|
// Gemini Shorthands
|
|
935
945
|
"flash": "gemini-2.0-flash",
|
|
936
946
|
"pro": "gemini-1.5-pro",
|
|
947
|
+
"gemini-banana": "gemini-nano-banana-2.1",
|
|
937
948
|
// Meta / Groq Shorthands
|
|
938
949
|
"llama-3.3-70b": "llama-3.3-70b-versatile",
|
|
939
950
|
"llama-3.1-70b": "llama-3.1-70b-versatile",
|
|
@@ -1022,7 +1033,29 @@ function registerModelPricing(modelName, rates) {
|
|
|
1022
1033
|
}
|
|
1023
1034
|
|
|
1024
1035
|
// src/pricing/calculator.ts
|
|
1025
|
-
function calculateCost(
|
|
1036
|
+
function calculateCost(modelOrParams, usage, optionsOrMarkup) {
|
|
1037
|
+
let params;
|
|
1038
|
+
if (typeof modelOrParams === "string") {
|
|
1039
|
+
const opts = typeof optionsOrMarkup === "number" ? { markupMultiplier: optionsOrMarkup } : optionsOrMarkup || {};
|
|
1040
|
+
params = {
|
|
1041
|
+
model: modelOrParams,
|
|
1042
|
+
inputTokens: usage?.inputTokens ?? usage?.promptTokens ?? 0,
|
|
1043
|
+
outputTokens: usage?.outputTokens ?? usage?.completionTokens ?? 0,
|
|
1044
|
+
reasoningTokens: usage?.reasoningTokens,
|
|
1045
|
+
cachedTokens: usage?.cachedTokens,
|
|
1046
|
+
cacheWriteTokens: usage?.cacheWriteTokens,
|
|
1047
|
+
markupMultiplier: opts.markupMultiplier ?? opts.markup ?? opts.margin,
|
|
1048
|
+
minimumChargeUSD: opts.minimumChargeUSD,
|
|
1049
|
+
customRate: opts.customRate
|
|
1050
|
+
};
|
|
1051
|
+
} else {
|
|
1052
|
+
params = {
|
|
1053
|
+
...modelOrParams,
|
|
1054
|
+
inputTokens: modelOrParams.inputTokens ?? modelOrParams.promptTokens ?? 0,
|
|
1055
|
+
outputTokens: modelOrParams.outputTokens ?? modelOrParams.completionTokens ?? 0,
|
|
1056
|
+
markupMultiplier: modelOrParams.markupMultiplier ?? modelOrParams.markup ?? modelOrParams.margin
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1026
1059
|
let rates;
|
|
1027
1060
|
if (params.customRate) {
|
|
1028
1061
|
const outRate = params.customRate.out ?? params.customRate.output ?? 0;
|
|
@@ -1307,7 +1340,7 @@ var VibezMeter = class {
|
|
|
1307
1340
|
batcher;
|
|
1308
1341
|
markupMultiplier;
|
|
1309
1342
|
constructor(options = {}) {
|
|
1310
|
-
this.markupMultiplier = options.pricing?.margin ?? options.markupMultiplier;
|
|
1343
|
+
this.markupMultiplier = options.pricing?.margin ?? options.pricing?.markup ?? options.markupMultiplier;
|
|
1311
1344
|
this.batcher = new MeterBatcher(options);
|
|
1312
1345
|
}
|
|
1313
1346
|
/**
|
|
@@ -1509,7 +1542,7 @@ function withBilling(model, optionsOrCustomer, extraOptions = {}) {
|
|
|
1509
1542
|
cacheWriteTokens: cacheWriteTokens > 0 ? cacheWriteTokens : void 0
|
|
1510
1543
|
};
|
|
1511
1544
|
const cost = calculateUsageCost(modelId, usage, {
|
|
1512
|
-
markupMultiplier: options.pricing?.margin,
|
|
1545
|
+
markupMultiplier: options.pricing?.margin ?? options.pricing?.markup,
|
|
1513
1546
|
minimumChargeUSD: options.pricing?.minimumChargeUSD,
|
|
1514
1547
|
customRate: options.rate
|
|
1515
1548
|
});
|
|
@@ -1548,6 +1581,7 @@ function withBilling(model, optionsOrCustomer, extraOptions = {}) {
|
|
|
1548
1581
|
const mergedMetadata = {
|
|
1549
1582
|
...customerMetadata,
|
|
1550
1583
|
...options.metadata,
|
|
1584
|
+
...options.threadId ? { threadId: options.threadId } : {},
|
|
1551
1585
|
...extraMeta
|
|
1552
1586
|
};
|
|
1553
1587
|
const event = {
|
|
@@ -2160,7 +2194,7 @@ var AgentSession = class {
|
|
|
2160
2194
|
*/
|
|
2161
2195
|
model(modelOrId, modelOptions = {}) {
|
|
2162
2196
|
const session = this;
|
|
2163
|
-
return
|
|
2197
|
+
return createVibezModel(modelOrId, {
|
|
2164
2198
|
...modelOptions,
|
|
2165
2199
|
customer: this.customer,
|
|
2166
2200
|
pricing: modelOptions.pricing || this.options.pricing,
|
|
@@ -2252,7 +2286,13 @@ var AgentSession = class {
|
|
|
2252
2286
|
const defaultCost = options.costPerActionUSD ?? 5e-3;
|
|
2253
2287
|
const instrumented = {};
|
|
2254
2288
|
for (const [name, toolDef] of Object.entries(toolsRecord)) {
|
|
2255
|
-
|
|
2289
|
+
let costUSD = defaultCost;
|
|
2290
|
+
if (options && "costs" in options && options.costs?.[name] !== void 0) {
|
|
2291
|
+
costUSD = options.costs[name];
|
|
2292
|
+
} else if (options && name in options) {
|
|
2293
|
+
const val = options[name];
|
|
2294
|
+
costUSD = typeof val === "number" ? val : val?.costUSD ?? defaultCost;
|
|
2295
|
+
}
|
|
2256
2296
|
instrumented[name] = this.wrapTool(toolDef, { name, costUSD });
|
|
2257
2297
|
}
|
|
2258
2298
|
return instrumented;
|
|
@@ -2484,7 +2524,13 @@ function instrumentToolKit(tools, options = {}) {
|
|
|
2484
2524
|
const instrumented = {};
|
|
2485
2525
|
const cost = options.costPerActionUSD ?? 5e-3;
|
|
2486
2526
|
for (const [toolName, toolDef] of Object.entries(tools)) {
|
|
2487
|
-
|
|
2527
|
+
let actionCost = cost;
|
|
2528
|
+
if (options && "costs" in options && options.costs?.[toolName] !== void 0) {
|
|
2529
|
+
actionCost = options.costs[toolName];
|
|
2530
|
+
} else if (options && toolName in options) {
|
|
2531
|
+
const val = options[toolName];
|
|
2532
|
+
actionCost = typeof val === "number" ? val : val?.costUSD ?? cost;
|
|
2533
|
+
}
|
|
2488
2534
|
instrumented[toolName] = wrapTool({
|
|
2489
2535
|
name: toolName,
|
|
2490
2536
|
costUSD: actionCost,
|