vibezcheck 0.2.0 → 0.3.0

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.
@@ -0,0 +1,232 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // src/cli/index.ts
27
+ var import_fs = __toESM(require("fs"));
28
+ var import_path = __toESM(require("path"));
29
+ var import_readline = __toESM(require("readline"));
30
+
31
+ // src/pricing/table.ts
32
+ var MODEL_PRICING_TABLE = {
33
+ // --- OpenAI ---
34
+ "gpt-5.6-sol": { inputPer1M: 4, outputPer1M: 20, cachedInputPer1M: 0.4 },
35
+ "gpt-5.6-terra": { inputPer1M: 2, outputPer1M: 12, cachedInputPer1M: 0.2 },
36
+ "gpt-5.6-luna": { inputPer1M: 0.2, outputPer1M: 1.2, cachedInputPer1M: 0.02 },
37
+ "gpt-5": { inputPer1M: 4, outputPer1M: 20, cachedInputPer1M: 0.4 },
38
+ "gpt-5-mini": { inputPer1M: 0.2, outputPer1M: 1.2, cachedInputPer1M: 0.02 },
39
+ "o1": { inputPer1M: 15, outputPer1M: 60, cachedInputPer1M: 7.5 },
40
+ "o1-mini": { inputPer1M: 1.1, outputPer1M: 4.4, cachedInputPer1M: 0.55 },
41
+ "o3": { inputPer1M: 15, outputPer1M: 60, cachedInputPer1M: 7.5 },
42
+ "o3-mini": { inputPer1M: 1.1, outputPer1M: 4.4, cachedInputPer1M: 0.55 },
43
+ "gpt-4o": { inputPer1M: 2.5, outputPer1M: 10, cachedInputPer1M: 1.25 },
44
+ "gpt-4o-mini": { inputPer1M: 0.15, outputPer1M: 0.6, cachedInputPer1M: 0.075 },
45
+ "gpt-4.1": { inputPer1M: 2, outputPer1M: 8, cachedInputPer1M: 1 },
46
+ "gpt-4.1-nano": { inputPer1M: 0.1, outputPer1M: 0.4, cachedInputPer1M: 0.05 },
47
+ "text-embedding-3-small": { inputPer1M: 0.02, outputPer1M: 0 },
48
+ "text-embedding-3-large": { inputPer1M: 0.13, outputPer1M: 0 },
49
+ // --- Anthropic ---
50
+ "claude-3-7-sonnet": { inputPer1M: 0.59, outputPer1M: 2.93, cachedInputPer1M: 0.3 },
51
+ "claude-sonnet-5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.3 },
52
+ "claude-3-5-sonnet": { inputPer1M: 3, outputPer1M: 15, cachedInputPer1M: 0.3 },
53
+ "claude-3-5-haiku": { inputPer1M: 0.8, outputPer1M: 4, cachedInputPer1M: 0.08 },
54
+ "haiku-4.5": { inputPer1M: 1, outputPer1M: 5, cachedInputPer1M: 0.1 },
55
+ "claude-opus-5": { inputPer1M: 5, outputPer1M: 25, cachedInputPer1M: 1.5 },
56
+ "claude-3-opus": { inputPer1M: 15, outputPer1M: 75, cachedInputPer1M: 1.5 },
57
+ // --- Google Gemini ---
58
+ "gemini-3.7-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.18 },
59
+ "gemini-3.1-pro": { inputPer1M: 2, outputPer1M: 12, cachedInputPer1M: 0.5 },
60
+ "gemini-3.5-flash": { inputPer1M: 1.5, outputPer1M: 9, cachedInputPer1M: 0.38 },
61
+ "gemini-3.1-flash-lite": { inputPer1M: 0.25, outputPer1M: 1.5, cachedInputPer1M: 0.06 },
62
+ "gemini-2.0-flash": { inputPer1M: 0.1, outputPer1M: 0.4, cachedInputPer1M: 0.025 },
63
+ "gemini-1.5-pro": { inputPer1M: 1.25, outputPer1M: 5, cachedInputPer1M: 0.3125 },
64
+ "gemini-1.5-flash": { inputPer1M: 0.075, outputPer1M: 0.3, cachedInputPer1M: 0.01875 },
65
+ // --- xAI Grok ---
66
+ "grok-4.6": { inputPer1M: 3, outputPer1M: 15 },
67
+ "grok-2": { inputPer1M: 2, outputPer1M: 10 },
68
+ "grok-2-vision": { inputPer1M: 2, outputPer1M: 10 },
69
+ "grok-beta": { inputPer1M: 5, outputPer1M: 15 },
70
+ // --- Mistral ---
71
+ "mistral-large-3": { inputPer1M: 2, outputPer1M: 6 },
72
+ "mistral-large-latest": { inputPer1M: 2, outputPer1M: 6 },
73
+ "codestral-latest": { inputPer1M: 0.3, outputPer1M: 0.9 },
74
+ "mistral-small-latest": { inputPer1M: 0.2, outputPer1M: 0.6 },
75
+ "ministral-8b-latest": { inputPer1M: 0.1, outputPer1M: 0.1 },
76
+ // --- Groq LPUs ---
77
+ "llama-3.3-70b-versatile": { inputPer1M: 0.59, outputPer1M: 0.79 },
78
+ "llama-3.1-8b-instant": { inputPer1M: 0.05, outputPer1M: 0.08 },
79
+ "deepseek-r1-distill-llama-70b": { inputPer1M: 0.75, outputPer1M: 0.99 },
80
+ "qwen-2.5-32b": { inputPer1M: 0.29, outputPer1M: 0.39 },
81
+ // --- DeepSeek ---
82
+ "deepseek-v4-pro": { inputPer1M: 0.66, outputPer1M: 1.98, cachedInputPer1M: 0.15 },
83
+ "deepseek-v4-flash": { inputPer1M: 0.22, outputPer1M: 0.66, cachedInputPer1M: 0.05 },
84
+ "deepseek-chat": { inputPer1M: 0.22, outputPer1M: 0.66, cachedInputPer1M: 0.05 },
85
+ "deepseek-reasoner": { inputPer1M: 0.66, outputPer1M: 1.98, cachedInputPer1M: 0.15 },
86
+ // --- Cohere ---
87
+ "command-r-plus": { inputPer1M: 2.5, outputPer1M: 10 },
88
+ "command-r": { inputPer1M: 0.15, outputPer1M: 0.6 }
89
+ };
90
+
91
+ // src/cli/index.ts
92
+ var args = process.argv.slice(2);
93
+ var command = args[0] || "init";
94
+ function printBanner() {
95
+ console.log(`
96
+ \x1B[36m\u26A1 \x1B[1mvibezcheck CLI\x1B[0m \x1B[90mv0.3.0\x1B[0m
97
+ \x1B[90mThe 1-line Stripe Billing & Token Metering Engine for LLMs\x1B[0m
98
+ `);
99
+ }
100
+ async function prompt(question, defaultVal = "") {
101
+ const rl = import_readline.default.createInterface({
102
+ input: process.stdin,
103
+ output: process.stdout
104
+ });
105
+ return new Promise((resolve) => {
106
+ const promptText = defaultVal ? `\x1B[32m?\x1B[0m \x1B[1m${question}\x1B[0m \x1B[90m(${defaultVal})\x1B[0m: ` : `\x1B[32m?\x1B[0m \x1B[1m${question}\x1B[0m: `;
107
+ rl.question(promptText, (answer) => {
108
+ rl.close();
109
+ resolve(answer.trim() || defaultVal);
110
+ });
111
+ });
112
+ }
113
+ async function handleInit() {
114
+ printBanner();
115
+ console.log("\x1B[35m\u{1F680} Welcome to the VibezCheck Setup Wizard!\x1B[0m\n");
116
+ const cwd = process.cwd();
117
+ const isNextAppRouter = import_fs.default.existsSync(import_path.default.join(cwd, "app"));
118
+ const isNextPagesRouter = import_fs.default.existsSync(import_path.default.join(cwd, "pages"));
119
+ const isSrcDir = import_fs.default.existsSync(import_path.default.join(cwd, "src", "app"));
120
+ console.log(`\x1B[90m\u{1F4C1} Project directory: ${cwd}\x1B[0m`);
121
+ if (isNextAppRouter || isSrcDir) {
122
+ console.log("\x1B[32m\u2713 Detected Next.js App Router project!\x1B[0m\n");
123
+ }
124
+ const defaultGateway = "vck_demo_key";
125
+ const gatewayKey = await prompt("Enter your AI Gateway API Key (or OpenAI key)", defaultGateway);
126
+ const gatewayUrl = await prompt("Enter your AI Gateway Base URL", "https://ai-gateway.vercel.sh/v1");
127
+ const stripeKey = await prompt("Enter your Stripe Secret Key (optional for test mode)", "");
128
+ const envPath = import_path.default.join(cwd, ".env.local");
129
+ const envContent = `# VibezCheck AI Gateway & Stripe Configuration
130
+ AI_GATEWAY_API_KEY=${gatewayKey}
131
+ AI_GATEWAY_BASE_URL=${gatewayUrl}
132
+ STRIPE_SECRET_KEY=${stripeKey}
133
+ `;
134
+ import_fs.default.writeFileSync(envPath, envContent, { flag: "w" });
135
+ console.log(`\x1B[32m\u2713 Created/updated .env.local\x1B[0m`);
136
+ const apiDir = isSrcDir ? import_path.default.join(cwd, "src", "app", "api", "chat") : import_path.default.join(cwd, "app", "api", "chat");
137
+ import_fs.default.mkdirSync(apiDir, { recursive: true });
138
+ const routePath = import_path.default.join(apiDir, "route.ts");
139
+ const routeContent = `import { streamText } from 'ai';
140
+ import { vibezcheck } from 'vibezcheck';
141
+
142
+ export const runtime = 'nodejs';
143
+ export const dynamic = 'force-dynamic';
144
+
145
+ export async function POST(req: Request) {
146
+ const { messages, customer = 'demo@example.com' } = await req.json();
147
+
148
+ // \u26A1 1-Line Declarative Model Metering
149
+ const result = streamText({
150
+ model: vibezcheck('openai/gpt-4o-mini', {
151
+ customer,
152
+ onUsage: (event) => {
153
+ console.log(\`\u26A1 [vibezcheck] Tokens: \${event.usage.totalTokens} | Cost: $\${event.cost.totalUSD.toFixed(6)}\`);
154
+ },
155
+ }),
156
+ messages,
157
+ });
158
+
159
+ return result.toTextStreamResponse();
160
+ }
161
+ `;
162
+ import_fs.default.writeFileSync(routePath, routeContent, { flag: "w" });
163
+ console.log(`\x1B[32m\u2713 Generated declarative API route: ${import_path.default.relative(cwd, routePath)}\x1B[0m`);
164
+ console.log(`
165
+ \x1B[32m\x1B[1m\u{1F389} Setup Complete!\x1B[0m
166
+
167
+ \x1B[1mNext Steps:\x1B[0m
168
+ 1. Add \x1B[36m<VibezSessionWidget />\x1B[0m to your layout:
169
+ \x1B[90mimport { VibezSessionProvider, VibezSessionWidget } from 'vibezcheck/react';\x1B[0m
170
+
171
+ 2. Use \x1B[36museVibezChat()\x1B[0m in your client component:
172
+ \x1B[90mconst { messages, input, handleSubmit } = useVibezChat();\x1B[0m
173
+
174
+ 3. Run your dev server:
175
+ \x1B[33mnpm run dev\x1B[0m or \x1B[33mpnpm dev\x1B[0m
176
+ `);
177
+ }
178
+ function handlePrices() {
179
+ printBanner();
180
+ console.log("\x1B[1m\u{1F4CA} Official Model Pricing Registry (USD per 1M Tokens):\x1B[0m\n");
181
+ console.log(
182
+ "Model".padEnd(32) + "Input / 1M".padEnd(16) + "Output / 1M".padEnd(16) + "Cached / 1M"
183
+ );
184
+ console.log("-".repeat(78));
185
+ Object.entries(MODEL_PRICING_TABLE).forEach(([model, rates]) => {
186
+ const input = `$${rates.inputPer1M.toFixed(3)}`.padEnd(16);
187
+ const output = `$${rates.outputPer1M.toFixed(3)}`.padEnd(16);
188
+ const cached = rates.cachedInputPer1M ? `$${rates.cachedInputPer1M.toFixed(3)}` : "\u2014";
189
+ console.log(model.padEnd(32) + input + output + cached);
190
+ });
191
+ }
192
+ function handleDoctor() {
193
+ printBanner();
194
+ console.log("\x1B[1m\u{1FA7A} Running VibezCheck System Health Check...\x1B[0m\n");
195
+ const cwd = process.cwd();
196
+ const envPath = import_path.default.join(cwd, ".env.local");
197
+ const hasEnv = import_fs.default.existsSync(envPath);
198
+ console.log(`Node.js Version: \x1B[32m${process.version}\x1B[0m`);
199
+ console.log(`Working Directory: \x1B[90m${cwd}\x1B[0m`);
200
+ console.log(`Environment File: ${hasEnv ? "\x1B[32m\u2713 Found (.env.local)\x1B[0m" : "\x1B[33m\u26A0 Missing (.env.local)\x1B[0m"}`);
201
+ const hasStripe = Boolean(process.env.STRIPE_SECRET_KEY);
202
+ console.log(`Stripe Key: ${hasStripe ? "\x1B[32m\u2713 Active\x1B[0m" : "\x1B[90m\u25CB Free Local Mode (No Stripe key)\x1B[0m"}`);
203
+ const hasGateway = Boolean(process.env.AI_GATEWAY_API_KEY || process.env.OPENAI_API_KEY);
204
+ console.log(`AI Provider Key: ${hasGateway ? "\x1B[32m\u2713 Configured\x1B[0m" : "\x1B[33m\u26A0 Missing (Set AI_GATEWAY_API_KEY)\x1B[0m"}`);
205
+ console.log(`
206
+ \x1B[32m\u2713 VibezCheck engine is healthy and ready to meter!\x1B[0m
207
+ `);
208
+ }
209
+ switch (command) {
210
+ case "init":
211
+ handleInit();
212
+ break;
213
+ case "prices":
214
+ case "pricing":
215
+ handlePrices();
216
+ break;
217
+ case "doctor":
218
+ case "health":
219
+ handleDoctor();
220
+ break;
221
+ default:
222
+ console.log(`
223
+ Unknown command: \x1B[31m${command}\x1B[0m
224
+
225
+ Available commands:
226
+ \x1B[36mvibezcheck init\x1B[0m Interactive project setup wizard
227
+ \x1B[36mvibezcheck prices\x1B[0m Display supported model pricing table
228
+ \x1B[36mvibezcheck doctor\x1B[0m Diagnose environment and API configurations
229
+ `);
230
+ break;
231
+ }
232
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/index.ts","../../src/pricing/table.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport fs from 'fs';\nimport path from 'path';\nimport readline from 'readline';\nimport { MODEL_PRICING_TABLE } from '../pricing/table';\n\nconst args = process.argv.slice(2);\nconst command = args[0] || 'init';\n\nfunction printBanner() {\n console.log(`\n\\x1b[36m⚡ \\x1b[1mvibezcheck CLI\\x1b[0m \\x1b[90mv0.3.0\\x1b[0m\n\\x1b[90mThe 1-line Stripe Billing & Token Metering Engine for LLMs\\x1b[0m\n`);\n}\n\nasync function prompt(question: string, defaultVal: string = ''): Promise<string> {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n return new Promise((resolve) => {\n const promptText = defaultVal\n ? `\\x1b[32m?\\x1b[0m \\x1b[1m${question}\\x1b[0m \\x1b[90m(${defaultVal})\\x1b[0m: `\n : `\\x1b[32m?\\x1b[0m \\x1b[1m${question}\\x1b[0m: `;\n\n rl.question(promptText, (answer) => {\n rl.close();\n resolve(answer.trim() || defaultVal);\n });\n });\n}\n\n/**\n * Command: npx vibezcheck init\n */\nasync function handleInit() {\n printBanner();\n console.log('\\x1b[35m🚀 Welcome to the VibezCheck Setup Wizard!\\x1b[0m\\n');\n\n const cwd = process.cwd();\n\n // Detect project structure\n const isNextAppRouter = fs.existsSync(path.join(cwd, 'app'));\n const isNextPagesRouter = fs.existsSync(path.join(cwd, 'pages'));\n const isSrcDir = fs.existsSync(path.join(cwd, 'src', 'app'));\n\n console.log(`\\x1b[90m📁 Project directory: ${cwd}\\x1b[0m`);\n if (isNextAppRouter || isSrcDir) {\n console.log('\\x1b[32m✓ Detected Next.js App Router project!\\x1b[0m\\n');\n }\n\n // 1. Prompt for API Keys\n const defaultGateway = 'vck_demo_key';\n const gatewayKey = await prompt('Enter your AI Gateway API Key (or OpenAI key)', defaultGateway);\n const gatewayUrl = await prompt('Enter your AI Gateway Base URL', 'https://ai-gateway.vercel.sh/v1');\n const stripeKey = await prompt('Enter your Stripe Secret Key (optional for test mode)', '');\n\n // 2. Create / Update .env.local\n const envPath = path.join(cwd, '.env.local');\n const envContent = `# VibezCheck AI Gateway & Stripe Configuration\nAI_GATEWAY_API_KEY=${gatewayKey}\nAI_GATEWAY_BASE_URL=${gatewayUrl}\nSTRIPE_SECRET_KEY=${stripeKey}\n`;\n\n fs.writeFileSync(envPath, envContent, { flag: 'w' });\n console.log(`\\x1b[32m✓ Created/updated .env.local\\x1b[0m`);\n\n // 3. Create Sample API Route (app/api/chat/route.ts)\n const apiDir = isSrcDir\n ? path.join(cwd, 'src', 'app', 'api', 'chat')\n : path.join(cwd, 'app', 'api', 'chat');\n\n fs.mkdirSync(apiDir, { recursive: true });\n const routePath = path.join(apiDir, 'route.ts');\n\n const routeContent = `import { streamText } from 'ai';\nimport { vibezcheck } from 'vibezcheck';\n\nexport const runtime = 'nodejs';\nexport const dynamic = 'force-dynamic';\n\nexport async function POST(req: Request) {\n const { messages, customer = 'demo@example.com' } = await req.json();\n\n // ⚡ 1-Line Declarative Model Metering\n const result = streamText({\n model: vibezcheck('openai/gpt-4o-mini', {\n customer,\n onUsage: (event) => {\n console.log(\\`⚡ [vibezcheck] Tokens: \\${event.usage.totalTokens} | Cost: $\\${event.cost.totalUSD.toFixed(6)}\\`);\n },\n }),\n messages,\n });\n\n return result.toTextStreamResponse();\n}\n`;\n\n fs.writeFileSync(routePath, routeContent, { flag: 'w' });\n console.log(`\\x1b[32m✓ Generated declarative API route: ${path.relative(cwd, routePath)}\\x1b[0m`);\n\n console.log(`\n\\x1b[32m\\x1b[1m🎉 Setup Complete!\\x1b[0m\n\n\\x1b[1mNext Steps:\\x1b[0m\n 1. Add \\x1b[36m<VibezSessionWidget />\\x1b[0m to your layout:\n \\x1b[90mimport { VibezSessionProvider, VibezSessionWidget } from 'vibezcheck/react';\\x1b[0m\n\n 2. Use \\x1b[36museVibezChat()\\x1b[0m in your client component:\n \\x1b[90mconst { messages, input, handleSubmit } = useVibezChat();\\x1b[0m\n\n 3. Run your dev server:\n \\x1b[33mnpm run dev\\x1b[0m or \\x1b[33mpnpm dev\\x1b[0m\n`);\n}\n\n/**\n * Command: npx vibezcheck prices\n */\nfunction handlePrices() {\n printBanner();\n console.log('\\x1b[1m📊 Official Model Pricing Registry (USD per 1M Tokens):\\x1b[0m\\n');\n\n console.log(\n 'Model'.padEnd(32) +\n 'Input / 1M'.padEnd(16) +\n 'Output / 1M'.padEnd(16) +\n 'Cached / 1M'\n );\n console.log('-'.repeat(78));\n\n Object.entries(MODEL_PRICING_TABLE).forEach(([model, rates]) => {\n const input = `$${rates.inputPer1M.toFixed(3)}`.padEnd(16);\n const output = `$${rates.outputPer1M.toFixed(3)}`.padEnd(16);\n const cached = rates.cachedInputPer1M\n ? `$${rates.cachedInputPer1M.toFixed(3)}`\n : '—';\n\n console.log(model.padEnd(32) + input + output + cached);\n });\n}\n\n/**\n * Command: npx vibezcheck doctor\n */\nfunction handleDoctor() {\n printBanner();\n console.log('\\x1b[1m🩺 Running VibezCheck System Health Check...\\x1b[0m\\n');\n\n const cwd = process.cwd();\n const envPath = path.join(cwd, '.env.local');\n const hasEnv = fs.existsSync(envPath);\n\n console.log(`Node.js Version: \\x1b[32m${process.version}\\x1b[0m`);\n console.log(`Working Directory: \\x1b[90m${cwd}\\x1b[0m`);\n console.log(`Environment File: ${hasEnv ? '\\x1b[32m✓ Found (.env.local)\\x1b[0m' : '\\x1b[33m⚠ Missing (.env.local)\\x1b[0m'}`);\n\n const hasStripe = Boolean(process.env.STRIPE_SECRET_KEY);\n console.log(`Stripe Key: ${hasStripe ? '\\x1b[32m✓ Active\\x1b[0m' : '\\x1b[90m○ Free Local Mode (No Stripe key)\\x1b[0m'}`);\n\n const hasGateway = Boolean(process.env.AI_GATEWAY_API_KEY || process.env.OPENAI_API_KEY);\n console.log(`AI Provider Key: ${hasGateway ? '\\x1b[32m✓ Configured\\x1b[0m' : '\\x1b[33m⚠ Missing (Set AI_GATEWAY_API_KEY)\\x1b[0m'}`);\n\n console.log(`\\n\\x1b[32m✓ VibezCheck engine is healthy and ready to meter!\\x1b[0m\\n`);\n}\n\n// Router\nswitch (command) {\n case 'init':\n handleInit();\n break;\n case 'prices':\n case 'pricing':\n handlePrices();\n break;\n case 'doctor':\n case 'health':\n handleDoctor();\n break;\n default:\n console.log(`\nUnknown command: \\x1b[31m${command}\\x1b[0m\n\nAvailable commands:\n \\x1b[36mvibezcheck init\\x1b[0m Interactive project setup wizard\n \\x1b[36mvibezcheck prices\\x1b[0m Display supported model pricing table\n \\x1b[36mvibezcheck doctor\\x1b[0m Diagnose environment and API configurations\n`);\n break;\n}\n","import type { ModelPricingRates } from '../types';\n\n/**\n * Built-in Registry of Model Pricing (USD per 1 Million Tokens)\n * Sourced from official 2026 provider pricing tables.\n */\nexport const MODEL_PRICING_TABLE: Record<string, ModelPricingRates> = {\n // --- OpenAI ---\n 'gpt-5.6-sol': { inputPer1M: 4.0, outputPer1M: 20.0, cachedInputPer1M: 0.4 },\n 'gpt-5.6-terra': { inputPer1M: 2.0, outputPer1M: 12.0, cachedInputPer1M: 0.2 },\n 'gpt-5.6-luna': { inputPer1M: 0.2, outputPer1M: 1.2, cachedInputPer1M: 0.02 },\n 'gpt-5': { inputPer1M: 4.0, outputPer1M: 20.0, cachedInputPer1M: 0.4 },\n 'gpt-5-mini': { inputPer1M: 0.2, outputPer1M: 1.2, cachedInputPer1M: 0.02 },\n 'o1': { inputPer1M: 15.0, outputPer1M: 60.0, cachedInputPer1M: 7.5 },\n 'o1-mini': { inputPer1M: 1.1, outputPer1M: 4.4, cachedInputPer1M: 0.55 },\n 'o3': { inputPer1M: 15.0, outputPer1M: 60.0, cachedInputPer1M: 7.5 },\n 'o3-mini': { inputPer1M: 1.1, outputPer1M: 4.4, cachedInputPer1M: 0.55 },\n 'gpt-4o': { inputPer1M: 2.5, outputPer1M: 10.0, cachedInputPer1M: 1.25 },\n 'gpt-4o-mini': { inputPer1M: 0.15, outputPer1M: 0.6, cachedInputPer1M: 0.075 },\n 'gpt-4.1': { inputPer1M: 2.0, outputPer1M: 8.0, cachedInputPer1M: 1.0 },\n 'gpt-4.1-nano': { inputPer1M: 0.1, outputPer1M: 0.4, cachedInputPer1M: 0.05 },\n 'text-embedding-3-small': { inputPer1M: 0.02, outputPer1M: 0.0 },\n 'text-embedding-3-large': { inputPer1M: 0.13, outputPer1M: 0.0 },\n\n // --- Anthropic ---\n 'claude-3-7-sonnet': { inputPer1M: 0.59, outputPer1M: 2.93, cachedInputPer1M: 0.3 },\n 'claude-sonnet-5': { inputPer1M: 2.0, outputPer1M: 10.0, cachedInputPer1M: 0.3 },\n 'claude-3-5-sonnet': { inputPer1M: 3.0, outputPer1M: 15.0, cachedInputPer1M: 0.3 },\n 'claude-3-5-haiku': { inputPer1M: 0.8, outputPer1M: 4.0, cachedInputPer1M: 0.08 },\n 'haiku-4.5': { inputPer1M: 1.0, outputPer1M: 5.0, cachedInputPer1M: 0.1 },\n 'claude-opus-5': { inputPer1M: 5.0, outputPer1M: 25.0, cachedInputPer1M: 1.5 },\n 'claude-3-opus': { inputPer1M: 15.0, outputPer1M: 75.0, cachedInputPer1M: 1.5 },\n\n // --- Google Gemini ---\n 'gemini-3.7-flash': { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.18 },\n 'gemini-3.1-pro': { inputPer1M: 2.0, outputPer1M: 12.0, cachedInputPer1M: 0.5 },\n 'gemini-3.5-flash': { inputPer1M: 1.5, outputPer1M: 9.0, cachedInputPer1M: 0.38 },\n 'gemini-3.1-flash-lite': { inputPer1M: 0.25, outputPer1M: 1.5, cachedInputPer1M: 0.06 },\n 'gemini-2.0-flash': { inputPer1M: 0.1, outputPer1M: 0.4, cachedInputPer1M: 0.025 },\n 'gemini-1.5-pro': { inputPer1M: 1.25, outputPer1M: 5.0, cachedInputPer1M: 0.3125 },\n 'gemini-1.5-flash': { inputPer1M: 0.075, outputPer1M: 0.3, cachedInputPer1M: 0.01875 },\n\n // --- xAI Grok ---\n 'grok-4.6': { inputPer1M: 3.0, outputPer1M: 15.0 },\n 'grok-2': { inputPer1M: 2.0, outputPer1M: 10.0 },\n 'grok-2-vision': { inputPer1M: 2.0, outputPer1M: 10.0 },\n 'grok-beta': { inputPer1M: 5.0, outputPer1M: 15.0 },\n\n // --- Mistral ---\n 'mistral-large-3': { inputPer1M: 2.0, outputPer1M: 6.0 },\n 'mistral-large-latest': { inputPer1M: 2.0, outputPer1M: 6.0 },\n 'codestral-latest': { inputPer1M: 0.3, outputPer1M: 0.9 },\n 'mistral-small-latest': { inputPer1M: 0.2, outputPer1M: 0.6 },\n 'ministral-8b-latest': { inputPer1M: 0.1, outputPer1M: 0.1 },\n\n // --- Groq LPUs ---\n 'llama-3.3-70b-versatile': { inputPer1M: 0.59, outputPer1M: 0.79 },\n 'llama-3.1-8b-instant': { inputPer1M: 0.05, outputPer1M: 0.08 },\n 'deepseek-r1-distill-llama-70b': { inputPer1M: 0.75, outputPer1M: 0.99 },\n 'qwen-2.5-32b': { inputPer1M: 0.29, outputPer1M: 0.39 },\n\n // --- DeepSeek ---\n 'deepseek-v4-pro': { inputPer1M: 0.66, outputPer1M: 1.98, cachedInputPer1M: 0.15 },\n 'deepseek-v4-flash': { inputPer1M: 0.22, outputPer1M: 0.66, cachedInputPer1M: 0.05 },\n 'deepseek-chat': { inputPer1M: 0.22, outputPer1M: 0.66, cachedInputPer1M: 0.05 },\n 'deepseek-reasoner': { inputPer1M: 0.66, outputPer1M: 1.98, cachedInputPer1M: 0.15 },\n\n // --- Cohere ---\n 'command-r-plus': { inputPer1M: 2.5, outputPer1M: 10.0 },\n 'command-r': { inputPer1M: 0.15, outputPer1M: 0.6 },\n};\n\n/**\n * Dynamic in-memory registry allowing runtime custom price registration\n */\nconst customPricingRegistry: Record<string, ModelPricingRates> = {};\n\n/**\n * Normalize model identifier to match pricing table keys\n */\nexport function normalizeModelKey(rawModel: string): string {\n if (!rawModel) return 'unknown';\n\n let model = rawModel.toLowerCase().trim();\n\n // Strip provider prefix if present (e.g. 'openai/gpt-4o' -> 'gpt-4o')\n if (model.includes('/')) {\n model = model.split('/')[1] || model;\n }\n\n // Remove date suffixes like -20240307 or -20250219\n model = model.replace(/-\\d{8}$/, '');\n model = model.replace(/-\\d{4}-\\d{2}-\\d{2}$/, '');\n\n return model;\n}\n\n/**\n * Retrieve pricing rates for a given model\n */\nexport function getModelPricing(modelName: string): ModelPricingRates {\n const normalized = normalizeModelKey(modelName);\n\n // Check custom registry first\n if (customPricingRegistry[normalized]) {\n return customPricingRegistry[normalized];\n }\n if (customPricingRegistry[modelName]) {\n return customPricingRegistry[modelName];\n }\n\n // Check built-in table\n if (MODEL_PRICING_TABLE[normalized]) {\n return MODEL_PRICING_TABLE[normalized];\n }\n if (MODEL_PRICING_TABLE[modelName]) {\n return MODEL_PRICING_TABLE[modelName];\n }\n\n // Fallback defaults for unknown models (conservative estimates: $1.00 in, $3.00 out)\n return {\n inputPer1M: 1.0,\n outputPer1M: 3.0,\n cachedInputPer1M: 0.5,\n };\n}\n\n/**\n * Register or override pricing rates for a custom model\n */\nexport function registerModelPricing(modelName: string, rates: ModelPricingRates): void {\n const normalized = normalizeModelKey(modelName);\n customPricingRegistry[normalized] = rates;\n customPricingRegistry[modelName] = rates;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gBAAe;AACf,kBAAiB;AACjB,sBAAqB;;;ACEd,IAAM,sBAAyD;AAAA;AAAA,EAEpE,eAAe,EAAE,YAAY,GAAK,aAAa,IAAM,kBAAkB,IAAI;AAAA,EAC3E,iBAAiB,EAAE,YAAY,GAAK,aAAa,IAAM,kBAAkB,IAAI;AAAA,EAC7E,gBAAgB,EAAE,YAAY,KAAK,aAAa,KAAK,kBAAkB,KAAK;AAAA,EAC5E,SAAS,EAAE,YAAY,GAAK,aAAa,IAAM,kBAAkB,IAAI;AAAA,EACrE,cAAc,EAAE,YAAY,KAAK,aAAa,KAAK,kBAAkB,KAAK;AAAA,EAC1E,MAAM,EAAE,YAAY,IAAM,aAAa,IAAM,kBAAkB,IAAI;AAAA,EACnE,WAAW,EAAE,YAAY,KAAK,aAAa,KAAK,kBAAkB,KAAK;AAAA,EACvE,MAAM,EAAE,YAAY,IAAM,aAAa,IAAM,kBAAkB,IAAI;AAAA,EACnE,WAAW,EAAE,YAAY,KAAK,aAAa,KAAK,kBAAkB,KAAK;AAAA,EACvE,UAAU,EAAE,YAAY,KAAK,aAAa,IAAM,kBAAkB,KAAK;AAAA,EACvE,eAAe,EAAE,YAAY,MAAM,aAAa,KAAK,kBAAkB,MAAM;AAAA,EAC7E,WAAW,EAAE,YAAY,GAAK,aAAa,GAAK,kBAAkB,EAAI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AAI,4BAA4B,QAAQ,OAAO,SAAS;AAChE,UAAQ,IAAI,8BAA8B,GAAG,SAAS;AACtD,UAAQ,IAAI,qBAAqB,SAAS,6CAAwC,4CAAuC,EAAE;AAE3H,QAAM,YAAY,QAAQ,QAAQ,IAAI,iBAAiB;AACvD,UAAQ,IAAI,eAAe,YAAY,iCAA4B,uDAAkD,EAAE;AAEvH,QAAM,aAAa,QAAQ,QAAQ,IAAI,sBAAsB,QAAQ,IAAI,cAAc;AACvF,UAAQ,IAAI,oBAAoB,aAAa,qCAAgC,wDAAmD,EAAE;AAElI,UAAQ,IAAI;AAAA;AAAA,CAAuE;AACrF;AAGA,QAAQ,SAAS;AAAA,EACf,KAAK;AACH,eAAW;AACX;AAAA,EACF,KAAK;AAAA,EACL,KAAK;AACH,iBAAa;AACb;AAAA,EACF,KAAK;AAAA,EACL,KAAK;AACH,iBAAa;AACb;AAAA,EACF;AACE,YAAQ,IAAI;AAAA,2BACW,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAMjC;AACG;AACJ;","names":["readline","fs","path"]}
@@ -0,0 +1,209 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/cli/index.ts
4
+ import fs from "fs";
5
+ import path from "path";
6
+ import readline from "readline";
7
+
8
+ // src/pricing/table.ts
9
+ var MODEL_PRICING_TABLE = {
10
+ // --- OpenAI ---
11
+ "gpt-5.6-sol": { inputPer1M: 4, outputPer1M: 20, cachedInputPer1M: 0.4 },
12
+ "gpt-5.6-terra": { inputPer1M: 2, outputPer1M: 12, cachedInputPer1M: 0.2 },
13
+ "gpt-5.6-luna": { inputPer1M: 0.2, outputPer1M: 1.2, cachedInputPer1M: 0.02 },
14
+ "gpt-5": { inputPer1M: 4, outputPer1M: 20, cachedInputPer1M: 0.4 },
15
+ "gpt-5-mini": { inputPer1M: 0.2, outputPer1M: 1.2, cachedInputPer1M: 0.02 },
16
+ "o1": { inputPer1M: 15, outputPer1M: 60, cachedInputPer1M: 7.5 },
17
+ "o1-mini": { inputPer1M: 1.1, outputPer1M: 4.4, cachedInputPer1M: 0.55 },
18
+ "o3": { inputPer1M: 15, outputPer1M: 60, cachedInputPer1M: 7.5 },
19
+ "o3-mini": { inputPer1M: 1.1, outputPer1M: 4.4, cachedInputPer1M: 0.55 },
20
+ "gpt-4o": { inputPer1M: 2.5, outputPer1M: 10, cachedInputPer1M: 1.25 },
21
+ "gpt-4o-mini": { inputPer1M: 0.15, outputPer1M: 0.6, cachedInputPer1M: 0.075 },
22
+ "gpt-4.1": { inputPer1M: 2, outputPer1M: 8, cachedInputPer1M: 1 },
23
+ "gpt-4.1-nano": { inputPer1M: 0.1, outputPer1M: 0.4, cachedInputPer1M: 0.05 },
24
+ "text-embedding-3-small": { inputPer1M: 0.02, outputPer1M: 0 },
25
+ "text-embedding-3-large": { inputPer1M: 0.13, outputPer1M: 0 },
26
+ // --- Anthropic ---
27
+ "claude-3-7-sonnet": { inputPer1M: 0.59, outputPer1M: 2.93, cachedInputPer1M: 0.3 },
28
+ "claude-sonnet-5": { inputPer1M: 2, outputPer1M: 10, cachedInputPer1M: 0.3 },
29
+ "claude-3-5-sonnet": { inputPer1M: 3, outputPer1M: 15, cachedInputPer1M: 0.3 },
30
+ "claude-3-5-haiku": { inputPer1M: 0.8, outputPer1M: 4, cachedInputPer1M: 0.08 },
31
+ "haiku-4.5": { inputPer1M: 1, outputPer1M: 5, cachedInputPer1M: 0.1 },
32
+ "claude-opus-5": { inputPer1M: 5, outputPer1M: 25, cachedInputPer1M: 1.5 },
33
+ "claude-3-opus": { inputPer1M: 15, outputPer1M: 75, cachedInputPer1M: 1.5 },
34
+ // --- Google Gemini ---
35
+ "gemini-3.7-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.18 },
36
+ "gemini-3.1-pro": { inputPer1M: 2, outputPer1M: 12, cachedInputPer1M: 0.5 },
37
+ "gemini-3.5-flash": { inputPer1M: 1.5, outputPer1M: 9, cachedInputPer1M: 0.38 },
38
+ "gemini-3.1-flash-lite": { inputPer1M: 0.25, outputPer1M: 1.5, cachedInputPer1M: 0.06 },
39
+ "gemini-2.0-flash": { inputPer1M: 0.1, outputPer1M: 0.4, cachedInputPer1M: 0.025 },
40
+ "gemini-1.5-pro": { inputPer1M: 1.25, outputPer1M: 5, cachedInputPer1M: 0.3125 },
41
+ "gemini-1.5-flash": { inputPer1M: 0.075, outputPer1M: 0.3, cachedInputPer1M: 0.01875 },
42
+ // --- xAI Grok ---
43
+ "grok-4.6": { inputPer1M: 3, outputPer1M: 15 },
44
+ "grok-2": { inputPer1M: 2, outputPer1M: 10 },
45
+ "grok-2-vision": { inputPer1M: 2, outputPer1M: 10 },
46
+ "grok-beta": { inputPer1M: 5, outputPer1M: 15 },
47
+ // --- Mistral ---
48
+ "mistral-large-3": { inputPer1M: 2, outputPer1M: 6 },
49
+ "mistral-large-latest": { inputPer1M: 2, outputPer1M: 6 },
50
+ "codestral-latest": { inputPer1M: 0.3, outputPer1M: 0.9 },
51
+ "mistral-small-latest": { inputPer1M: 0.2, outputPer1M: 0.6 },
52
+ "ministral-8b-latest": { inputPer1M: 0.1, outputPer1M: 0.1 },
53
+ // --- Groq LPUs ---
54
+ "llama-3.3-70b-versatile": { inputPer1M: 0.59, outputPer1M: 0.79 },
55
+ "llama-3.1-8b-instant": { inputPer1M: 0.05, outputPer1M: 0.08 },
56
+ "deepseek-r1-distill-llama-70b": { inputPer1M: 0.75, outputPer1M: 0.99 },
57
+ "qwen-2.5-32b": { inputPer1M: 0.29, outputPer1M: 0.39 },
58
+ // --- DeepSeek ---
59
+ "deepseek-v4-pro": { inputPer1M: 0.66, outputPer1M: 1.98, cachedInputPer1M: 0.15 },
60
+ "deepseek-v4-flash": { inputPer1M: 0.22, outputPer1M: 0.66, cachedInputPer1M: 0.05 },
61
+ "deepseek-chat": { inputPer1M: 0.22, outputPer1M: 0.66, cachedInputPer1M: 0.05 },
62
+ "deepseek-reasoner": { inputPer1M: 0.66, outputPer1M: 1.98, cachedInputPer1M: 0.15 },
63
+ // --- Cohere ---
64
+ "command-r-plus": { inputPer1M: 2.5, outputPer1M: 10 },
65
+ "command-r": { inputPer1M: 0.15, outputPer1M: 0.6 }
66
+ };
67
+
68
+ // src/cli/index.ts
69
+ var args = process.argv.slice(2);
70
+ var command = args[0] || "init";
71
+ function printBanner() {
72
+ console.log(`
73
+ \x1B[36m\u26A1 \x1B[1mvibezcheck CLI\x1B[0m \x1B[90mv0.3.0\x1B[0m
74
+ \x1B[90mThe 1-line Stripe Billing & Token Metering Engine for LLMs\x1B[0m
75
+ `);
76
+ }
77
+ async function prompt(question, defaultVal = "") {
78
+ const rl = readline.createInterface({
79
+ input: process.stdin,
80
+ output: process.stdout
81
+ });
82
+ return new Promise((resolve) => {
83
+ const promptText = defaultVal ? `\x1B[32m?\x1B[0m \x1B[1m${question}\x1B[0m \x1B[90m(${defaultVal})\x1B[0m: ` : `\x1B[32m?\x1B[0m \x1B[1m${question}\x1B[0m: `;
84
+ rl.question(promptText, (answer) => {
85
+ rl.close();
86
+ resolve(answer.trim() || defaultVal);
87
+ });
88
+ });
89
+ }
90
+ async function handleInit() {
91
+ printBanner();
92
+ console.log("\x1B[35m\u{1F680} Welcome to the VibezCheck Setup Wizard!\x1B[0m\n");
93
+ const cwd = process.cwd();
94
+ const isNextAppRouter = fs.existsSync(path.join(cwd, "app"));
95
+ const isNextPagesRouter = fs.existsSync(path.join(cwd, "pages"));
96
+ const isSrcDir = fs.existsSync(path.join(cwd, "src", "app"));
97
+ console.log(`\x1B[90m\u{1F4C1} Project directory: ${cwd}\x1B[0m`);
98
+ if (isNextAppRouter || isSrcDir) {
99
+ console.log("\x1B[32m\u2713 Detected Next.js App Router project!\x1B[0m\n");
100
+ }
101
+ const defaultGateway = "vck_demo_key";
102
+ const gatewayKey = await prompt("Enter your AI Gateway API Key (or OpenAI key)", defaultGateway);
103
+ const gatewayUrl = await prompt("Enter your AI Gateway Base URL", "https://ai-gateway.vercel.sh/v1");
104
+ const stripeKey = await prompt("Enter your Stripe Secret Key (optional for test mode)", "");
105
+ const envPath = path.join(cwd, ".env.local");
106
+ const envContent = `# VibezCheck AI Gateway & Stripe Configuration
107
+ AI_GATEWAY_API_KEY=${gatewayKey}
108
+ AI_GATEWAY_BASE_URL=${gatewayUrl}
109
+ STRIPE_SECRET_KEY=${stripeKey}
110
+ `;
111
+ fs.writeFileSync(envPath, envContent, { flag: "w" });
112
+ console.log(`\x1B[32m\u2713 Created/updated .env.local\x1B[0m`);
113
+ const apiDir = isSrcDir ? path.join(cwd, "src", "app", "api", "chat") : path.join(cwd, "app", "api", "chat");
114
+ fs.mkdirSync(apiDir, { recursive: true });
115
+ const routePath = path.join(apiDir, "route.ts");
116
+ const routeContent = `import { streamText } from 'ai';
117
+ import { vibezcheck } from 'vibezcheck';
118
+
119
+ export const runtime = 'nodejs';
120
+ export const dynamic = 'force-dynamic';
121
+
122
+ export async function POST(req: Request) {
123
+ const { messages, customer = 'demo@example.com' } = await req.json();
124
+
125
+ // \u26A1 1-Line Declarative Model Metering
126
+ const result = streamText({
127
+ model: vibezcheck('openai/gpt-4o-mini', {
128
+ customer,
129
+ onUsage: (event) => {
130
+ console.log(\`\u26A1 [vibezcheck] Tokens: \${event.usage.totalTokens} | Cost: $\${event.cost.totalUSD.toFixed(6)}\`);
131
+ },
132
+ }),
133
+ messages,
134
+ });
135
+
136
+ return result.toTextStreamResponse();
137
+ }
138
+ `;
139
+ fs.writeFileSync(routePath, routeContent, { flag: "w" });
140
+ console.log(`\x1B[32m\u2713 Generated declarative API route: ${path.relative(cwd, routePath)}\x1B[0m`);
141
+ console.log(`
142
+ \x1B[32m\x1B[1m\u{1F389} Setup Complete!\x1B[0m
143
+
144
+ \x1B[1mNext Steps:\x1B[0m
145
+ 1. Add \x1B[36m<VibezSessionWidget />\x1B[0m to your layout:
146
+ \x1B[90mimport { VibezSessionProvider, VibezSessionWidget } from 'vibezcheck/react';\x1B[0m
147
+
148
+ 2. Use \x1B[36museVibezChat()\x1B[0m in your client component:
149
+ \x1B[90mconst { messages, input, handleSubmit } = useVibezChat();\x1B[0m
150
+
151
+ 3. Run your dev server:
152
+ \x1B[33mnpm run dev\x1B[0m or \x1B[33mpnpm dev\x1B[0m
153
+ `);
154
+ }
155
+ function handlePrices() {
156
+ printBanner();
157
+ console.log("\x1B[1m\u{1F4CA} Official Model Pricing Registry (USD per 1M Tokens):\x1B[0m\n");
158
+ console.log(
159
+ "Model".padEnd(32) + "Input / 1M".padEnd(16) + "Output / 1M".padEnd(16) + "Cached / 1M"
160
+ );
161
+ console.log("-".repeat(78));
162
+ Object.entries(MODEL_PRICING_TABLE).forEach(([model, rates]) => {
163
+ const input = `$${rates.inputPer1M.toFixed(3)}`.padEnd(16);
164
+ const output = `$${rates.outputPer1M.toFixed(3)}`.padEnd(16);
165
+ const cached = rates.cachedInputPer1M ? `$${rates.cachedInputPer1M.toFixed(3)}` : "\u2014";
166
+ console.log(model.padEnd(32) + input + output + cached);
167
+ });
168
+ }
169
+ function handleDoctor() {
170
+ printBanner();
171
+ console.log("\x1B[1m\u{1FA7A} Running VibezCheck System Health Check...\x1B[0m\n");
172
+ const cwd = process.cwd();
173
+ const envPath = path.join(cwd, ".env.local");
174
+ const hasEnv = fs.existsSync(envPath);
175
+ console.log(`Node.js Version: \x1B[32m${process.version}\x1B[0m`);
176
+ console.log(`Working Directory: \x1B[90m${cwd}\x1B[0m`);
177
+ console.log(`Environment File: ${hasEnv ? "\x1B[32m\u2713 Found (.env.local)\x1B[0m" : "\x1B[33m\u26A0 Missing (.env.local)\x1B[0m"}`);
178
+ const hasStripe = Boolean(process.env.STRIPE_SECRET_KEY);
179
+ console.log(`Stripe Key: ${hasStripe ? "\x1B[32m\u2713 Active\x1B[0m" : "\x1B[90m\u25CB Free Local Mode (No Stripe key)\x1B[0m"}`);
180
+ const hasGateway = Boolean(process.env.AI_GATEWAY_API_KEY || process.env.OPENAI_API_KEY);
181
+ console.log(`AI Provider Key: ${hasGateway ? "\x1B[32m\u2713 Configured\x1B[0m" : "\x1B[33m\u26A0 Missing (Set AI_GATEWAY_API_KEY)\x1B[0m"}`);
182
+ console.log(`
183
+ \x1B[32m\u2713 VibezCheck engine is healthy and ready to meter!\x1B[0m
184
+ `);
185
+ }
186
+ switch (command) {
187
+ case "init":
188
+ handleInit();
189
+ break;
190
+ case "prices":
191
+ case "pricing":
192
+ handlePrices();
193
+ break;
194
+ case "doctor":
195
+ case "health":
196
+ handleDoctor();
197
+ break;
198
+ default:
199
+ console.log(`
200
+ Unknown command: \x1B[31m${command}\x1B[0m
201
+
202
+ Available commands:
203
+ \x1B[36mvibezcheck init\x1B[0m Interactive project setup wizard
204
+ \x1B[36mvibezcheck prices\x1B[0m Display supported model pricing table
205
+ \x1B[36mvibezcheck doctor\x1B[0m Diagnose environment and API configurations
206
+ `);
207
+ break;
208
+ }
209
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/index.ts","../../src/pricing/table.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport fs from 'fs';\nimport path from 'path';\nimport readline from 'readline';\nimport { MODEL_PRICING_TABLE } from '../pricing/table';\n\nconst args = process.argv.slice(2);\nconst command = args[0] || 'init';\n\nfunction printBanner() {\n console.log(`\n\\x1b[36m⚡ \\x1b[1mvibezcheck CLI\\x1b[0m \\x1b[90mv0.3.0\\x1b[0m\n\\x1b[90mThe 1-line Stripe Billing & Token Metering Engine for LLMs\\x1b[0m\n`);\n}\n\nasync function prompt(question: string, defaultVal: string = ''): Promise<string> {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n return new Promise((resolve) => {\n const promptText = defaultVal\n ? `\\x1b[32m?\\x1b[0m \\x1b[1m${question}\\x1b[0m \\x1b[90m(${defaultVal})\\x1b[0m: `\n : `\\x1b[32m?\\x1b[0m \\x1b[1m${question}\\x1b[0m: `;\n\n rl.question(promptText, (answer) => {\n rl.close();\n resolve(answer.trim() || defaultVal);\n });\n });\n}\n\n/**\n * Command: npx vibezcheck init\n */\nasync function handleInit() {\n printBanner();\n console.log('\\x1b[35m🚀 Welcome to the VibezCheck Setup Wizard!\\x1b[0m\\n');\n\n const cwd = process.cwd();\n\n // Detect project structure\n const isNextAppRouter = fs.existsSync(path.join(cwd, 'app'));\n const isNextPagesRouter = fs.existsSync(path.join(cwd, 'pages'));\n const isSrcDir = fs.existsSync(path.join(cwd, 'src', 'app'));\n\n console.log(`\\x1b[90m📁 Project directory: ${cwd}\\x1b[0m`);\n if (isNextAppRouter || isSrcDir) {\n console.log('\\x1b[32m✓ Detected Next.js App Router project!\\x1b[0m\\n');\n }\n\n // 1. Prompt for API Keys\n const defaultGateway = 'vck_demo_key';\n const gatewayKey = await prompt('Enter your AI Gateway API Key (or OpenAI key)', defaultGateway);\n const gatewayUrl = await prompt('Enter your AI Gateway Base URL', 'https://ai-gateway.vercel.sh/v1');\n const stripeKey = await prompt('Enter your Stripe Secret Key (optional for test mode)', '');\n\n // 2. Create / Update .env.local\n const envPath = path.join(cwd, '.env.local');\n const envContent = `# VibezCheck AI Gateway & Stripe Configuration\nAI_GATEWAY_API_KEY=${gatewayKey}\nAI_GATEWAY_BASE_URL=${gatewayUrl}\nSTRIPE_SECRET_KEY=${stripeKey}\n`;\n\n fs.writeFileSync(envPath, envContent, { flag: 'w' });\n console.log(`\\x1b[32m✓ Created/updated .env.local\\x1b[0m`);\n\n // 3. Create Sample API Route (app/api/chat/route.ts)\n const apiDir = isSrcDir\n ? path.join(cwd, 'src', 'app', 'api', 'chat')\n : path.join(cwd, 'app', 'api', 'chat');\n\n fs.mkdirSync(apiDir, { recursive: true });\n const routePath = path.join(apiDir, 'route.ts');\n\n const routeContent = `import { streamText } from 'ai';\nimport { vibezcheck } from 'vibezcheck';\n\nexport const runtime = 'nodejs';\nexport const dynamic = 'force-dynamic';\n\nexport async function POST(req: Request) {\n const { messages, customer = 'demo@example.com' } = await req.json();\n\n // ⚡ 1-Line Declarative Model Metering\n const result = streamText({\n model: vibezcheck('openai/gpt-4o-mini', {\n customer,\n onUsage: (event) => {\n console.log(\\`⚡ [vibezcheck] Tokens: \\${event.usage.totalTokens} | Cost: $\\${event.cost.totalUSD.toFixed(6)}\\`);\n },\n }),\n messages,\n });\n\n return result.toTextStreamResponse();\n}\n`;\n\n fs.writeFileSync(routePath, routeContent, { flag: 'w' });\n console.log(`\\x1b[32m✓ Generated declarative API route: ${path.relative(cwd, routePath)}\\x1b[0m`);\n\n console.log(`\n\\x1b[32m\\x1b[1m🎉 Setup Complete!\\x1b[0m\n\n\\x1b[1mNext Steps:\\x1b[0m\n 1. Add \\x1b[36m<VibezSessionWidget />\\x1b[0m to your layout:\n \\x1b[90mimport { VibezSessionProvider, VibezSessionWidget } from 'vibezcheck/react';\\x1b[0m\n\n 2. Use \\x1b[36museVibezChat()\\x1b[0m in your client component:\n \\x1b[90mconst { messages, input, handleSubmit } = useVibezChat();\\x1b[0m\n\n 3. Run your dev server:\n \\x1b[33mnpm run dev\\x1b[0m or \\x1b[33mpnpm dev\\x1b[0m\n`);\n}\n\n/**\n * Command: npx vibezcheck prices\n */\nfunction handlePrices() {\n printBanner();\n console.log('\\x1b[1m📊 Official Model Pricing Registry (USD per 1M Tokens):\\x1b[0m\\n');\n\n console.log(\n 'Model'.padEnd(32) +\n 'Input / 1M'.padEnd(16) +\n 'Output / 1M'.padEnd(16) +\n 'Cached / 1M'\n );\n console.log('-'.repeat(78));\n\n Object.entries(MODEL_PRICING_TABLE).forEach(([model, rates]) => {\n const input = `$${rates.inputPer1M.toFixed(3)}`.padEnd(16);\n const output = `$${rates.outputPer1M.toFixed(3)}`.padEnd(16);\n const cached = rates.cachedInputPer1M\n ? `$${rates.cachedInputPer1M.toFixed(3)}`\n : '—';\n\n console.log(model.padEnd(32) + input + output + cached);\n });\n}\n\n/**\n * Command: npx vibezcheck doctor\n */\nfunction handleDoctor() {\n printBanner();\n console.log('\\x1b[1m🩺 Running VibezCheck System Health Check...\\x1b[0m\\n');\n\n const cwd = process.cwd();\n const envPath = path.join(cwd, '.env.local');\n const hasEnv = fs.existsSync(envPath);\n\n console.log(`Node.js Version: \\x1b[32m${process.version}\\x1b[0m`);\n console.log(`Working Directory: \\x1b[90m${cwd}\\x1b[0m`);\n console.log(`Environment File: ${hasEnv ? '\\x1b[32m✓ Found (.env.local)\\x1b[0m' : '\\x1b[33m⚠ Missing (.env.local)\\x1b[0m'}`);\n\n const hasStripe = Boolean(process.env.STRIPE_SECRET_KEY);\n console.log(`Stripe Key: ${hasStripe ? '\\x1b[32m✓ Active\\x1b[0m' : '\\x1b[90m○ Free Local Mode (No Stripe key)\\x1b[0m'}`);\n\n const hasGateway = Boolean(process.env.AI_GATEWAY_API_KEY || process.env.OPENAI_API_KEY);\n console.log(`AI Provider Key: ${hasGateway ? '\\x1b[32m✓ Configured\\x1b[0m' : '\\x1b[33m⚠ Missing (Set AI_GATEWAY_API_KEY)\\x1b[0m'}`);\n\n console.log(`\\n\\x1b[32m✓ VibezCheck engine is healthy and ready to meter!\\x1b[0m\\n`);\n}\n\n// Router\nswitch (command) {\n case 'init':\n handleInit();\n break;\n case 'prices':\n case 'pricing':\n handlePrices();\n break;\n case 'doctor':\n case 'health':\n handleDoctor();\n break;\n default:\n console.log(`\nUnknown command: \\x1b[31m${command}\\x1b[0m\n\nAvailable commands:\n \\x1b[36mvibezcheck init\\x1b[0m Interactive project setup wizard\n \\x1b[36mvibezcheck prices\\x1b[0m Display supported model pricing table\n \\x1b[36mvibezcheck doctor\\x1b[0m Diagnose environment and API configurations\n`);\n break;\n}\n","import type { ModelPricingRates } from '../types';\n\n/**\n * Built-in Registry of Model Pricing (USD per 1 Million Tokens)\n * Sourced from official 2026 provider pricing tables.\n */\nexport const MODEL_PRICING_TABLE: Record<string, ModelPricingRates> = {\n // --- OpenAI ---\n 'gpt-5.6-sol': { inputPer1M: 4.0, outputPer1M: 20.0, cachedInputPer1M: 0.4 },\n 'gpt-5.6-terra': { inputPer1M: 2.0, outputPer1M: 12.0, cachedInputPer1M: 0.2 },\n 'gpt-5.6-luna': { inputPer1M: 0.2, outputPer1M: 1.2, cachedInputPer1M: 0.02 },\n 'gpt-5': { inputPer1M: 4.0, outputPer1M: 20.0, cachedInputPer1M: 0.4 },\n 'gpt-5-mini': { inputPer1M: 0.2, outputPer1M: 1.2, cachedInputPer1M: 0.02 },\n 'o1': { inputPer1M: 15.0, outputPer1M: 60.0, cachedInputPer1M: 7.5 },\n 'o1-mini': { inputPer1M: 1.1, outputPer1M: 4.4, cachedInputPer1M: 0.55 },\n 'o3': { inputPer1M: 15.0, outputPer1M: 60.0, cachedInputPer1M: 7.5 },\n 'o3-mini': { inputPer1M: 1.1, outputPer1M: 4.4, cachedInputPer1M: 0.55 },\n 'gpt-4o': { inputPer1M: 2.5, outputPer1M: 10.0, cachedInputPer1M: 1.25 },\n 'gpt-4o-mini': { inputPer1M: 0.15, outputPer1M: 0.6, cachedInputPer1M: 0.075 },\n 'gpt-4.1': { inputPer1M: 2.0, outputPer1M: 8.0, cachedInputPer1M: 1.0 },\n 'gpt-4.1-nano': { inputPer1M: 0.1, outputPer1M: 0.4, cachedInputPer1M: 0.05 },\n 'text-embedding-3-small': { inputPer1M: 0.02, outputPer1M: 0.0 },\n 'text-embedding-3-large': { inputPer1M: 0.13, outputPer1M: 0.0 },\n\n // --- Anthropic ---\n 'claude-3-7-sonnet': { inputPer1M: 0.59, outputPer1M: 2.93, cachedInputPer1M: 0.3 },\n 'claude-sonnet-5': { inputPer1M: 2.0, outputPer1M: 10.0, cachedInputPer1M: 0.3 },\n 'claude-3-5-sonnet': { inputPer1M: 3.0, outputPer1M: 15.0, cachedInputPer1M: 0.3 },\n 'claude-3-5-haiku': { inputPer1M: 0.8, outputPer1M: 4.0, cachedInputPer1M: 0.08 },\n 'haiku-4.5': { inputPer1M: 1.0, outputPer1M: 5.0, cachedInputPer1M: 0.1 },\n 'claude-opus-5': { inputPer1M: 5.0, outputPer1M: 25.0, cachedInputPer1M: 1.5 },\n 'claude-3-opus': { inputPer1M: 15.0, outputPer1M: 75.0, cachedInputPer1M: 1.5 },\n\n // --- Google Gemini ---\n 'gemini-3.7-flash': { inputPer1M: 0.75, outputPer1M: 3.75, cachedInputPer1M: 0.18 },\n 'gemini-3.1-pro': { inputPer1M: 2.0, outputPer1M: 12.0, cachedInputPer1M: 0.5 },\n 'gemini-3.5-flash': { inputPer1M: 1.5, outputPer1M: 9.0, cachedInputPer1M: 0.38 },\n 'gemini-3.1-flash-lite': { inputPer1M: 0.25, outputPer1M: 1.5, cachedInputPer1M: 0.06 },\n 'gemini-2.0-flash': { inputPer1M: 0.1, outputPer1M: 0.4, cachedInputPer1M: 0.025 },\n 'gemini-1.5-pro': { inputPer1M: 1.25, outputPer1M: 5.0, cachedInputPer1M: 0.3125 },\n 'gemini-1.5-flash': { inputPer1M: 0.075, outputPer1M: 0.3, cachedInputPer1M: 0.01875 },\n\n // --- xAI Grok ---\n 'grok-4.6': { inputPer1M: 3.0, outputPer1M: 15.0 },\n 'grok-2': { inputPer1M: 2.0, outputPer1M: 10.0 },\n 'grok-2-vision': { inputPer1M: 2.0, outputPer1M: 10.0 },\n 'grok-beta': { inputPer1M: 5.0, outputPer1M: 15.0 },\n\n // --- Mistral ---\n 'mistral-large-3': { inputPer1M: 2.0, outputPer1M: 6.0 },\n 'mistral-large-latest': { inputPer1M: 2.0, outputPer1M: 6.0 },\n 'codestral-latest': { inputPer1M: 0.3, outputPer1M: 0.9 },\n 'mistral-small-latest': { inputPer1M: 0.2, outputPer1M: 0.6 },\n 'ministral-8b-latest': { inputPer1M: 0.1, outputPer1M: 0.1 },\n\n // --- Groq LPUs ---\n 'llama-3.3-70b-versatile': { inputPer1M: 0.59, outputPer1M: 0.79 },\n 'llama-3.1-8b-instant': { inputPer1M: 0.05, outputPer1M: 0.08 },\n 'deepseek-r1-distill-llama-70b': { inputPer1M: 0.75, outputPer1M: 0.99 },\n 'qwen-2.5-32b': { inputPer1M: 0.29, outputPer1M: 0.39 },\n\n // --- DeepSeek ---\n 'deepseek-v4-pro': { inputPer1M: 0.66, outputPer1M: 1.98, cachedInputPer1M: 0.15 },\n 'deepseek-v4-flash': { inputPer1M: 0.22, outputPer1M: 0.66, cachedInputPer1M: 0.05 },\n 'deepseek-chat': { inputPer1M: 0.22, outputPer1M: 0.66, cachedInputPer1M: 0.05 },\n 'deepseek-reasoner': { inputPer1M: 0.66, outputPer1M: 1.98, cachedInputPer1M: 0.15 },\n\n // --- Cohere ---\n 'command-r-plus': { inputPer1M: 2.5, outputPer1M: 10.0 },\n 'command-r': { inputPer1M: 0.15, outputPer1M: 0.6 },\n};\n\n/**\n * Dynamic in-memory registry allowing runtime custom price registration\n */\nconst customPricingRegistry: Record<string, ModelPricingRates> = {};\n\n/**\n * Normalize model identifier to match pricing table keys\n */\nexport function normalizeModelKey(rawModel: string): string {\n if (!rawModel) return 'unknown';\n\n let model = rawModel.toLowerCase().trim();\n\n // Strip provider prefix if present (e.g. 'openai/gpt-4o' -> 'gpt-4o')\n if (model.includes('/')) {\n model = model.split('/')[1] || model;\n }\n\n // Remove date suffixes like -20240307 or -20250219\n model = model.replace(/-\\d{8}$/, '');\n model = model.replace(/-\\d{4}-\\d{2}-\\d{2}$/, '');\n\n return model;\n}\n\n/**\n * Retrieve pricing rates for a given model\n */\nexport function getModelPricing(modelName: string): ModelPricingRates {\n const normalized = normalizeModelKey(modelName);\n\n // Check custom registry first\n if (customPricingRegistry[normalized]) {\n return customPricingRegistry[normalized];\n }\n if (customPricingRegistry[modelName]) {\n return customPricingRegistry[modelName];\n }\n\n // Check built-in table\n if (MODEL_PRICING_TABLE[normalized]) {\n return MODEL_PRICING_TABLE[normalized];\n }\n if (MODEL_PRICING_TABLE[modelName]) {\n return MODEL_PRICING_TABLE[modelName];\n }\n\n // Fallback defaults for unknown models (conservative estimates: $1.00 in, $3.00 out)\n return {\n inputPer1M: 1.0,\n outputPer1M: 3.0,\n cachedInputPer1M: 0.5,\n };\n}\n\n/**\n * Register or override pricing rates for a custom model\n */\nexport function registerModelPricing(modelName: string, rates: ModelPricingRates): void {\n const normalized = normalizeModelKey(modelName);\n customPricingRegistry[normalized] = rates;\n customPricingRegistry[modelName] = rates;\n}\n"],"mappings":";;;AAEA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,cAAc;;;ACEd,IAAM,sBAAyD;AAAA;AAAA,EAEpE,eAAe,EAAE,YAAY,GAAK,aAAa,IAAM,kBAAkB,IAAI;AAAA,EAC3E,iBAAiB,EAAE,YAAY,GAAK,aAAa,IAAM,kBAAkB,IAAI;AAAA,EAC7E,gBAAgB,EAAE,YAAY,KAAK,aAAa,KAAK,kBAAkB,KAAK;AAAA,EAC5E,SAAS,EAAE,YAAY,GAAK,aAAa,IAAM,kBAAkB,IAAI;AAAA,EACrE,cAAc,EAAE,YAAY,KAAK,aAAa,KAAK,kBAAkB,KAAK;AAAA,EAC1E,MAAM,EAAE,YAAY,IAAM,aAAa,IAAM,kBAAkB,IAAI;AAAA,EACnE,WAAW,EAAE,YAAY,KAAK,aAAa,KAAK,kBAAkB,KAAK;AAAA,EACvE,MAAM,EAAE,YAAY,IAAM,aAAa,IAAM,kBAAkB,IAAI;AAAA,EACnE,WAAW,EAAE,YAAY,KAAK,aAAa,KAAK,kBAAkB,KAAK;AAAA,EACvE,UAAU,EAAE,YAAY,KAAK,aAAa,IAAM,kBAAkB,KAAK;AAAA,EACvE,eAAe,EAAE,YAAY,MAAM,aAAa,KAAK,kBAAkB,MAAM;AAAA,EAC7E,WAAW,EAAE,YAAY,GAAK,aAAa,GAAK,kBAAkB,EAAI;AAAA,EACtE,gBAAgB,EAAE,YAAY,KAAK,aAAa,KAAK,kBAAkB,KAAK;AAAA,EAC5E,0BAA0B,EAAE,YAAY,MAAM,aAAa,EAAI;AAAA,EAC/D,0BAA0B,EAAE,YAAY,MAAM,aAAa,EAAI;AAAA;AAAA,EAG/D,qBAAqB,EAAE,YAAY,MAAM,aAAa,MAAM,kBAAkB,IAAI;AAAA,EAClF,mBAAmB,E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AAuE;AACrF;AAGA,QAAQ,SAAS;AAAA,EACf,KAAK;AACH,eAAW;AACX;AAAA,EACF,KAAK;AAAA,EACL,KAAK;AACH,iBAAa;AACb;AAAA,EACF,KAAK;AAAA,EACL,KAAK;AACH,iBAAa;AACb;AAAA,EACF;AACE,YAAQ,IAAI;AAAA,2BACW,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAMjC;AACG;AACJ;","names":[]}
@@ -1,4 +1,4 @@
1
- import { M as MeterOptions, C as CustomerParam, U as UsageEvent, S as StreamWrapOptions, R as RecordUsageOptions, a as UsageSummary } from './types-CSrSmsd1.mjs';
1
+ import { M as MeterOptions, C as CustomerParam, U as UsageEvent, S as StreamWrapOptions, R as RecordUsageOptions, a as UsageSummary } from './types-DCuzLVyc.mjs';
2
2
 
3
3
  declare class VibezMeter {
4
4
  private batcher;
@@ -1,4 +1,4 @@
1
- import { M as MeterOptions, C as CustomerParam, U as UsageEvent, S as StreamWrapOptions, R as RecordUsageOptions, a as UsageSummary } from './types-CSrSmsd1.js';
1
+ import { M as MeterOptions, C as CustomerParam, U as UsageEvent, S as StreamWrapOptions, R as RecordUsageOptions, a as UsageSummary } from './types-DCuzLVyc.js';
2
2
 
3
3
  declare class VibezMeter {
4
4
  private batcher;