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/ai-sdk/index.mjs
CHANGED
|
@@ -564,6 +564,10 @@ var MODEL_PRICING_TABLE = {
|
|
|
564
564
|
"text-embedding-3-large": { inputPer1M: 0.13, outputPer1M: 0 },
|
|
565
565
|
"text-embedding-ada-002": { inputPer1M: 0.1, outputPer1M: 0 },
|
|
566
566
|
// --- Anthropic (Modern & Extended Thinking) ---
|
|
567
|
+
"claude-haiku-5.5": { inputPer1M: 0.1, outputPer1M: 0.5, cachedInputPer1M: 0.01 },
|
|
568
|
+
"claude-sonnet-5.5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.1 },
|
|
569
|
+
"claude-opus-5.5": { inputPer1M: 4, outputPer1M: 20, cachedInputPer1M: 0.2 },
|
|
570
|
+
"claude-opus-5.5-fast": { inputPer1M: 8, outputPer1M: 40, cachedInputPer1M: 0.4 },
|
|
567
571
|
"claude-3-7-sonnet": { inputPer1M: 0.59, outputPer1M: 2.93, cachedInputPer1M: 0.3 },
|
|
568
572
|
"claude-sonnet-5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.3 },
|
|
569
573
|
"claude-3-5-sonnet": { inputPer1M: 3, outputPer1M: 15, cachedInputPer1M: 0.3 },
|
|
@@ -578,6 +582,8 @@ var MODEL_PRICING_TABLE = {
|
|
|
578
582
|
"claude-2.0": { inputPer1M: 8, outputPer1M: 24 },
|
|
579
583
|
"claude-instant-1.2": { inputPer1M: 1.63, outputPer1M: 5.51 },
|
|
580
584
|
// --- Google Gemini (Modern & Thoughts) ---
|
|
585
|
+
"gemini-3.8-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.075 },
|
|
586
|
+
"gemini-nano-banana-2.1": { inputPer1M: 1.5, outputPer1M: 7.5, cachedInputPer1M: 0.15 },
|
|
581
587
|
"gemini-3.7-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.18 },
|
|
582
588
|
"gemini-3.1-pro": { inputPer1M: 2, outputPer1M: 12, cachedInputPer1M: 0.5 },
|
|
583
589
|
"gemini-3.5-flash": { inputPer1M: 1.5, outputPer1M: 9, cachedInputPer1M: 0.38 },
|
|
@@ -600,6 +606,7 @@ var MODEL_PRICING_TABLE = {
|
|
|
600
606
|
"grok-2-vision": { inputPer1M: 2, outputPer1M: 10 },
|
|
601
607
|
"grok-beta": { inputPer1M: 5, outputPer1M: 15 },
|
|
602
608
|
// --- Mistral ---
|
|
609
|
+
"mistral-large-4": { inputPer1M: 0.68, outputPer1M: 2.09, cachedInputPer1M: 0.07 },
|
|
603
610
|
"mistral-large-3": { inputPer1M: 2, outputPer1M: 6 },
|
|
604
611
|
"mistral-large-latest": { inputPer1M: 2, outputPer1M: 6 },
|
|
605
612
|
"mistral-large-2411": { inputPer1M: 2, outputPer1M: 6 },
|
|
@@ -681,6 +688,9 @@ var MODEL_ALIASES = {
|
|
|
681
688
|
"sonnet-3.5": "claude-3-5-sonnet",
|
|
682
689
|
"haiku": "claude-3-5-haiku",
|
|
683
690
|
"haiku-3.5": "claude-3-5-haiku",
|
|
691
|
+
"haiku-5.5": "claude-haiku-5.5",
|
|
692
|
+
"sonnet-5.5": "claude-sonnet-5.5",
|
|
693
|
+
"opus-5.5": "claude-opus-5.5",
|
|
684
694
|
"opus": "claude-3-opus",
|
|
685
695
|
"claude-2": "claude-2.0",
|
|
686
696
|
"claude-instant": "claude-instant-1.2",
|
|
@@ -690,6 +700,7 @@ var MODEL_ALIASES = {
|
|
|
690
700
|
// Gemini Shorthands
|
|
691
701
|
"flash": "gemini-2.0-flash",
|
|
692
702
|
"pro": "gemini-1.5-pro",
|
|
703
|
+
"gemini-banana": "gemini-nano-banana-2.1",
|
|
693
704
|
// Meta / Groq Shorthands
|
|
694
705
|
"llama-3.3-70b": "llama-3.3-70b-versatile",
|
|
695
706
|
"llama-3.1-70b": "llama-3.1-70b-versatile",
|
|
@@ -773,7 +784,29 @@ function getModelPricing(modelName) {
|
|
|
773
784
|
}
|
|
774
785
|
|
|
775
786
|
// src/pricing/calculator.ts
|
|
776
|
-
function calculateCost(
|
|
787
|
+
function calculateCost(modelOrParams, usage, optionsOrMarkup) {
|
|
788
|
+
let params;
|
|
789
|
+
if (typeof modelOrParams === "string") {
|
|
790
|
+
const opts = typeof optionsOrMarkup === "number" ? { markupMultiplier: optionsOrMarkup } : optionsOrMarkup || {};
|
|
791
|
+
params = {
|
|
792
|
+
model: modelOrParams,
|
|
793
|
+
inputTokens: usage?.inputTokens ?? usage?.promptTokens ?? 0,
|
|
794
|
+
outputTokens: usage?.outputTokens ?? usage?.completionTokens ?? 0,
|
|
795
|
+
reasoningTokens: usage?.reasoningTokens,
|
|
796
|
+
cachedTokens: usage?.cachedTokens,
|
|
797
|
+
cacheWriteTokens: usage?.cacheWriteTokens,
|
|
798
|
+
markupMultiplier: opts.markupMultiplier ?? opts.markup ?? opts.margin,
|
|
799
|
+
minimumChargeUSD: opts.minimumChargeUSD,
|
|
800
|
+
customRate: opts.customRate
|
|
801
|
+
};
|
|
802
|
+
} else {
|
|
803
|
+
params = {
|
|
804
|
+
...modelOrParams,
|
|
805
|
+
inputTokens: modelOrParams.inputTokens ?? modelOrParams.promptTokens ?? 0,
|
|
806
|
+
outputTokens: modelOrParams.outputTokens ?? modelOrParams.completionTokens ?? 0,
|
|
807
|
+
markupMultiplier: modelOrParams.markupMultiplier ?? modelOrParams.markup ?? modelOrParams.margin
|
|
808
|
+
};
|
|
809
|
+
}
|
|
777
810
|
let rates;
|
|
778
811
|
if (params.customRate) {
|
|
779
812
|
const outRate = params.customRate.out ?? params.customRate.output ?? 0;
|
|
@@ -1058,7 +1091,7 @@ var VibezMeter = class {
|
|
|
1058
1091
|
batcher;
|
|
1059
1092
|
markupMultiplier;
|
|
1060
1093
|
constructor(options = {}) {
|
|
1061
|
-
this.markupMultiplier = options.pricing?.margin ?? options.markupMultiplier;
|
|
1094
|
+
this.markupMultiplier = options.pricing?.margin ?? options.pricing?.markup ?? options.markupMultiplier;
|
|
1062
1095
|
this.batcher = new MeterBatcher(options);
|
|
1063
1096
|
}
|
|
1064
1097
|
/**
|
|
@@ -1250,7 +1283,7 @@ function withBilling(model, optionsOrCustomer, extraOptions = {}) {
|
|
|
1250
1283
|
cacheWriteTokens: cacheWriteTokens > 0 ? cacheWriteTokens : void 0
|
|
1251
1284
|
};
|
|
1252
1285
|
const cost = calculateUsageCost(modelId, usage, {
|
|
1253
|
-
markupMultiplier: options.pricing?.margin,
|
|
1286
|
+
markupMultiplier: options.pricing?.margin ?? options.pricing?.markup,
|
|
1254
1287
|
minimumChargeUSD: options.pricing?.minimumChargeUSD,
|
|
1255
1288
|
customRate: options.rate
|
|
1256
1289
|
});
|
|
@@ -1289,6 +1322,7 @@ function withBilling(model, optionsOrCustomer, extraOptions = {}) {
|
|
|
1289
1322
|
const mergedMetadata = {
|
|
1290
1323
|
...customerMetadata,
|
|
1291
1324
|
...options.metadata,
|
|
1325
|
+
...options.threadId ? { threadId: options.threadId } : {},
|
|
1292
1326
|
...extraMeta
|
|
1293
1327
|
};
|
|
1294
1328
|
const event = {
|
|
@@ -1657,7 +1691,7 @@ var AgentSession = class {
|
|
|
1657
1691
|
*/
|
|
1658
1692
|
model(modelOrId, modelOptions = {}) {
|
|
1659
1693
|
const session = this;
|
|
1660
|
-
return
|
|
1694
|
+
return createVibezModel(modelOrId, {
|
|
1661
1695
|
...modelOptions,
|
|
1662
1696
|
customer: this.customer,
|
|
1663
1697
|
pricing: modelOptions.pricing || this.options.pricing,
|
|
@@ -1749,7 +1783,13 @@ var AgentSession = class {
|
|
|
1749
1783
|
const defaultCost = options.costPerActionUSD ?? 5e-3;
|
|
1750
1784
|
const instrumented = {};
|
|
1751
1785
|
for (const [name, toolDef] of Object.entries(toolsRecord)) {
|
|
1752
|
-
|
|
1786
|
+
let costUSD = defaultCost;
|
|
1787
|
+
if (options && "costs" in options && options.costs?.[name] !== void 0) {
|
|
1788
|
+
costUSD = options.costs[name];
|
|
1789
|
+
} else if (options && name in options) {
|
|
1790
|
+
const val = options[name];
|
|
1791
|
+
costUSD = typeof val === "number" ? val : val?.costUSD ?? defaultCost;
|
|
1792
|
+
}
|
|
1753
1793
|
instrumented[name] = this.wrapTool(toolDef, { name, costUSD });
|
|
1754
1794
|
}
|
|
1755
1795
|
return instrumented;
|