vibezcheck 0.5.6 β 0.5.7
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/README.md +180 -50
- package/bin/examples.js +0 -0
- package/bin/vibezcheck.js +0 -0
- package/dist/react/index.d.mts +24 -8
- package/dist/react/index.d.ts +24 -8
- package/dist/react/index.js +707 -234
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +707 -234
- package/dist/react/index.mjs.map +1 -1
- package/examples/nextjs-app-router-openai/README.md +8 -6
- package/examples/nextjs-app-router-openai/app/api/chat/route.ts +14 -6
- package/examples/nextjs-app-router-openai/app/page.tsx +68 -22
- package/examples/nextjs-app-router-openai/package.json +1 -1
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -1,37 +1,49 @@
|
|
|
1
1
|
# β¦ VibezCheck
|
|
2
2
|
|
|
3
3
|
> **The 1-Line Token Meter & Real-Time Billing Engine for AI.**
|
|
4
|
-
> Track tokens, compute real-time
|
|
4
|
+
> Track tokens, compute real-time micro-costs, set profit margins, and bill customers with **0ms added latency** across Vercel AI SDK (v4, v5, v6, v7) and native LLM SDKs.
|
|
5
5
|
|
|
6
|
-
[](https://npmjs.org/package/vibezcheck)
|
|
6
|
+
[](https://npmjs.org/package/vibezcheck)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
[](https://www.typescriptlang.org/)
|
|
9
|
-
[]()
|
|
10
|
+
[]()
|
|
10
11
|
|
|
11
12
|
---
|
|
12
13
|
|
|
13
14
|
### The 2-Line Promise
|
|
14
15
|
|
|
15
16
|
```typescript
|
|
16
|
-
// 1. Server: Wrap your model with
|
|
17
|
-
const model = vibezcheck('openai/gpt-4o', { customer: 'cus_alex' });
|
|
17
|
+
// 1. Server: Wrap your model with billing & inject telemetry into stream
|
|
18
|
+
const model = vibezcheck('openai/gpt-4o-mini', { customer: 'cus_alex', pricing: { margin: 1.3 } });
|
|
19
|
+
return vibezcheck.toResponse(result);
|
|
18
20
|
|
|
19
|
-
// 2. Client: Drop in
|
|
21
|
+
// 2. Client: Drop in zero-prop financial HUD & micro-receipts
|
|
22
|
+
<VibezReceipt message={message} />
|
|
20
23
|
<VibezCheck messages={messages} />
|
|
21
24
|
```
|
|
22
25
|
|
|
23
26
|
---
|
|
24
27
|
|
|
25
|
-
##
|
|
28
|
+
## β‘ What's New in v0.5.6
|
|
26
29
|
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
|
|
30
|
+
* **πͺ Zero-Prop Client UIs**: `<VibezReceipt message={message} />` and `<VibezCheck messages={messages} />` auto-derive model slugs, exact tokens, dollar micro-costs, profit margins (`+30% Margin`), and latency straight from the telemetry stream. No manual `model`, `margin`, or `cost` props required.
|
|
31
|
+
* **π‘ Universal Stream Injector (`vibezcheck.toResponse`)**: Intercepts AI SDK stream completion chunks to attach verified telemetry (`data-vibezcheck` & `message-metadata` SSE for v5/v6/v7, or `2:[{...}]` annotations for v4) with **0ms TTFB overhead**.
|
|
32
|
+
* **π‘οΈ Zero Context Window Pollution**: Telemetry travels out-of-band. When AI SDK's `convertToModelMessages(messages)` prepares future conversation turns, metadata parts are automatically omittedβkeeping your LLM context pure and preventing runaway token loops.
|
|
33
|
+
* **π¨ Scoped Zero-Config Styling**: Built-in inline fallback styles guarantee that receipts and HUD components look polished out-of-the-box, even if your Tailwind configuration ignores `node_modules`.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## π Key Features
|
|
38
|
+
|
|
39
|
+
* **β‘ 0ms Added Latency**: Direct transparent proxy stream; no external server redirects, no pre-buffering, and zero impact on first-token response time.
|
|
40
|
+
* **π‘οΈ Built-in $0.50 Circuit Breaker**: Auto-trips if an agent or query exceeds the safety fuse box, preventing infinite loops and surprise $1,000 bills.
|
|
41
|
+
* **π In-Flight Abort Trapper**: Accurately meters and debits tokens even if the client closes their laptop lid or navigates away mid-stream.
|
|
42
|
+
* **πͺ BigInt Nano-USD Precision**: Sub-cent financial math ($1 = $10^9$ Nano-USD) eliminating IEEE 754 floating-point drift.
|
|
43
|
+
* **π° 1-Line Profit Margins**: Turn wholesale API costs into retail revenue with `pricing: { margin: 1.3 }` (+30% markup).
|
|
32
44
|
* **π Zero-DB Dev Mode**: Run locally on `localhost:3000` with NO database and NO Stripe keys required.
|
|
33
|
-
* **π³ Pluggable SaaS Billing**:
|
|
34
|
-
* **π€ Multi-Tool Agent Sessions**: Cumulative session budgets across
|
|
45
|
+
* **π³ Pluggable SaaS Billing**: Credit wallets, top-ups, checkout sessions, customer portal, and user API keys (`vz_live_...`).
|
|
46
|
+
* **π€ Multi-Tool Agent Sessions**: Cumulative session budgets across multiple LLM steps, Python sandboxes, and web scrapers.
|
|
35
47
|
* **π 100% Drop-In Polyfills**: Direct replacement for `@stripe/ai-sdk/meter`, `@stripe/ai-sdk/provider`, and `@stripe/token-meter`.
|
|
36
48
|
|
|
37
49
|
---
|
|
@@ -44,93 +56,211 @@ npm install vibezcheck ai @ai-sdk/openai @ai-sdk/react stripe
|
|
|
44
56
|
|
|
45
57
|
---
|
|
46
58
|
|
|
47
|
-
## β‘ Quickstart:
|
|
59
|
+
## β‘ 1-Minute Quickstart: Next.js App Router
|
|
60
|
+
|
|
61
|
+
### 1. Server Route (`app/api/chat/route.ts`)
|
|
48
62
|
|
|
49
|
-
|
|
63
|
+
Wrap any model with `vibezcheck()`, and return the response using `vibezcheck.toResponse()`:
|
|
50
64
|
|
|
51
65
|
```typescript
|
|
52
66
|
import { streamText } from 'ai';
|
|
53
67
|
import { openai } from '@ai-sdk/openai';
|
|
54
68
|
import { vibezcheck } from 'vibezcheck';
|
|
55
69
|
|
|
70
|
+
export const maxDuration = 30;
|
|
71
|
+
|
|
56
72
|
export async function POST(req: Request) {
|
|
57
73
|
const { messages } = await req.json();
|
|
58
74
|
|
|
59
75
|
const result = streamText({
|
|
60
|
-
// Wrap any
|
|
76
|
+
// Wrap any provider (OpenAI, Anthropic, Google, DeepSeek, etc.)
|
|
61
77
|
model: vibezcheck(openai('gpt-4o-mini'), {
|
|
62
|
-
customer: '
|
|
63
|
-
pricing: { margin: 1.3 },
|
|
64
|
-
maxCostPerCallUSD: 0.50,
|
|
78
|
+
customer: 'cus_alex', // Stripe customer ID or user email
|
|
79
|
+
pricing: { margin: 1.3 }, // +30% profit margin
|
|
80
|
+
maxCostPerCallUSD: 0.50, // Safety fuse box ($0.50 cap)
|
|
65
81
|
}),
|
|
66
82
|
messages,
|
|
67
83
|
});
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
// β¦ Universal telemetry stream injector (works with v4, v5, v6, and v7)
|
|
86
|
+
return vibezcheck.toResponse(result);
|
|
70
87
|
}
|
|
71
88
|
```
|
|
72
89
|
|
|
73
|
-
### 2. Frontend
|
|
90
|
+
### 2. Frontend Client (`app/page.tsx`)
|
|
91
|
+
|
|
92
|
+
Render message bubbles with `<VibezReceipt />` and float the aggregated `<VibezCheck />` HUD:
|
|
74
93
|
|
|
75
94
|
```tsx
|
|
76
95
|
'use client';
|
|
77
96
|
|
|
78
97
|
import { useChat } from '@ai-sdk/react';
|
|
79
98
|
import { useState } from 'react';
|
|
80
|
-
import { VibezCheck } from 'vibezcheck/ui';
|
|
99
|
+
import { VibezReceipt, VibezCheck } from 'vibezcheck/ui';
|
|
81
100
|
|
|
82
|
-
export default function
|
|
101
|
+
export default function ChatPage() {
|
|
83
102
|
const [input, setInput] = useState('');
|
|
84
103
|
const { messages, sendMessage } = useChat();
|
|
85
104
|
|
|
86
105
|
return (
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{message.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
106
|
+
<main className="flex flex-col w-full max-w-lg py-20 mx-auto px-4 min-h-screen">
|
|
107
|
+
<div className="flex-1 space-y-4 mb-24">
|
|
108
|
+
{messages.map((message) => (
|
|
109
|
+
<div key={message.id} className="p-3 rounded-xl border border-zinc-200 dark:border-zinc-800">
|
|
110
|
+
<div className="text-xs font-semibold uppercase tracking-wider text-zinc-400 mb-1">
|
|
111
|
+
{message.role === 'user' ? 'You' : 'Assistant'}
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
{/* Display message content */}
|
|
115
|
+
<div className="text-sm whitespace-pre-wrap">
|
|
116
|
+
{message.parts
|
|
117
|
+
? message.parts.map((part, i) => (part.type === 'text' ? part.text : null))
|
|
118
|
+
: message.content}
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
{/* β¦ Zero-Prop Micro-Receipt: auto-derives tokens, micro-cost, model, & latency */}
|
|
122
|
+
{message.role === 'assistant' && (
|
|
123
|
+
<div className="mt-2 flex justify-end">
|
|
124
|
+
<VibezReceipt message={message} />
|
|
125
|
+
</div>
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
))}
|
|
129
|
+
</div>
|
|
99
130
|
|
|
100
131
|
<form
|
|
101
|
-
onSubmit={e => {
|
|
132
|
+
onSubmit={(e) => {
|
|
102
133
|
e.preventDefault();
|
|
134
|
+
if (!input.trim()) return;
|
|
103
135
|
sendMessage({ text: input });
|
|
104
136
|
setInput('');
|
|
105
137
|
}}
|
|
138
|
+
className="fixed bottom-0 left-0 right-0 p-4 bg-background/80 backdrop-blur-md"
|
|
106
139
|
>
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
140
|
+
<div className="max-w-lg mx-auto">
|
|
141
|
+
<input
|
|
142
|
+
className="w-full p-3 rounded-lg border border-zinc-300 dark:border-zinc-700 bg-white dark:bg-zinc-900 shadow-sm"
|
|
143
|
+
value={input}
|
|
144
|
+
placeholder="Ask something..."
|
|
145
|
+
onChange={(e) => setInput(e.target.value)}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
113
148
|
</form>
|
|
114
149
|
|
|
115
|
-
{/* β¦
|
|
150
|
+
{/* β¦ Zero-Prop Financial HUD: aggregated conversation tokens, cost, & active model */}
|
|
116
151
|
<VibezCheck messages={messages} />
|
|
117
|
-
</
|
|
152
|
+
</main>
|
|
118
153
|
);
|
|
119
154
|
}
|
|
120
155
|
```
|
|
121
156
|
|
|
122
157
|
---
|
|
123
158
|
|
|
124
|
-
##
|
|
159
|
+
## π§© Zero-Prop Client Components
|
|
160
|
+
|
|
161
|
+
Import from either `vibezcheck/ui` or `vibezcheck/react`:
|
|
162
|
+
|
|
163
|
+
### 1. `<VibezReceipt />` (Per-Message Micro-Badge)
|
|
164
|
+
|
|
165
|
+
Displays verified tokens, cost in USD, model slug, and latency under individual assistant messages.
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
<VibezReceipt message={message} />
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
* **Zero Required Props**: Reads telemetry from `message.parts` (`data-vibezcheck`), `message.annotations`, and `message.metadata`.
|
|
172
|
+
* **Variants**: `variant="pill"` (default), `variant="minimal"`, or `variant="card"`.
|
|
173
|
+
* **Scoped Styling**: Ships with inline fallback styling so it never breaks even without Tailwind CSS.
|
|
174
|
+
|
|
175
|
+
### 2. `<VibezCheck />` (Global Conversation HUD)
|
|
176
|
+
|
|
177
|
+
Floating pill and expandable popover showing real-time conversation metrics.
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
<VibezCheck messages={messages} />
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
* **Aggregated Metrics**: Automatically sums input, output, and reasoning tokens across all messages.
|
|
184
|
+
* **Auto-Derived Model & Margin**: Displays the active model badge (e.g. `gpt-4o-mini`) and configured markup (e.g. `+30% Margin`).
|
|
185
|
+
* **Optional Top-Up**: Pass `onTopUp={() => openBillingModal()}` to display an integrated credit top-up button.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## π Multi-Version Vercel AI SDK Compatibility
|
|
190
|
+
|
|
191
|
+
`vibezcheck` provides seamless compatibility across every major generation of the Vercel AI SDK:
|
|
192
|
+
|
|
193
|
+
### AI SDK v5, v6 & v7 (UI Message Stream)
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { createUIMessageStreamResponse, toUIMessageStream, streamText } from 'ai';
|
|
197
|
+
import { openai } from '@ai-sdk/openai';
|
|
198
|
+
import { vibezcheck } from 'vibezcheck';
|
|
199
|
+
|
|
200
|
+
export async function POST(req: Request) {
|
|
201
|
+
const { messages } = await req.json();
|
|
202
|
+
|
|
203
|
+
const result = streamText({
|
|
204
|
+
model: vibezcheck(openai('gpt-4o-mini'), { customer: 'cus_123' }),
|
|
205
|
+
messages,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// Recommended: pass result directly
|
|
209
|
+
return vibezcheck.toResponse(result);
|
|
210
|
+
|
|
211
|
+
// Or wrap custom UI message stream responses:
|
|
212
|
+
// return vibezcheck.toResponse(
|
|
213
|
+
// createUIMessageStreamResponse({
|
|
214
|
+
// stream: toUIMessageStream({ stream: result.stream }),
|
|
215
|
+
// })
|
|
216
|
+
// );
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### AI SDK v4 (Data Stream Protocol)
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import { streamText } from 'ai';
|
|
224
|
+
import { openai } from '@ai-sdk/openai';
|
|
225
|
+
import { vibezcheck } from 'vibezcheck';
|
|
226
|
+
|
|
227
|
+
export async function POST(req: Request) {
|
|
228
|
+
const { messages } = await req.json();
|
|
229
|
+
|
|
230
|
+
const result = streamText({
|
|
231
|
+
model: vibezcheck(openai('gpt-4o'), { customer: 'cus_123' }),
|
|
232
|
+
messages,
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// Automatically emits 2:[{"type":"vibezcheck", ...}] data stream annotations
|
|
236
|
+
return vibezcheck.toResponse(result);
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## π‘οΈ Context Window Hygiene: How It Works
|
|
243
|
+
|
|
244
|
+
A frequent hazard in LLM streaming is "telemetry leakage"βwhere usage data sent to the client gets accidentally included in subsequent conversation turns, causing runaway context growth and unnecessary token costs.
|
|
245
|
+
|
|
246
|
+
VibezCheck prevents this by design:
|
|
247
|
+
1. **Server Injection**: `vibezcheck.toResponse` injects telemetry out-of-band right before stream completion (`data-vibezcheck` and `message-metadata` SSE events).
|
|
248
|
+
2. **Client Ingestion**: `<VibezReceipt />` and `<VibezCheck />` extract telemetry from message parts without mutating textual content.
|
|
249
|
+
3. **Next Request**: When `convertToModelMessages(messages)` runs on subsequent requests, the AI SDK automatically discards transient metadata and data parts. **Zero telemetry tokens are sent to the LLM.**
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## π³ Commercial SaaS Billing
|
|
254
|
+
|
|
255
|
+
### 1. Stripe Top-Up Sessions (`BillingHelper`)
|
|
125
256
|
|
|
126
|
-
|
|
257
|
+
Allow users to purchase pre-paid AI credits with Stripe Checkout:
|
|
127
258
|
|
|
128
259
|
```typescript
|
|
129
260
|
import { BillingHelper } from 'vibezcheck';
|
|
130
261
|
|
|
131
262
|
const billing = new BillingHelper({ apiKey: process.env.STRIPE_SECRET_KEY });
|
|
132
263
|
|
|
133
|
-
// Customer purchases $20 in AI usage credits
|
|
134
264
|
export async function POST(req: Request) {
|
|
135
265
|
const { customerId } = await req.json();
|
|
136
266
|
|
|
@@ -158,7 +288,7 @@ const auth = new ApiKeyAuth(stripe);
|
|
|
158
288
|
// 1. Generate key for customer
|
|
159
289
|
const { apiKey } = await auth.createKey({
|
|
160
290
|
customerId: 'cus_123',
|
|
161
|
-
name: 'Production
|
|
291
|
+
name: 'Production Key',
|
|
162
292
|
});
|
|
163
293
|
// => "vz_live_9f83b2..."
|
|
164
294
|
|
|
@@ -236,7 +366,7 @@ npx vibezcheck audit --ci
|
|
|
236
366
|
|
|
237
367
|
## π Examples
|
|
238
368
|
|
|
239
|
-
* **[Next.js App Router + OpenAI](examples/nextjs-app-router-openai)**:
|
|
369
|
+
* **[Next.js App Router + OpenAI](examples/nextjs-app-router-openai)**: Modern AI SDK App Router implementation with 1-line token metering and `<VibezCheck />`.
|
|
240
370
|
* **[Next.js 15 AI SaaS Starter](examples/nextjs-saas-starter)**: Complete SaaS template with Stripe Checkout, Top-Up Modal, and `<VibezReceipt />`.
|
|
241
371
|
* **[Local Cost Meter](examples/01-local-cost-meter.ts)**: Offline micro-transaction calculations with BigInt Nano-USD precision.
|
|
242
372
|
* **[Native OpenAI Streaming](examples/03-native-openai-stream.ts)**: Zero-latency stream wrapper for the official `openai` Node SDK.
|
package/bin/examples.js
CHANGED
|
File without changes
|
package/bin/vibezcheck.js
CHANGED
|
File without changes
|
package/dist/react/index.d.mts
CHANGED
|
@@ -245,22 +245,34 @@ interface VibezCheckProps {
|
|
|
245
245
|
model?: string;
|
|
246
246
|
/** Developer profit margin multiplier (default: 1.25 for +25% margin) */
|
|
247
247
|
margin?: number;
|
|
248
|
+
/**
|
|
249
|
+
* Whether to display developer wholesale API costs.
|
|
250
|
+
* Default: false (hidden from end-users)
|
|
251
|
+
*/
|
|
252
|
+
showWholesale?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Whether to display developer profit margin percentage and net profit.
|
|
255
|
+
* Default: false (hidden from end-users)
|
|
256
|
+
*/
|
|
257
|
+
showMargin?: boolean;
|
|
248
258
|
/** Manual total cost override in USD */
|
|
249
259
|
totalCostUSD?: number;
|
|
250
260
|
/** Manual total tokens override */
|
|
251
261
|
totalTokens?: number;
|
|
252
262
|
/** Remaining customer credit balance in USD */
|
|
253
263
|
remainingBalanceUSD?: number;
|
|
254
|
-
/** Screen position (default: 'bottom-
|
|
255
|
-
position?: 'bottom-center' | 'bottom-right' | 'bottom-left' | 'top-center';
|
|
264
|
+
/** Screen position (default: 'bottom-left') */
|
|
265
|
+
position?: 'bottom-center' | 'bottom-right' | 'bottom-left' | 'top-center' | 'top-right' | 'top-left';
|
|
256
266
|
/** Color theme (default: 'auto') */
|
|
257
267
|
theme?: 'dark' | 'light' | 'auto';
|
|
258
268
|
/** Force dev mode banner on/off (defaults to auto-detect) */
|
|
259
269
|
devMode?: boolean;
|
|
260
270
|
/** Additional CSS class names */
|
|
261
271
|
className?: string;
|
|
262
|
-
/**
|
|
263
|
-
|
|
272
|
+
/** Custom header title (default: 'Session Usage') */
|
|
273
|
+
title?: string;
|
|
274
|
+
/** Callback triggered when user clicks 'Top Up' button or preset amount pills */
|
|
275
|
+
onTopUp?: (amount?: number) => void;
|
|
264
276
|
/** Callback fired whenever cost or token counts update */
|
|
265
277
|
onCostUpdate?: (summary: {
|
|
266
278
|
totalCostUSD: number;
|
|
@@ -275,11 +287,15 @@ interface VibezCheckProps {
|
|
|
275
287
|
/**
|
|
276
288
|
* β¦ <VibezCheck /> (from 'vibezcheck/ui' or 'vibezcheck/react')
|
|
277
289
|
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
290
|
+
* An ultra-modern, interactive fintech AI financial HUD inspired by Aztec Web3 design.
|
|
291
|
+
* Features:
|
|
292
|
+
* - Huge hero typography with interactive USD β Token unit toggle (β
)
|
|
293
|
+
* - Segmented Session β Latest Turn pill switcher
|
|
294
|
+
* - Interactive preset pills ([$5] [$10] [$25] [Max])
|
|
295
|
+
* - Hidden wholesale pricing and margin by default (controlled via showWholesale & showMargin props)
|
|
296
|
+
* - Soft creamy ivory card with rounded-3xl corners and vibrant orchid action buttons
|
|
281
297
|
*/
|
|
282
|
-
declare function VibezCheck({ messages, events, model, margin, totalCostUSD: manualCost, totalTokens: manualTokens, remainingBalanceUSD, position, theme, devMode, className, onTopUp, onCostUpdate, defaultOpen, }: VibezCheckProps): React__default.JSX.Element;
|
|
298
|
+
declare function VibezCheck({ messages, events, model, margin, showWholesale, showMargin, totalCostUSD: manualCost, totalTokens: manualTokens, remainingBalanceUSD, position, theme, devMode, className, title, onTopUp, onCostUpdate, defaultOpen, }: VibezCheckProps): React__default.JSX.Element;
|
|
283
299
|
declare const VibezPill: typeof VibezCheck;
|
|
284
300
|
|
|
285
301
|
export { type CustomStorageAdapter, type SessionPersistenceMode, type SessionState, type SessionTurnRecord, type UseVibezChatOptions, VibezBillingModal, type VibezBillingModalProps, type VibezBillingNotice, type VibezChatMessage, VibezCheck, type VibezCheckProps, VibezPill, VibezReceipt, type VibezReceiptProps, VibezSessionBadge, type VibezSessionBadgeProps, VibezSessionContext, type VibezSessionContextValue, VibezSessionProvider, type VibezSessionProviderProps, VibezSessionWidget, type VibezSessionWidgetProps, useVibez, useVibezChat, useVibezSession };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -245,22 +245,34 @@ interface VibezCheckProps {
|
|
|
245
245
|
model?: string;
|
|
246
246
|
/** Developer profit margin multiplier (default: 1.25 for +25% margin) */
|
|
247
247
|
margin?: number;
|
|
248
|
+
/**
|
|
249
|
+
* Whether to display developer wholesale API costs.
|
|
250
|
+
* Default: false (hidden from end-users)
|
|
251
|
+
*/
|
|
252
|
+
showWholesale?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Whether to display developer profit margin percentage and net profit.
|
|
255
|
+
* Default: false (hidden from end-users)
|
|
256
|
+
*/
|
|
257
|
+
showMargin?: boolean;
|
|
248
258
|
/** Manual total cost override in USD */
|
|
249
259
|
totalCostUSD?: number;
|
|
250
260
|
/** Manual total tokens override */
|
|
251
261
|
totalTokens?: number;
|
|
252
262
|
/** Remaining customer credit balance in USD */
|
|
253
263
|
remainingBalanceUSD?: number;
|
|
254
|
-
/** Screen position (default: 'bottom-
|
|
255
|
-
position?: 'bottom-center' | 'bottom-right' | 'bottom-left' | 'top-center';
|
|
264
|
+
/** Screen position (default: 'bottom-left') */
|
|
265
|
+
position?: 'bottom-center' | 'bottom-right' | 'bottom-left' | 'top-center' | 'top-right' | 'top-left';
|
|
256
266
|
/** Color theme (default: 'auto') */
|
|
257
267
|
theme?: 'dark' | 'light' | 'auto';
|
|
258
268
|
/** Force dev mode banner on/off (defaults to auto-detect) */
|
|
259
269
|
devMode?: boolean;
|
|
260
270
|
/** Additional CSS class names */
|
|
261
271
|
className?: string;
|
|
262
|
-
/**
|
|
263
|
-
|
|
272
|
+
/** Custom header title (default: 'Session Usage') */
|
|
273
|
+
title?: string;
|
|
274
|
+
/** Callback triggered when user clicks 'Top Up' button or preset amount pills */
|
|
275
|
+
onTopUp?: (amount?: number) => void;
|
|
264
276
|
/** Callback fired whenever cost or token counts update */
|
|
265
277
|
onCostUpdate?: (summary: {
|
|
266
278
|
totalCostUSD: number;
|
|
@@ -275,11 +287,15 @@ interface VibezCheckProps {
|
|
|
275
287
|
/**
|
|
276
288
|
* β¦ <VibezCheck /> (from 'vibezcheck/ui' or 'vibezcheck/react')
|
|
277
289
|
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
290
|
+
* An ultra-modern, interactive fintech AI financial HUD inspired by Aztec Web3 design.
|
|
291
|
+
* Features:
|
|
292
|
+
* - Huge hero typography with interactive USD β Token unit toggle (β
)
|
|
293
|
+
* - Segmented Session β Latest Turn pill switcher
|
|
294
|
+
* - Interactive preset pills ([$5] [$10] [$25] [Max])
|
|
295
|
+
* - Hidden wholesale pricing and margin by default (controlled via showWholesale & showMargin props)
|
|
296
|
+
* - Soft creamy ivory card with rounded-3xl corners and vibrant orchid action buttons
|
|
281
297
|
*/
|
|
282
|
-
declare function VibezCheck({ messages, events, model, margin, totalCostUSD: manualCost, totalTokens: manualTokens, remainingBalanceUSD, position, theme, devMode, className, onTopUp, onCostUpdate, defaultOpen, }: VibezCheckProps): React__default.JSX.Element;
|
|
298
|
+
declare function VibezCheck({ messages, events, model, margin, showWholesale, showMargin, totalCostUSD: manualCost, totalTokens: manualTokens, remainingBalanceUSD, position, theme, devMode, className, title, onTopUp, onCostUpdate, defaultOpen, }: VibezCheckProps): React__default.JSX.Element;
|
|
283
299
|
declare const VibezPill: typeof VibezCheck;
|
|
284
300
|
|
|
285
301
|
export { type CustomStorageAdapter, type SessionPersistenceMode, type SessionState, type SessionTurnRecord, type UseVibezChatOptions, VibezBillingModal, type VibezBillingModalProps, type VibezBillingNotice, type VibezChatMessage, VibezCheck, type VibezCheckProps, VibezPill, VibezReceipt, type VibezReceiptProps, VibezSessionBadge, type VibezSessionBadgeProps, VibezSessionContext, type VibezSessionContextValue, VibezSessionProvider, type VibezSessionProviderProps, VibezSessionWidget, type VibezSessionWidgetProps, useVibez, useVibezChat, useVibezSession };
|