vibezcheck 0.5.0 → 0.5.4
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 +43 -24
- package/dist/ai-sdk/index.d.mts +4 -4
- package/dist/ai-sdk/index.d.ts +4 -4
- package/dist/ai-sdk/index.js +357 -43
- package/dist/ai-sdk/index.js.map +1 -1
- package/dist/ai-sdk/index.mjs +357 -43
- 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 +316 -44
- package/dist/ai-sdk/middleware.js.map +1 -1
- package/dist/ai-sdk/middleware.mjs +316 -44
- package/dist/ai-sdk/middleware.mjs.map +1 -1
- package/dist/billing/index.d.mts +3 -3
- package/dist/billing/index.d.ts +3 -3
- package/dist/billing/index.js +312 -42
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +312 -42
- package/dist/billing/index.mjs.map +1 -1
- package/dist/cli/index.js +103 -29
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +103 -29
- package/dist/cli/index.mjs.map +1 -1
- package/dist/{client-CJ2Dj8ID.d.ts → client-BORmJy8s.d.ts} +1 -1
- package/dist/{client-Dmwb3hQt.d.mts → client-CbuXmoXz.d.mts} +1 -1
- package/dist/compat/stripe-meter.d.mts +4 -4
- package/dist/compat/stripe-meter.d.ts +4 -4
- package/dist/compat/stripe-meter.js +336 -47
- package/dist/compat/stripe-meter.js.map +1 -1
- package/dist/compat/stripe-meter.mjs +336 -47
- package/dist/compat/stripe-meter.mjs.map +1 -1
- package/dist/compat/stripe-provider.d.mts +4 -24
- package/dist/compat/stripe-provider.d.ts +4 -24
- package/dist/compat/stripe-provider.js +498 -59
- package/dist/compat/stripe-provider.js.map +1 -1
- package/dist/compat/stripe-provider.mjs +505 -59
- package/dist/compat/stripe-provider.mjs.map +1 -1
- package/dist/compat/token-meter.d.mts +18 -6
- package/dist/compat/token-meter.d.ts +18 -6
- package/dist/compat/token-meter.js +343 -35
- package/dist/compat/token-meter.js.map +1 -1
- package/dist/compat/token-meter.mjs +343 -35
- package/dist/compat/token-meter.mjs.map +1 -1
- package/dist/customers/index.d.mts +1 -1
- package/dist/customers/index.d.ts +1 -1
- package/dist/index.d.mts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.js +672 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +664 -47
- 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 +220 -25
- package/dist/meter/index.js.map +1 -1
- package/dist/meter/index.mjs +220 -25
- package/dist/meter/index.mjs.map +1 -1
- package/dist/pricing/index.d.mts +11 -3
- package/dist/pricing/index.d.ts +11 -3
- package/dist/pricing/index.js +153 -8
- package/dist/pricing/index.js.map +1 -1
- package/dist/pricing/index.mjs +152 -8
- package/dist/pricing/index.mjs.map +1 -1
- package/dist/react/index.d.mts +6 -4
- package/dist/react/index.d.ts +6 -4
- package/dist/react/index.js +420 -200
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +420 -200
- package/dist/react/index.mjs.map +1 -1
- package/dist/{types-BVGqbKnY.d.mts → types-6P71CXAD.d.mts} +10 -6
- package/dist/{types-BVGqbKnY.d.ts → types-6P71CXAD.d.ts} +10 -6
- package/dist/{with-billing-CDqKIAQ6.d.ts → with-billing-Bj6Ya_Iy.d.ts} +5 -3
- package/dist/{with-billing-mci2vtFS.d.mts → with-billing-DndWGxL8.d.mts} +5 -3
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ const model = vibezcheck('openai/gpt-4o', { customer: 'cus_alex' });
|
|
|
39
39
|
## 📦 Installation
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
npm install vibezcheck ai @ai-sdk/openai stripe
|
|
42
|
+
npm install vibezcheck ai @ai-sdk/openai @ai-sdk/react stripe
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
---
|
|
@@ -74,38 +74,47 @@ export async function POST(req: Request) {
|
|
|
74
74
|
|
|
75
75
|
```tsx
|
|
76
76
|
'use client';
|
|
77
|
-
|
|
77
|
+
|
|
78
|
+
import { useChat } from '@ai-sdk/react';
|
|
79
|
+
import { useState } from 'react';
|
|
78
80
|
import { VibezCheck } from 'vibezcheck/ui';
|
|
79
81
|
|
|
80
|
-
export default function
|
|
81
|
-
const
|
|
82
|
+
export default function Chat() {
|
|
83
|
+
const [input, setInput] = useState('');
|
|
84
|
+
const { messages, sendMessage } = useChat();
|
|
82
85
|
|
|
83
86
|
return (
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
<div className="flex flex-col w-full max-w-md py-24 mx-auto stretch">
|
|
88
|
+
{messages.map(message => (
|
|
89
|
+
<div key={message.id} className="whitespace-pre-wrap">
|
|
90
|
+
{message.role === 'user' ? 'User: ' : 'AI: '}
|
|
91
|
+
{message.parts.map((part, i) => {
|
|
92
|
+
switch (part.type) {
|
|
93
|
+
case 'text':
|
|
94
|
+
return <div key={`${message.id}-${i}`}>{part.text}</div>;
|
|
95
|
+
}
|
|
96
|
+
})}
|
|
97
|
+
</div>
|
|
98
|
+
))}
|
|
99
|
+
|
|
100
|
+
<form
|
|
101
|
+
onSubmit={e => {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
sendMessage({ text: input });
|
|
104
|
+
setInput('');
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
95
107
|
<input
|
|
108
|
+
className="fixed dark:bg-zinc-900 bottom-0 w-full max-w-md p-2 mb-8 border border-zinc-300 dark:border-zinc-800 rounded shadow-xl"
|
|
96
109
|
value={input}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
className="flex-1 p-2 border rounded-lg"
|
|
110
|
+
placeholder="Say something..."
|
|
111
|
+
onChange={e => setInput(e.currentTarget.value)}
|
|
100
112
|
/>
|
|
101
|
-
<button type="submit" className="px-4 py-2 bg-blue-600 text-white rounded-lg">
|
|
102
|
-
Send
|
|
103
|
-
</button>
|
|
104
113
|
</form>
|
|
105
114
|
|
|
106
|
-
{/* ✦ 1-Line HUD: Works with zero database & zero Stripe in Dev Mode */}
|
|
107
|
-
<VibezCheck messages={messages}
|
|
108
|
-
</
|
|
115
|
+
{/* ✦ 1-Line Token Meter & Financial HUD: Works with zero database & zero Stripe in Dev Mode */}
|
|
116
|
+
<VibezCheck messages={messages} />
|
|
117
|
+
</div>
|
|
109
118
|
);
|
|
110
119
|
}
|
|
111
120
|
```
|
|
@@ -225,6 +234,16 @@ npx vibezcheck audit --ci
|
|
|
225
234
|
|
|
226
235
|
---
|
|
227
236
|
|
|
237
|
+
## 📂 Examples
|
|
238
|
+
|
|
239
|
+
* **[Next.js App Router + OpenAI](examples/nextjs-app-router-openai)**: Direct implementation of the official [AI SDK Next.js App Router Tutorial](https://ai-sdk.dev/docs/getting-started/nextjs-app-router) with 1-line VibezCheck token metering.
|
|
240
|
+
* **[Next.js 15 AI SaaS Starter](examples/nextjs-saas-starter)**: Complete SaaS template with Stripe Checkout, Top-Up Modal, and `<VibezReceipt />`.
|
|
241
|
+
* **[Local Cost Meter](examples/01-local-cost-meter.ts)**: Offline micro-transaction calculations with BigInt Nano-USD precision.
|
|
242
|
+
* **[Native OpenAI Streaming](examples/03-native-openai-stream.ts)**: Zero-latency stream wrapper for the official `openai` Node SDK.
|
|
243
|
+
* **[Claude 3.7 Reasoning Tokens](examples/04-claude-thinking.ts)**: Tracking hidden thought tokens with Anthropic SDK.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
228
247
|
## 📄 License
|
|
229
248
|
|
|
230
249
|
MIT © [VibezCheck](https://vibezcheck.xyz)
|
package/dist/ai-sdk/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as WithBillingOptions } from '../with-billing-
|
|
2
|
-
export { m as meteredModel, w as withBilling } from '../with-billing-
|
|
3
|
-
import { C as CustomerParam } from '../types-
|
|
4
|
-
import { V as VibezMeter } from '../client-
|
|
1
|
+
import { W as WithBillingOptions } from '../with-billing-DndWGxL8.mjs';
|
|
2
|
+
export { m as meteredModel, w as withBilling } from '../with-billing-DndWGxL8.mjs';
|
|
3
|
+
import { C as CustomerParam } from '../types-6P71CXAD.mjs';
|
|
4
|
+
import { V as VibezMeter } from '../client-CbuXmoXz.mjs';
|
|
5
5
|
import 'stripe';
|
|
6
6
|
|
|
7
7
|
interface VibezCheckModelOptions extends WithBillingOptions {
|
package/dist/ai-sdk/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as WithBillingOptions } from '../with-billing-
|
|
2
|
-
export { m as meteredModel, w as withBilling } from '../with-billing-
|
|
3
|
-
import { C as CustomerParam } from '../types-
|
|
4
|
-
import { V as VibezMeter } from '../client-
|
|
1
|
+
import { W as WithBillingOptions } from '../with-billing-Bj6Ya_Iy.js';
|
|
2
|
+
export { m as meteredModel, w as withBilling } from '../with-billing-Bj6Ya_Iy.js';
|
|
3
|
+
import { C as CustomerParam } from '../types-6P71CXAD.js';
|
|
4
|
+
import { V as VibezMeter } from '../client-BORmJy8s.js';
|
|
5
5
|
import 'stripe';
|
|
6
6
|
|
|
7
7
|
interface VibezCheckModelOptions extends WithBillingOptions {
|