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,8 +1,8 @@
1
- import { W as WithBillingOptions } from '../with-billing-DhHGWCAp.mjs';
2
- export { m as meteredModel, w as withBilling } from '../with-billing-DhHGWCAp.mjs';
3
- import { A as AgentSession, a as AgentSessionOptions, c as createAgentSession } from '../session-D9fdP255.mjs';
4
- import { C as CustomerParam } from '../types-DHlsaLvI.mjs';
5
- import '../client-ttJwYM7x.mjs';
1
+ import { W as WithBillingOptions } from '../with-billing-Df6izlJ4.mjs';
2
+ export { m as meteredModel, w as withBilling } from '../with-billing-Df6izlJ4.mjs';
3
+ import { A as AgentSession, a as AgentSessionOptions, c as createAgentSession } from '../session-CueUIV77.mjs';
4
+ import { C as CustomerParam } from '../types-CqXTmCNv.mjs';
5
+ import '../client-xP86Qg_b.mjs';
6
6
 
7
7
  /**
8
8
  * ✦ VibezCheck Universal Telemetry Response Stream Injector
@@ -1,8 +1,8 @@
1
- import { W as WithBillingOptions } from '../with-billing-CVGxl3ot.js';
2
- export { m as meteredModel, w as withBilling } from '../with-billing-CVGxl3ot.js';
3
- import { A as AgentSession, a as AgentSessionOptions, c as createAgentSession } from '../session-CUnv_muf.js';
4
- import { C as CustomerParam } from '../types-DHlsaLvI.js';
5
- import '../client-eXSwD_kI.js';
1
+ import { W as WithBillingOptions } from '../with-billing-DgQ380Zl.js';
2
+ export { m as meteredModel, w as withBilling } from '../with-billing-DgQ380Zl.js';
3
+ import { A as AgentSession, a as AgentSessionOptions, c as createAgentSession } from '../session-YF67Yij2.js';
4
+ import { C as CustomerParam } from '../types-CqXTmCNv.js';
5
+ import '../client-0CuOBECi.js';
6
6
 
7
7
  /**
8
8
  * ✦ VibezCheck Universal Telemetry Response Stream Injector
@@ -591,6 +591,10 @@ var MODEL_PRICING_TABLE = {
591
591
  "text-embedding-3-large": { inputPer1M: 0.13, outputPer1M: 0 },
592
592
  "text-embedding-ada-002": { inputPer1M: 0.1, outputPer1M: 0 },
593
593
  // --- Anthropic (Modern & Extended Thinking) ---
594
+ "claude-haiku-5.5": { inputPer1M: 0.1, outputPer1M: 0.5, cachedInputPer1M: 0.01 },
595
+ "claude-sonnet-5.5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.1 },
596
+ "claude-opus-5.5": { inputPer1M: 4, outputPer1M: 20, cachedInputPer1M: 0.2 },
597
+ "claude-opus-5.5-fast": { inputPer1M: 8, outputPer1M: 40, cachedInputPer1M: 0.4 },
594
598
  "claude-3-7-sonnet": { inputPer1M: 0.59, outputPer1M: 2.93, cachedInputPer1M: 0.3 },
595
599
  "claude-sonnet-5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.3 },
596
600
  "claude-3-5-sonnet": { inputPer1M: 3, outputPer1M: 15, cachedInputPer1M: 0.3 },
@@ -605,6 +609,8 @@ var MODEL_PRICING_TABLE = {
605
609
  "claude-2.0": { inputPer1M: 8, outputPer1M: 24 },
606
610
  "claude-instant-1.2": { inputPer1M: 1.63, outputPer1M: 5.51 },
607
611
  // --- Google Gemini (Modern & Thoughts) ---
612
+ "gemini-3.8-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.075 },
613
+ "gemini-nano-banana-2.1": { inputPer1M: 1.5, outputPer1M: 7.5, cachedInputPer1M: 0.15 },
608
614
  "gemini-3.7-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.18 },
609
615
  "gemini-3.1-pro": { inputPer1M: 2, outputPer1M: 12, cachedInputPer1M: 0.5 },
610
616
  "gemini-3.5-flash": { inputPer1M: 1.5, outputPer1M: 9, cachedInputPer1M: 0.38 },
@@ -627,6 +633,7 @@ var MODEL_PRICING_TABLE = {
627
633
  "grok-2-vision": { inputPer1M: 2, outputPer1M: 10 },
628
634
  "grok-beta": { inputPer1M: 5, outputPer1M: 15 },
629
635
  // --- Mistral ---
636
+ "mistral-large-4": { inputPer1M: 0.68, outputPer1M: 2.09, cachedInputPer1M: 0.07 },
630
637
  "mistral-large-3": { inputPer1M: 2, outputPer1M: 6 },
631
638
  "mistral-large-latest": { inputPer1M: 2, outputPer1M: 6 },
632
639
  "mistral-large-2411": { inputPer1M: 2, outputPer1M: 6 },
@@ -708,6 +715,9 @@ var MODEL_ALIASES = {
708
715
  "sonnet-3.5": "claude-3-5-sonnet",
709
716
  "haiku": "claude-3-5-haiku",
710
717
  "haiku-3.5": "claude-3-5-haiku",
718
+ "haiku-5.5": "claude-haiku-5.5",
719
+ "sonnet-5.5": "claude-sonnet-5.5",
720
+ "opus-5.5": "claude-opus-5.5",
711
721
  "opus": "claude-3-opus",
712
722
  "claude-2": "claude-2.0",
713
723
  "claude-instant": "claude-instant-1.2",
@@ -717,6 +727,7 @@ var MODEL_ALIASES = {
717
727
  // Gemini Shorthands
718
728
  "flash": "gemini-2.0-flash",
719
729
  "pro": "gemini-1.5-pro",
730
+ "gemini-banana": "gemini-nano-banana-2.1",
720
731
  // Meta / Groq Shorthands
721
732
  "llama-3.3-70b": "llama-3.3-70b-versatile",
722
733
  "llama-3.1-70b": "llama-3.1-70b-versatile",
@@ -800,7 +811,29 @@ function getModelPricing(modelName) {
800
811
  }
801
812
 
802
813
  // src/pricing/calculator.ts
803
- function calculateCost(params) {
814
+ function calculateCost(modelOrParams, usage, optionsOrMarkup) {
815
+ let params;
816
+ if (typeof modelOrParams === "string") {
817
+ const opts = typeof optionsOrMarkup === "number" ? { markupMultiplier: optionsOrMarkup } : optionsOrMarkup || {};
818
+ params = {
819
+ model: modelOrParams,
820
+ inputTokens: usage?.inputTokens ?? usage?.promptTokens ?? 0,
821
+ outputTokens: usage?.outputTokens ?? usage?.completionTokens ?? 0,
822
+ reasoningTokens: usage?.reasoningTokens,
823
+ cachedTokens: usage?.cachedTokens,
824
+ cacheWriteTokens: usage?.cacheWriteTokens,
825
+ markupMultiplier: opts.markupMultiplier ?? opts.markup ?? opts.margin,
826
+ minimumChargeUSD: opts.minimumChargeUSD,
827
+ customRate: opts.customRate
828
+ };
829
+ } else {
830
+ params = {
831
+ ...modelOrParams,
832
+ inputTokens: modelOrParams.inputTokens ?? modelOrParams.promptTokens ?? 0,
833
+ outputTokens: modelOrParams.outputTokens ?? modelOrParams.completionTokens ?? 0,
834
+ markupMultiplier: modelOrParams.markupMultiplier ?? modelOrParams.markup ?? modelOrParams.margin
835
+ };
836
+ }
804
837
  let rates;
805
838
  if (params.customRate) {
806
839
  const outRate = params.customRate.out ?? params.customRate.output ?? 0;
@@ -1085,7 +1118,7 @@ var VibezMeter = class {
1085
1118
  batcher;
1086
1119
  markupMultiplier;
1087
1120
  constructor(options = {}) {
1088
- this.markupMultiplier = options.pricing?.margin ?? options.markupMultiplier;
1121
+ this.markupMultiplier = options.pricing?.margin ?? options.pricing?.markup ?? options.markupMultiplier;
1089
1122
  this.batcher = new MeterBatcher(options);
1090
1123
  }
1091
1124
  /**
@@ -1277,7 +1310,7 @@ function withBilling(model, optionsOrCustomer, extraOptions = {}) {
1277
1310
  cacheWriteTokens: cacheWriteTokens > 0 ? cacheWriteTokens : void 0
1278
1311
  };
1279
1312
  const cost = calculateUsageCost(modelId, usage, {
1280
- markupMultiplier: options.pricing?.margin,
1313
+ markupMultiplier: options.pricing?.margin ?? options.pricing?.markup,
1281
1314
  minimumChargeUSD: options.pricing?.minimumChargeUSD,
1282
1315
  customRate: options.rate
1283
1316
  });
@@ -1316,6 +1349,7 @@ function withBilling(model, optionsOrCustomer, extraOptions = {}) {
1316
1349
  const mergedMetadata = {
1317
1350
  ...customerMetadata,
1318
1351
  ...options.metadata,
1352
+ ...options.threadId ? { threadId: options.threadId } : {},
1319
1353
  ...extraMeta
1320
1354
  };
1321
1355
  const event = {
@@ -1684,7 +1718,7 @@ var AgentSession = class {
1684
1718
  */
1685
1719
  model(modelOrId, modelOptions = {}) {
1686
1720
  const session = this;
1687
- return withBilling(modelOrId, {
1721
+ return createVibezModel(modelOrId, {
1688
1722
  ...modelOptions,
1689
1723
  customer: this.customer,
1690
1724
  pricing: modelOptions.pricing || this.options.pricing,
@@ -1776,7 +1810,13 @@ var AgentSession = class {
1776
1810
  const defaultCost = options.costPerActionUSD ?? 5e-3;
1777
1811
  const instrumented = {};
1778
1812
  for (const [name, toolDef] of Object.entries(toolsRecord)) {
1779
- const costUSD = options.costs?.[name] ?? defaultCost;
1813
+ let costUSD = defaultCost;
1814
+ if (options && "costs" in options && options.costs?.[name] !== void 0) {
1815
+ costUSD = options.costs[name];
1816
+ } else if (options && name in options) {
1817
+ const val = options[name];
1818
+ costUSD = typeof val === "number" ? val : val?.costUSD ?? defaultCost;
1819
+ }
1780
1820
  instrumented[name] = this.wrapTool(toolDef, { name, costUSD });
1781
1821
  }
1782
1822
  return instrumented;