vibezcheck 0.4.1 → 0.4.2

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 (38) hide show
  1. package/README.md +273 -203
  2. package/dist/ai-sdk/index.d.mts +6 -4
  3. package/dist/ai-sdk/index.d.ts +6 -4
  4. package/dist/ai-sdk/index.js +184 -22
  5. package/dist/ai-sdk/index.js.map +1 -1
  6. package/dist/ai-sdk/index.mjs +184 -22
  7. package/dist/ai-sdk/index.mjs.map +1 -1
  8. package/dist/cli/index.js +2 -2
  9. package/dist/cli/index.js.map +1 -1
  10. package/dist/cli/index.mjs +2 -2
  11. package/dist/cli/index.mjs.map +1 -1
  12. package/dist/{client-kJN_Znan.d.ts → client-w_hWhQ6g.d.mts} +4 -2
  13. package/dist/{client--iq93FQg.d.mts → client-ynfWcHX6.d.ts} +4 -2
  14. package/dist/customers/index.d.mts +30 -4
  15. package/dist/customers/index.d.ts +30 -4
  16. package/dist/customers/index.js +108 -8
  17. package/dist/customers/index.js.map +1 -1
  18. package/dist/customers/index.mjs +106 -7
  19. package/dist/customers/index.mjs.map +1 -1
  20. package/dist/index.d.mts +4 -4
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +238 -28
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +237 -28
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/meter/index.d.mts +2 -2
  27. package/dist/meter/index.d.ts +2 -2
  28. package/dist/meter/index.js +95 -16
  29. package/dist/meter/index.js.map +1 -1
  30. package/dist/meter/index.mjs +95 -16
  31. package/dist/meter/index.mjs.map +1 -1
  32. package/dist/pricing/index.d.mts +1 -1
  33. package/dist/pricing/index.d.ts +1 -1
  34. package/dist/react/index.d.mts +1 -1
  35. package/dist/react/index.d.ts +1 -1
  36. package/dist/{types-Zbzxg-Ka.d.mts → types-Mozk4-Mr.d.mts} +70 -12
  37. package/dist/{types-Zbzxg-Ka.d.ts → types-Mozk4-Mr.d.ts} +70 -12
  38. package/package.json +161 -153
package/README.md CHANGED
@@ -1,203 +1,273 @@
1
- # ⚡ vibezcheck
2
-
3
- > **Give your AI app a financial mind.**
4
- > The declarative 1-line Stripe Billing and Token Metering engine for LLMs. Measure tokens, compute real-time dollar costs, and bill customers with **0ms added latency**.
5
-
6
- [![npm version](https://img.shields.io/npm/v/vibezcheck.svg)](https://npmjs.org/package/vibezcheck)
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8
- [![TypeScript](https://img.shields.io/badge/TypeScript-Strict-blue.svg)](https://www.typescriptlang.org/)
9
- [![Tests](https://img.shields.io/badge/Tests-31%20Passed-brightgreen.svg)]()
10
-
11
- ---
12
-
13
- ## 🍌 The Electric Meter for Artificial Intelligence
14
-
15
- When you turn on the lights in your bedroom, your electric meter spins. When users prompt your AI, **VibezCheck** is the smart meter that counts every word and hidden thought — converting it into pennies with Stripe so your app actually looks out for your margins.
16
-
17
- ### 🛡️ Sane Defaults (Zero Configuration Required)
18
- * **⚡ 0ms Added Latency**: Streams pass directly to your user's browser with zero intermediate proxy buffering.
19
- * **🛡️ Default $0.50 Fuse Box**: Automatically prevents runaway loops without requiring manual ceilings.
20
- * **🛟 In-Flight Abort Trapper**: Captures and bills partial tokens even if a user closes their browser tab mid-stream.
21
- * **🏷️ Automatic 85% Prompt Cache Discounts**: Detects cache hits on Claude 3.7, GPT-4o, and DeepSeek and passes real savings through.
22
- * **🚀 Serverless Lifecycle Protection**: Seamlessly keeps serverless containers alive until telemetry is acknowledged.
23
- * **💰 1-Line Profit Margins**: Turn wholesale provider costs into guaranteed net profit with `pricing: { margin: 1.5 }`.
24
- * **💳 Prepaid & Postpaid**: Choose between monthly metered invoices or zero-debt credit wallets.
25
- * **🧠 Reasoning Token Aware**: Captures hidden thinking tokens in o3-mini and Claude 3.7 Thinking.
26
- * **🆓 Free Vibe Mode**: Works 100% out of the box in local development with no Stripe account required.
27
-
28
- ---
29
-
30
- ## 📦 Installation
31
-
32
- ```bash
33
- npm install vibezcheck ai @ai-sdk/openai stripe
34
- ```
35
-
36
- ---
37
-
38
- ## 1. The 60-Second Quickstart
39
-
40
- ### Backend API Route (`app/api/chat/route.ts`)
41
- ```typescript
42
- import { streamText } from 'ai';
43
- import { vibezcheck } from 'vibezcheck';
44
-
45
- export async function POST(req: Request) {
46
- const { messages, userEmail = 'alex@company.com' } = await req.json();
47
-
48
- return streamText({
49
- // 1 Line. All 6 sane defaults run automatically.
50
- model: vibezcheck('openai/gpt-4o-mini', { customer: userEmail }),
51
- messages,
52
- }).toDataStreamResponse();
53
- }
54
- ```
55
-
56
- ### Frontend Chat UI (`app/page.tsx`)
57
- ```tsx
58
- 'use client';
59
- import { useVibezChat, VibezReceipt, VibezSessionWidget } from 'vibezcheck/react';
60
-
61
- export default function ChatPage() {
62
- const { messages, input, handleInputChange, handleSubmit } = useVibezChat();
63
-
64
- return (
65
- <main className="max-w-xl mx-auto py-10 px-4 space-y-6">
66
- {/* 1. Floating live token & dollar counter */}
67
- <VibezSessionWidget position="bottom-right" />
68
-
69
- {/* 2. Messages with micro-receipts */}
70
- <div className="space-y-4">
71
- {messages.map((m) => (
72
- <div key={m.id} className="p-4 rounded-2xl bg-white border border-slate-200">
73
- <p className="text-slate-900 text-sm">{m.content}</p>
74
-
75
- {/* Micro-Receipt under assistant answers */}
76
- {m.role === 'assistant' && <VibezReceipt message={m} />}
77
- </div>
78
- ))}
79
- </div>
80
-
81
- <form onSubmit={handleSubmit} className="flex gap-2">
82
- <input
83
- value={input}
84
- onChange={handleInputChange}
85
- placeholder="Ask a question..."
86
- className="flex-1 px-4 py-2 rounded-xl border border-slate-200 text-sm"
87
- />
88
- <button type="submit" className="px-5 py-2 rounded-xl bg-slate-950 text-white font-bold text-sm">
89
- Send
90
- </button>
91
- </form>
92
- </main>
93
- );
94
- }
95
- ```
96
-
97
- ---
98
-
99
- ## 🛠️ Real-World Implementation Patterns
100
-
101
- ### Pattern A: 50% Profit Margin Engine
102
- Turn wholesale provider costs into guaranteed net profit:
103
-
104
- ```typescript
105
- model: vibezcheck('openai/gpt-4o-mini', {
106
- customer: 'sarah@acme.com',
107
- pricing: {
108
- margin: 1.5, // 👈 Cost + 50% margin automatically billed to Stripe!
109
- minimumChargeUSD: 0.01, // 👈 Minimum charge 1 cent per question
110
- },
111
- })
112
- ```
113
-
114
- ---
115
-
116
- ### Pattern B: Prepaid Credit Wallets (Zero Debt Risk)
117
- User pre-purchases $10; stream cleanly halts when balance hits $0 without invoice debt:
118
-
119
- ```typescript
120
- model: vibezcheck('openai/gpt-4o-mini', {
121
- customer: 'alex@gmail.com',
122
- billing: {
123
- mode: 'prepaid', // 👈 Deducts from prepaid credit balance in real time
124
- },
125
- // Gracefully downshift when credits run low instead of crashing
126
- fallbackModelOnBudget: 'openai/gpt-4o-mini',
127
- })
128
- ```
129
-
130
- ---
131
-
132
- ### Pattern C: Frontier Reasoning Models (Claude 3.7 & o3-mini)
133
- Automatically extracts hidden thinking tokens and applies 85% prompt cache discounts:
134
-
135
- ```typescript
136
- model: vibezcheck('anthropic/claude-3-7-sonnet', {
137
- customer: 'alex@company.com',
138
- maxCostPerCallUSD: 0.75, // Extended ceiling for multi-minute deep reasoning
139
- })
140
- ```
141
-
142
- ---
143
-
144
- ### Pattern D: Unified Agent Tool Call Metering
145
- Bill external tools (web searches, scrapers, Python sandboxes) and LLM streams into one invoice:
146
-
147
- ```typescript
148
- // app/api/agent/route.ts
149
- import { generateText, tool } from 'ai';
150
- import { vibezcheck } from 'vibezcheck';
151
- import { z } from 'zod';
152
-
153
- export async function POST(req: Request) {
154
- const { prompt, customer = 'alex@company.com' } = await req.json();
155
-
156
- // Create unified customer session
157
- const session = vibezcheck.session({ customer });
158
-
159
- const result = await generateText({
160
- model: session.model('openai/gpt-4o-mini'),
161
- tools: {
162
- searchGoogle: tool({
163
- description: 'Live Google Search',
164
- parameters: z.object({ query: z.string() }),
165
- execute: async ({ query }) => {
166
- // ⚡ Bill non-LLM tool execution ($0.01) into the same customer balance
167
- await session.trackTool('google_search', { costUSD: 0.01 });
168
- return `Search results for: ${query}`;
169
- },
170
- }),
171
- },
172
- prompt,
173
- });
174
-
175
- return Response.json(result);
176
- }
177
- ```
178
-
179
- ---
180
-
181
- ### Pattern E: Brand-New Model (1-Line Inline Rate Card)
182
- Use newly released or fine-tuned models with zero wait for package updates:
183
-
184
- ```typescript
185
- model: vibezcheck('deepseek/deepseek-r2', {
186
- rate: { in: 0.20, out: 0.80 }, // $0.20/M in, $0.80/M out
187
- })
188
- ```
189
-
190
- ---
191
-
192
- ## 🎨 React UI Suite (`vibezcheck/react`)
193
-
194
- * **`useVibezChat`**: 1-hook drop-in chat streaming with live session cost sync.
195
- * **`<VibezReceipt />`**: Micro-badge rendered below assistant responses (*"⚡ gpt-4o-mini • 342 tokens • $0.0005 • Verified by VibezCheck"*).
196
- * **`<VibezSessionWidget />`**: Floating live token & dollar speedometer in the screen corner.
197
- * **`<VibezBillingModal />`**: Drop-in 1-click Stripe Checkout top-up modal.
198
-
199
- ---
200
-
201
- ## 📄 License
202
-
203
- MIT © [VibezCheck](https://vibezcheck.app)
1
+ # ⚡ vibezcheck
2
+
3
+ > **Give your AI app a financial mind.**
4
+ > The declarative 1-line Stripe Billing and Token Metering engine for LLMs. Measure tokens, compute real-time dollar costs, and bill customers with **0ms added latency**.
5
+
6
+ [![npm version](https://img.shields.io/npm/v/vibezcheck.svg)](https://npmjs.org/package/vibezcheck)
7
+ [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fseeyouin2x5x%2Fvibezcheck-sdk%2Ftree%2Fmain%2Fexamples%2Fnextjs-saas-starter&env=OPENAI_API_KEY,STRIPE_SECRET_KEY,NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY&envDescription=API%20Keys%20for%20OpenAI%20and%20Stripe&project-name=vibezcheck-ai-saas)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Strict-blue.svg)](https://www.typescriptlang.org/)
10
+ [![Tests](https://img.shields.io/badge/Tests-50%20Passed-brightgreen.svg)]()
11
+
12
+ ---
13
+
14
+ > 🚀 **Want a ready-to-ship template?** Fork our [1-Click Next.js 15 AI SaaS Starter](https://github.com/seeyouin2x5x/vibezcheck-sdk/tree/main/examples/nextjs-saas-starter) with Stripe Checkout, `<VibezReceipt />`, and `<VibezSessionWidget />` pre-configured.
15
+
16
+ ## 🍌 The Electric Meter for Artificial Intelligence
17
+
18
+ When you turn on the lights in your bedroom, your electric meter spins. When users prompt your AI, **VibezCheck** is the smart meter that counts every word and hidden thought — converting it into pennies with Stripe so your app actually looks out for your margins.
19
+
20
+ ### 🛡️ Sane Defaults (Zero Configuration Required)
21
+ * **⚡ 0ms Added Latency**: Streams pass directly to your user's browser with zero intermediate proxy buffering.
22
+ * **🛡️ Default $0.50 Fuse Box**: Automatically prevents runaway loops without requiring manual ceilings.
23
+ * **🛟 In-Flight Abort Trapper**: Captures and bills partial tokens even if a user closes their browser tab mid-stream.
24
+ * **🏷️ Automatic 85% Prompt Cache Discounts**: Detects cache hits on Claude 3.7, GPT-4o, and DeepSeek and passes real savings through.
25
+ * **🚀 Serverless Lifecycle Protection**: Seamlessly keeps serverless containers alive until telemetry is acknowledged (`after()` / `waitUntil()`).
26
+ * **💰 1-Line Profit Margins**: Turn wholesale provider costs into guaranteed net profit with `pricing: { margin: 1.5 }`.
27
+ * **🏢 B2B Multi-Tenancy & Customer Metadata**: Pass structured customer profiles with `orgId`, `teamId`, `plan`, `tier`, `role`, and custom metadata.
28
+ * **🗄️ Duck-Typed Database Sinks**: Direct auto-syncing to Supabase (`database: supabase`) with zero blast radius.
29
+ * **💳 Pluggable Payment Gateways**: Works out of the box with Stripe, Polar (`provider: 'polar'`), or custom internal wallets.
30
+ * **🧠 Reasoning Token Aware**: Captures hidden thinking tokens in o3-mini and Claude 3.7 Thinking.
31
+ * **🆓 Free Vibe Mode**: Works 100% out of the box in local development with no Stripe account required.
32
+
33
+ ---
34
+
35
+ ## 📦 Installation
36
+
37
+ ```bash
38
+ npm install vibezcheck ai @ai-sdk/openai stripe
39
+ ```
40
+
41
+ ---
42
+
43
+ ## 1. The 60-Second Quickstart
44
+
45
+ ### Backend API Route (`app/api/chat/route.ts`)
46
+ ```typescript
47
+ import { streamText } from 'ai';
48
+ import { vibezcheck } from 'vibezcheck';
49
+ import { supabase } from '@/lib/supabase';
50
+
51
+ export async function POST(req: Request) {
52
+ const { messages, user } = await req.json();
53
+
54
+ return streamText({
55
+ // ⚡ 1 Line. All 10 sane defaults run automatically.
56
+ model: vibezcheck('openai/gpt-4o-mini', {
57
+ customer: {
58
+ id: user.stripeCustomerId,
59
+ userId: user.id,
60
+ email: user.email,
61
+ orgId: user.organizationId,
62
+ plan: 'pro',
63
+ },
64
+ pricing: { margin: 1.4 }, // 40% profit margin
65
+ database: supabase, // Auto-persists token receipts with 0ms latency
66
+ }),
67
+ messages,
68
+ }).toDataStreamResponse();
69
+ }
70
+ ```
71
+
72
+ ### Frontend Chat UI (`app/page.tsx`)
73
+ ```tsx
74
+ 'use client';
75
+ import { useVibezChat, VibezReceipt, VibezSessionWidget } from 'vibezcheck/react';
76
+
77
+ export default function ChatPage() {
78
+ const { messages, input, handleInputChange, handleSubmit } = useVibezChat();
79
+
80
+ return (
81
+ <main className="max-w-xl mx-auto py-10 px-4 space-y-6">
82
+ {/* 1. Floating live token & dollar speedometer */}
83
+ <VibezSessionWidget position="bottom-right" />
84
+
85
+ {/* 2. Messages with micro-receipts */}
86
+ <div className="space-y-4">
87
+ {messages.map((m) => (
88
+ <div key={m.id} className="p-4 rounded-2xl bg-white border border-slate-200">
89
+ <p className="text-slate-900 text-sm">{m.content}</p>
90
+
91
+ {/* Micro-Receipt under assistant answers */}
92
+ {m.role === 'assistant' && <VibezReceipt message={m} />}
93
+ </div>
94
+ ))}
95
+ </div>
96
+
97
+ <form onSubmit={handleSubmit} className="flex gap-2">
98
+ <input
99
+ value={input}
100
+ onChange={handleInputChange}
101
+ placeholder="Ask a question..."
102
+ className="flex-1 px-4 py-2 rounded-xl border border-slate-200 text-sm"
103
+ />
104
+ <button type="submit" className="px-5 py-2 rounded-xl bg-slate-950 text-white font-bold text-sm">
105
+ Send
106
+ </button>
107
+ </form>
108
+ </main>
109
+ );
110
+ }
111
+ ```
112
+
113
+ ---
114
+
115
+ ## 🛠️ Real-World Implementation Patterns
116
+
117
+ ### Pattern A: 50% Profit Margin Engine
118
+ Turn wholesale provider costs into guaranteed net profit:
119
+
120
+ ```typescript
121
+ model: vibezcheck('openai/gpt-4o-mini', {
122
+ customer: 'sarah@acme.com',
123
+ pricing: {
124
+ margin: 1.5, // 👈 Cost + 50% margin automatically billed to Stripe!
125
+ minimumChargeUSD: 0.01, // 👈 Minimum charge 1 cent per question
126
+ },
127
+ })
128
+ ```
129
+
130
+ ---
131
+
132
+ ### Pattern B: B2B Multi-Tenancy & Rich Customer Metadata
133
+ Track usage by company, workspace, role, and subscription tier:
134
+
135
+ ```typescript
136
+ model: vibezcheck('openai/gpt-4o', {
137
+ customer: {
138
+ id: 'cus_stripe_888',
139
+ userId: 'usr_123',
140
+ email: 'alex@acme.corp',
141
+ name: 'Alex Developer',
142
+ orgId: 'org_acme_corp',
143
+ teamId: 'team_ai_agents',
144
+ role: 'admin',
145
+ plan: 'enterprise',
146
+ tier: 'unlimited',
147
+ metadata: {
148
+ cost_center: 90210,
149
+ department: 'R&D',
150
+ },
151
+ },
152
+ })
153
+ ```
154
+
155
+ ---
156
+
157
+ ### Pattern C: Duck-Typed Database Sinks (Supabase / PostgreSQL)
158
+ Save full usage events into your database with **Zero Blast Radius** (DB downtime never crashes the user's stream):
159
+
160
+ ```typescript
161
+ // Pass initialized Supabase client directly:
162
+ model: vibezcheck('gpt-4o', {
163
+ customer: user.id,
164
+ database: supabase, // Inserts to `vibez_usage` table automatically
165
+ })
166
+
167
+ // Or specify custom table:
168
+ model: vibezcheck('gpt-4o', {
169
+ customer: user.id,
170
+ database: { client: supabase, table: 'custom_ai_logs' },
171
+ })
172
+ ```
173
+
174
+ ---
175
+
176
+ ### Pattern D: Pluggable Payment Providers (Stripe, Polar, Custom)
177
+ Switch billing gateways or connect custom internal wallets:
178
+
179
+ ```typescript
180
+ // Polar.sh provider
181
+ model: vibezcheck('gpt-4o', {
182
+ customer: user.id,
183
+ billing: { provider: 'polar' },
184
+ })
185
+
186
+ // Custom in-house wallet / coin ledger
187
+ model: vibezcheck('gpt-4o', {
188
+ customer: user.id,
189
+ billing: {
190
+ charge: async (costUSD, event) => {
191
+ await userWallet.deduct(event.customerId, costUSD);
192
+ },
193
+ },
194
+ })
195
+ ```
196
+
197
+ ---
198
+
199
+ ### Pattern E: Frontier Reasoning Models (Claude 3.7 & o3-mini)
200
+ Automatically extracts hidden thinking tokens and applies 85% prompt cache discounts:
201
+
202
+ ```typescript
203
+ model: vibezcheck('anthropic/claude-3-7-sonnet', {
204
+ customer: 'alex@company.com',
205
+ maxCostPerCallUSD: 0.75, // Extended ceiling for multi-minute deep reasoning
206
+ })
207
+ ```
208
+
209
+ ---
210
+
211
+ ### Pattern F: Unified Agent Tool Call Metering
212
+ Bill external tools (web searches, scrapers, Python sandboxes) and LLM streams into one customer invoice:
213
+
214
+ ```typescript
215
+ // app/api/agent/route.ts
216
+ import { generateText, tool } from 'ai';
217
+ import { vibezcheck } from 'vibezcheck';
218
+ import { z } from 'zod';
219
+
220
+ export async function POST(req: Request) {
221
+ const { prompt, customer = 'alex@company.com' } = await req.json();
222
+
223
+ // Create unified customer session
224
+ const session = vibezcheck.session({ customer });
225
+
226
+ const result = await generateText({
227
+ model: session.model('openai/gpt-4o-mini'),
228
+ tools: {
229
+ searchGoogle: tool({
230
+ description: 'Live Google Search',
231
+ parameters: z.object({ query: z.string() }),
232
+ execute: async ({ query }) => {
233
+ // ⚡ Bill non-LLM tool execution ($0.01) into the same customer balance
234
+ await session.trackTool('google_search', { costUSD: 0.01 });
235
+ return `Search results for: ${query}`;
236
+ },
237
+ }),
238
+ },
239
+ prompt,
240
+ });
241
+
242
+ return Response.json(result);
243
+ }
244
+ ```
245
+
246
+ ---
247
+
248
+ ## 🎨 React UI Suite (`vibezcheck/react`)
249
+
250
+ * **`useVibezChat`**: 1-hook drop-in chat streaming with live session cost sync.
251
+ * **`<VibezReceipt />`**: Micro-badge rendered below assistant responses (*"⚡ gpt-4o-mini • 342 tokens • $0.0005 • Verified by VibezCheck"*).
252
+ * **`<VibezSessionWidget />`**: Floating live token & dollar speedometer in the screen corner.
253
+ * **`<VibezBillingModal />`**: Drop-in 1-click Stripe Checkout top-up modal.
254
+
255
+ ---
256
+
257
+ ## 🌿 Codebase Token Leak Scanner (`npx vibezcheck audit`)
258
+
259
+ Audit your project in under 50ms for unmetered AI endpoints and missing runaway loop fuses:
260
+
261
+ ```bash
262
+ npx vibezcheck audit
263
+ ```
264
+
265
+ * **Kind & Minimalist**: Zero heavy AST dependencies; outputs calm clarity instead of intimidating lint errors.
266
+ * **Safe `--fix`**: Automatically wraps raw provider calls in `vibezcheck()` with `.bak` backups.
267
+ * **GitHub Actions Ready**: Run `npx vibezcheck audit --ci` to fail PRs that accidentally introduce unmetered routes.
268
+
269
+ ---
270
+
271
+ ## 📄 License
272
+
273
+ MIT © [VibezCheck](https://vibezcheck.xyz)
@@ -1,18 +1,20 @@
1
- import { c as CircuitBreakerOptions, C as CustomerParam, B as BillingConfig, P as PricingConfig, d as InlineRateConfig, U as UsageEvent } from '../types-Zbzxg-Ka.mjs';
2
- import { V as VibezMeter } from '../client--iq93FQg.mjs';
1
+ import { c as CircuitBreakerOptions, C as CustomerParam, B as BillingConfig, g as PricingConfig, e as InlineRateConfig, U as UsageEvent } from '../types-Mozk4-Mr.mjs';
2
+ import { V as VibezMeter } from '../client-w_hWhQ6g.mjs';
3
3
  import 'stripe';
4
4
 
5
5
  interface WithBillingOptions extends CircuitBreakerOptions {
6
- /** Customer email, user ID, or Stripe customer ID */
6
+ /** Customer email, user ID, or rich customer object with metadata */
7
7
  customer?: CustomerParam;
8
8
  /** Direct Stripe customer ID */
9
9
  customerId?: string;
10
- /** Billing mode configuration (postpaid vs prepaid) */
10
+ /** Billing mode configuration (Universal Auto-Debit, postpaid vs prepaid, pluggable providers) */
11
11
  billing?: BillingConfig;
12
12
  /** Profit margin & minimum charge configuration */
13
13
  pricing?: PricingConfig;
14
14
  /** 1-line inline pricing rate card */
15
15
  rate?: InlineRateConfig;
16
+ /** Pluggable Database Sink (Supabase, Postgres, Firebase, or 1-line callback) */
17
+ database?: any | ((event: UsageEvent) => void | Promise<void>);
16
18
  /** Whether to capture tokens if the client aborts or closes tab mid-stream (default: true) */
17
19
  captureOnAbort?: boolean;
18
20
  /** Execution runtime environment (default: 'auto') */
@@ -1,18 +1,20 @@
1
- import { c as CircuitBreakerOptions, C as CustomerParam, B as BillingConfig, P as PricingConfig, d as InlineRateConfig, U as UsageEvent } from '../types-Zbzxg-Ka.js';
2
- import { V as VibezMeter } from '../client-kJN_Znan.js';
1
+ import { c as CircuitBreakerOptions, C as CustomerParam, B as BillingConfig, g as PricingConfig, e as InlineRateConfig, U as UsageEvent } from '../types-Mozk4-Mr.js';
2
+ import { V as VibezMeter } from '../client-ynfWcHX6.js';
3
3
  import 'stripe';
4
4
 
5
5
  interface WithBillingOptions extends CircuitBreakerOptions {
6
- /** Customer email, user ID, or Stripe customer ID */
6
+ /** Customer email, user ID, or rich customer object with metadata */
7
7
  customer?: CustomerParam;
8
8
  /** Direct Stripe customer ID */
9
9
  customerId?: string;
10
- /** Billing mode configuration (postpaid vs prepaid) */
10
+ /** Billing mode configuration (Universal Auto-Debit, postpaid vs prepaid, pluggable providers) */
11
11
  billing?: BillingConfig;
12
12
  /** Profit margin & minimum charge configuration */
13
13
  pricing?: PricingConfig;
14
14
  /** 1-line inline pricing rate card */
15
15
  rate?: InlineRateConfig;
16
+ /** Pluggable Database Sink (Supabase, Postgres, Firebase, or 1-line callback) */
17
+ database?: any | ((event: UsageEvent) => void | Promise<void>);
16
18
  /** Whether to capture tokens if the client aborts or closes tab mid-stream (default: true) */
17
19
  captureOnAbort?: boolean;
18
20
  /** Execution runtime environment (default: 'auto') */