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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { W as WithBillingOptions } from '../with-billing-
|
|
2
|
-
import '../types-
|
|
3
|
-
import '../client-
|
|
1
|
+
import { W as WithBillingOptions } from '../with-billing-Df6izlJ4.mjs';
|
|
2
|
+
import '../types-CqXTmCNv.mjs';
|
|
3
|
+
import '../client-xP86Qg_b.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* VibezCheck Middleware for Vercel AI SDK wrapLanguageModel({ model, middleware })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { W as WithBillingOptions } from '../with-billing-
|
|
2
|
-
import '../types-
|
|
3
|
-
import '../client-
|
|
1
|
+
import { W as WithBillingOptions } from '../with-billing-DgQ380Zl.js';
|
|
2
|
+
import '../types-CqXTmCNv.js';
|
|
3
|
+
import '../client-0CuOBECi.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* VibezCheck Middleware for Vercel AI SDK wrapLanguageModel({ model, middleware })
|
|
@@ -584,6 +584,10 @@ var MODEL_PRICING_TABLE = {
|
|
|
584
584
|
"text-embedding-3-large": { inputPer1M: 0.13, outputPer1M: 0 },
|
|
585
585
|
"text-embedding-ada-002": { inputPer1M: 0.1, outputPer1M: 0 },
|
|
586
586
|
// --- Anthropic (Modern & Extended Thinking) ---
|
|
587
|
+
"claude-haiku-5.5": { inputPer1M: 0.1, outputPer1M: 0.5, cachedInputPer1M: 0.01 },
|
|
588
|
+
"claude-sonnet-5.5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.1 },
|
|
589
|
+
"claude-opus-5.5": { inputPer1M: 4, outputPer1M: 20, cachedInputPer1M: 0.2 },
|
|
590
|
+
"claude-opus-5.5-fast": { inputPer1M: 8, outputPer1M: 40, cachedInputPer1M: 0.4 },
|
|
587
591
|
"claude-3-7-sonnet": { inputPer1M: 0.59, outputPer1M: 2.93, cachedInputPer1M: 0.3 },
|
|
588
592
|
"claude-sonnet-5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.3 },
|
|
589
593
|
"claude-3-5-sonnet": { inputPer1M: 3, outputPer1M: 15, cachedInputPer1M: 0.3 },
|
|
@@ -598,6 +602,8 @@ var MODEL_PRICING_TABLE = {
|
|
|
598
602
|
"claude-2.0": { inputPer1M: 8, outputPer1M: 24 },
|
|
599
603
|
"claude-instant-1.2": { inputPer1M: 1.63, outputPer1M: 5.51 },
|
|
600
604
|
// --- Google Gemini (Modern & Thoughts) ---
|
|
605
|
+
"gemini-3.8-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.075 },
|
|
606
|
+
"gemini-nano-banana-2.1": { inputPer1M: 1.5, outputPer1M: 7.5, cachedInputPer1M: 0.15 },
|
|
601
607
|
"gemini-3.7-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.18 },
|
|
602
608
|
"gemini-3.1-pro": { inputPer1M: 2, outputPer1M: 12, cachedInputPer1M: 0.5 },
|
|
603
609
|
"gemini-3.5-flash": { inputPer1M: 1.5, outputPer1M: 9, cachedInputPer1M: 0.38 },
|
|
@@ -620,6 +626,7 @@ var MODEL_PRICING_TABLE = {
|
|
|
620
626
|
"grok-2-vision": { inputPer1M: 2, outputPer1M: 10 },
|
|
621
627
|
"grok-beta": { inputPer1M: 5, outputPer1M: 15 },
|
|
622
628
|
// --- Mistral ---
|
|
629
|
+
"mistral-large-4": { inputPer1M: 0.68, outputPer1M: 2.09, cachedInputPer1M: 0.07 },
|
|
623
630
|
"mistral-large-3": { inputPer1M: 2, outputPer1M: 6 },
|
|
624
631
|
"mistral-large-latest": { inputPer1M: 2, outputPer1M: 6 },
|
|
625
632
|
"mistral-large-2411": { inputPer1M: 2, outputPer1M: 6 },
|
|
@@ -701,6 +708,9 @@ var MODEL_ALIASES = {
|
|
|
701
708
|
"sonnet-3.5": "claude-3-5-sonnet",
|
|
702
709
|
"haiku": "claude-3-5-haiku",
|
|
703
710
|
"haiku-3.5": "claude-3-5-haiku",
|
|
711
|
+
"haiku-5.5": "claude-haiku-5.5",
|
|
712
|
+
"sonnet-5.5": "claude-sonnet-5.5",
|
|
713
|
+
"opus-5.5": "claude-opus-5.5",
|
|
704
714
|
"opus": "claude-3-opus",
|
|
705
715
|
"claude-2": "claude-2.0",
|
|
706
716
|
"claude-instant": "claude-instant-1.2",
|
|
@@ -710,6 +720,7 @@ var MODEL_ALIASES = {
|
|
|
710
720
|
// Gemini Shorthands
|
|
711
721
|
"flash": "gemini-2.0-flash",
|
|
712
722
|
"pro": "gemini-1.5-pro",
|
|
723
|
+
"gemini-banana": "gemini-nano-banana-2.1",
|
|
713
724
|
// Meta / Groq Shorthands
|
|
714
725
|
"llama-3.3-70b": "llama-3.3-70b-versatile",
|
|
715
726
|
"llama-3.1-70b": "llama-3.1-70b-versatile",
|
|
@@ -793,7 +804,29 @@ function getModelPricing(modelName) {
|
|
|
793
804
|
}
|
|
794
805
|
|
|
795
806
|
// src/pricing/calculator.ts
|
|
796
|
-
function calculateCost(
|
|
807
|
+
function calculateCost(modelOrParams, usage, optionsOrMarkup) {
|
|
808
|
+
let params;
|
|
809
|
+
if (typeof modelOrParams === "string") {
|
|
810
|
+
const opts = typeof optionsOrMarkup === "number" ? { markupMultiplier: optionsOrMarkup } : optionsOrMarkup || {};
|
|
811
|
+
params = {
|
|
812
|
+
model: modelOrParams,
|
|
813
|
+
inputTokens: usage?.inputTokens ?? usage?.promptTokens ?? 0,
|
|
814
|
+
outputTokens: usage?.outputTokens ?? usage?.completionTokens ?? 0,
|
|
815
|
+
reasoningTokens: usage?.reasoningTokens,
|
|
816
|
+
cachedTokens: usage?.cachedTokens,
|
|
817
|
+
cacheWriteTokens: usage?.cacheWriteTokens,
|
|
818
|
+
markupMultiplier: opts.markupMultiplier ?? opts.markup ?? opts.margin,
|
|
819
|
+
minimumChargeUSD: opts.minimumChargeUSD,
|
|
820
|
+
customRate: opts.customRate
|
|
821
|
+
};
|
|
822
|
+
} else {
|
|
823
|
+
params = {
|
|
824
|
+
...modelOrParams,
|
|
825
|
+
inputTokens: modelOrParams.inputTokens ?? modelOrParams.promptTokens ?? 0,
|
|
826
|
+
outputTokens: modelOrParams.outputTokens ?? modelOrParams.completionTokens ?? 0,
|
|
827
|
+
markupMultiplier: modelOrParams.markupMultiplier ?? modelOrParams.markup ?? modelOrParams.margin
|
|
828
|
+
};
|
|
829
|
+
}
|
|
797
830
|
let rates;
|
|
798
831
|
if (params.customRate) {
|
|
799
832
|
const outRate = params.customRate.out ?? params.customRate.output ?? 0;
|
|
@@ -1078,7 +1111,7 @@ var VibezMeter = class {
|
|
|
1078
1111
|
batcher;
|
|
1079
1112
|
markupMultiplier;
|
|
1080
1113
|
constructor(options = {}) {
|
|
1081
|
-
this.markupMultiplier = options.pricing?.margin ?? options.markupMultiplier;
|
|
1114
|
+
this.markupMultiplier = options.pricing?.margin ?? options.pricing?.markup ?? options.markupMultiplier;
|
|
1082
1115
|
this.batcher = new MeterBatcher(options);
|
|
1083
1116
|
}
|
|
1084
1117
|
/**
|
|
@@ -1270,7 +1303,7 @@ function withBilling(model, optionsOrCustomer, extraOptions = {}) {
|
|
|
1270
1303
|
cacheWriteTokens: cacheWriteTokens > 0 ? cacheWriteTokens : void 0
|
|
1271
1304
|
};
|
|
1272
1305
|
const cost = calculateUsageCost(modelId, usage, {
|
|
1273
|
-
markupMultiplier: options.pricing?.margin,
|
|
1306
|
+
markupMultiplier: options.pricing?.margin ?? options.pricing?.markup,
|
|
1274
1307
|
minimumChargeUSD: options.pricing?.minimumChargeUSD,
|
|
1275
1308
|
customRate: options.rate
|
|
1276
1309
|
});
|
|
@@ -1309,6 +1342,7 @@ function withBilling(model, optionsOrCustomer, extraOptions = {}) {
|
|
|
1309
1342
|
const mergedMetadata = {
|
|
1310
1343
|
...customerMetadata,
|
|
1311
1344
|
...options.metadata,
|
|
1345
|
+
...options.threadId ? { threadId: options.threadId } : {},
|
|
1312
1346
|
...extraMeta
|
|
1313
1347
|
};
|
|
1314
1348
|
const event = {
|