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.
Files changed (58) hide show
  1. package/dist/ai-sdk/index.d.mts +5 -5
  2. package/dist/ai-sdk/index.d.ts +5 -5
  3. package/dist/ai-sdk/index.js +45 -5
  4. package/dist/ai-sdk/index.js.map +1 -1
  5. package/dist/ai-sdk/index.mjs +45 -5
  6. package/dist/ai-sdk/index.mjs.map +1 -1
  7. package/dist/ai-sdk/middleware.d.mts +3 -3
  8. package/dist/ai-sdk/middleware.d.ts +3 -3
  9. package/dist/ai-sdk/middleware.js +37 -3
  10. package/dist/ai-sdk/middleware.js.map +1 -1
  11. package/dist/ai-sdk/middleware.mjs +37 -3
  12. package/dist/ai-sdk/middleware.mjs.map +1 -1
  13. package/dist/billing/index.d.mts +8 -6
  14. package/dist/billing/index.d.ts +8 -6
  15. package/dist/billing/index.js +312 -6
  16. package/dist/billing/index.js.map +1 -1
  17. package/dist/billing/index.mjs +319 -6
  18. package/dist/billing/index.mjs.map +1 -1
  19. package/dist/cli/index.js +8 -1
  20. package/dist/cli/index.js.map +1 -1
  21. package/dist/cli/index.mjs +8 -1
  22. package/dist/cli/index.mjs.map +1 -1
  23. package/dist/{client-eXSwD_kI.d.ts → client-0CuOBECi.d.ts} +1 -1
  24. package/dist/{client-ttJwYM7x.d.mts → client-xP86Qg_b.d.mts} +1 -1
  25. package/dist/customers/index.d.mts +1 -1
  26. package/dist/customers/index.d.ts +1 -1
  27. package/dist/database/index.d.mts +1 -1
  28. package/dist/database/index.d.ts +1 -1
  29. package/dist/index.d.mts +8 -8
  30. package/dist/index.d.ts +8 -8
  31. package/dist/index.js +52 -6
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +52 -6
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/meter/index.d.mts +2 -2
  36. package/dist/meter/index.d.ts +2 -2
  37. package/dist/meter/index.js +35 -2
  38. package/dist/meter/index.js.map +1 -1
  39. package/dist/meter/index.mjs +35 -2
  40. package/dist/meter/index.mjs.map +1 -1
  41. package/dist/pricing/index.d.mts +27 -3
  42. package/dist/pricing/index.d.ts +27 -3
  43. package/dist/pricing/index.js +34 -1
  44. package/dist/pricing/index.js.map +1 -1
  45. package/dist/pricing/index.mjs +34 -1
  46. package/dist/pricing/index.mjs.map +1 -1
  47. package/dist/react/index.d.mts +1 -1
  48. package/dist/react/index.d.ts +1 -1
  49. package/dist/{session-D9fdP255.d.mts → session-CueUIV77.d.mts} +10 -4
  50. package/dist/{session-CUnv_muf.d.ts → session-YF67Yij2.d.ts} +10 -4
  51. package/dist/{types-DHlsaLvI.d.mts → types-CqXTmCNv.d.mts} +2 -0
  52. package/dist/{types-DHlsaLvI.d.ts → types-CqXTmCNv.d.ts} +2 -0
  53. package/dist/{with-billing-DhHGWCAp.d.mts → with-billing-Df6izlJ4.d.mts} +4 -2
  54. package/dist/{with-billing-CVGxl3ot.d.ts → with-billing-DgQ380Zl.d.ts} +4 -2
  55. package/examples/nextjs-app-router-openai/package.json +1 -1
  56. package/examples/nextjs-saas-starter/package.json +1 -1
  57. package/manifest/pricing-v1.json +4904 -974
  58. package/package.json +2 -1
@@ -1,5 +1,5 @@
1
- import { M as MeterOptions, U as UsageEvent, a as UsageSummary, S as StreamWrapOptions, T as TokenUsage, C as CustomerParam } from '../types-DHlsaLvI.mjs';
2
- export { V as VibezMeter, c as createMeter } from '../client-ttJwYM7x.mjs';
1
+ import { M as MeterOptions, U as UsageEvent, a as UsageSummary, S as StreamWrapOptions, T as TokenUsage, C as CustomerParam } from '../types-CqXTmCNv.mjs';
2
+ export { V as VibezMeter, c as createMeter } from '../client-xP86Qg_b.mjs';
3
3
 
4
4
  /**
5
5
  * Detects whether the current runtime is a serverless environment
@@ -1,5 +1,5 @@
1
- import { M as MeterOptions, U as UsageEvent, a as UsageSummary, S as StreamWrapOptions, T as TokenUsage, C as CustomerParam } from '../types-DHlsaLvI.js';
2
- export { V as VibezMeter, c as createMeter } from '../client-eXSwD_kI.js';
1
+ import { M as MeterOptions, U as UsageEvent, a as UsageSummary, S as StreamWrapOptions, T as TokenUsage, C as CustomerParam } from '../types-CqXTmCNv.js';
2
+ export { V as VibezMeter, c as createMeter } from '../client-0CuOBECi.js';
3
3
 
4
4
  /**
5
5
  * Detects whether the current runtime is a serverless environment
@@ -589,6 +589,10 @@ var MODEL_PRICING_TABLE = {
589
589
  "text-embedding-3-large": { inputPer1M: 0.13, outputPer1M: 0 },
590
590
  "text-embedding-ada-002": { inputPer1M: 0.1, outputPer1M: 0 },
591
591
  // --- Anthropic (Modern & Extended Thinking) ---
592
+ "claude-haiku-5.5": { inputPer1M: 0.1, outputPer1M: 0.5, cachedInputPer1M: 0.01 },
593
+ "claude-sonnet-5.5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.1 },
594
+ "claude-opus-5.5": { inputPer1M: 4, outputPer1M: 20, cachedInputPer1M: 0.2 },
595
+ "claude-opus-5.5-fast": { inputPer1M: 8, outputPer1M: 40, cachedInputPer1M: 0.4 },
592
596
  "claude-3-7-sonnet": { inputPer1M: 0.59, outputPer1M: 2.93, cachedInputPer1M: 0.3 },
593
597
  "claude-sonnet-5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.3 },
594
598
  "claude-3-5-sonnet": { inputPer1M: 3, outputPer1M: 15, cachedInputPer1M: 0.3 },
@@ -603,6 +607,8 @@ var MODEL_PRICING_TABLE = {
603
607
  "claude-2.0": { inputPer1M: 8, outputPer1M: 24 },
604
608
  "claude-instant-1.2": { inputPer1M: 1.63, outputPer1M: 5.51 },
605
609
  // --- Google Gemini (Modern & Thoughts) ---
610
+ "gemini-3.8-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.075 },
611
+ "gemini-nano-banana-2.1": { inputPer1M: 1.5, outputPer1M: 7.5, cachedInputPer1M: 0.15 },
606
612
  "gemini-3.7-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.18 },
607
613
  "gemini-3.1-pro": { inputPer1M: 2, outputPer1M: 12, cachedInputPer1M: 0.5 },
608
614
  "gemini-3.5-flash": { inputPer1M: 1.5, outputPer1M: 9, cachedInputPer1M: 0.38 },
@@ -625,6 +631,7 @@ var MODEL_PRICING_TABLE = {
625
631
  "grok-2-vision": { inputPer1M: 2, outputPer1M: 10 },
626
632
  "grok-beta": { inputPer1M: 5, outputPer1M: 15 },
627
633
  // --- Mistral ---
634
+ "mistral-large-4": { inputPer1M: 0.68, outputPer1M: 2.09, cachedInputPer1M: 0.07 },
628
635
  "mistral-large-3": { inputPer1M: 2, outputPer1M: 6 },
629
636
  "mistral-large-latest": { inputPer1M: 2, outputPer1M: 6 },
630
637
  "mistral-large-2411": { inputPer1M: 2, outputPer1M: 6 },
@@ -706,6 +713,9 @@ var MODEL_ALIASES = {
706
713
  "sonnet-3.5": "claude-3-5-sonnet",
707
714
  "haiku": "claude-3-5-haiku",
708
715
  "haiku-3.5": "claude-3-5-haiku",
716
+ "haiku-5.5": "claude-haiku-5.5",
717
+ "sonnet-5.5": "claude-sonnet-5.5",
718
+ "opus-5.5": "claude-opus-5.5",
709
719
  "opus": "claude-3-opus",
710
720
  "claude-2": "claude-2.0",
711
721
  "claude-instant": "claude-instant-1.2",
@@ -715,6 +725,7 @@ var MODEL_ALIASES = {
715
725
  // Gemini Shorthands
716
726
  "flash": "gemini-2.0-flash",
717
727
  "pro": "gemini-1.5-pro",
728
+ "gemini-banana": "gemini-nano-banana-2.1",
718
729
  // Meta / Groq Shorthands
719
730
  "llama-3.3-70b": "llama-3.3-70b-versatile",
720
731
  "llama-3.1-70b": "llama-3.1-70b-versatile",
@@ -798,7 +809,29 @@ function getModelPricing(modelName) {
798
809
  }
799
810
 
800
811
  // src/pricing/calculator.ts
801
- function calculateCost(params) {
812
+ function calculateCost(modelOrParams, usage, optionsOrMarkup) {
813
+ let params;
814
+ if (typeof modelOrParams === "string") {
815
+ const opts = typeof optionsOrMarkup === "number" ? { markupMultiplier: optionsOrMarkup } : optionsOrMarkup || {};
816
+ params = {
817
+ model: modelOrParams,
818
+ inputTokens: usage?.inputTokens ?? usage?.promptTokens ?? 0,
819
+ outputTokens: usage?.outputTokens ?? usage?.completionTokens ?? 0,
820
+ reasoningTokens: usage?.reasoningTokens,
821
+ cachedTokens: usage?.cachedTokens,
822
+ cacheWriteTokens: usage?.cacheWriteTokens,
823
+ markupMultiplier: opts.markupMultiplier ?? opts.markup ?? opts.margin,
824
+ minimumChargeUSD: opts.minimumChargeUSD,
825
+ customRate: opts.customRate
826
+ };
827
+ } else {
828
+ params = {
829
+ ...modelOrParams,
830
+ inputTokens: modelOrParams.inputTokens ?? modelOrParams.promptTokens ?? 0,
831
+ outputTokens: modelOrParams.outputTokens ?? modelOrParams.completionTokens ?? 0,
832
+ markupMultiplier: modelOrParams.markupMultiplier ?? modelOrParams.markup ?? modelOrParams.margin
833
+ };
834
+ }
802
835
  let rates;
803
836
  if (params.customRate) {
804
837
  const outRate = params.customRate.out ?? params.customRate.output ?? 0;
@@ -1083,7 +1116,7 @@ var VibezMeter = class {
1083
1116
  batcher;
1084
1117
  markupMultiplier;
1085
1118
  constructor(options = {}) {
1086
- this.markupMultiplier = options.pricing?.margin ?? options.markupMultiplier;
1119
+ this.markupMultiplier = options.pricing?.margin ?? options.pricing?.markup ?? options.markupMultiplier;
1087
1120
  this.batcher = new MeterBatcher(options);
1088
1121
  }
1089
1122
  /**