vibezcheck 0.2.0 → 0.4.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.
- package/README.md +131 -197
- package/bin/vibezcheck.js +4 -0
- package/dist/ai-sdk/index.d.mts +78 -9
- package/dist/ai-sdk/index.d.ts +78 -9
- package/dist/ai-sdk/index.js +278 -64
- package/dist/ai-sdk/index.js.map +1 -1
- package/dist/ai-sdk/index.mjs +282 -64
- package/dist/ai-sdk/index.mjs.map +1 -1
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +232 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +209 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/{client-MJ3tl7bz.d.mts → client--iq93FQg.d.mts} +1 -1
- package/dist/{client-txrE0D_D.d.ts → client-kJN_Znan.d.ts} +1 -1
- package/dist/index.d.mts +50 -26
- package/dist/index.d.ts +50 -26
- package/dist/index.js +299 -104
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +303 -104
- 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 +28 -7
- package/dist/meter/index.js.map +1 -1
- package/dist/meter/index.mjs +28 -7
- package/dist/meter/index.mjs.map +1 -1
- package/dist/pricing/index.d.mts +8 -2
- package/dist/pricing/index.d.ts +8 -2
- package/dist/pricing/index.js +28 -7
- package/dist/pricing/index.js.map +1 -1
- package/dist/pricing/index.mjs +28 -7
- package/dist/pricing/index.mjs.map +1 -1
- package/dist/react/index.d.mts +95 -17
- package/dist/react/index.d.ts +95 -17
- package/dist/react/index.js +468 -7
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +468 -10
- package/dist/react/index.mjs.map +1 -1
- package/dist/types-Zbzxg-Ka.d.mts +261 -0
- package/dist/types-Zbzxg-Ka.d.ts +261 -0
- package/package.json +6 -2
- package/dist/types-CSrSmsd1.d.mts +0 -159
- package/dist/types-CSrSmsd1.d.ts +0 -159
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export { AnthropicStreamAccumulator, ExtractedUsage, MeterBatcher, UsageDispatchedCallback, detectAndExtractUsage, extractAnthropicResponseUsage, extractGeminiResponseUsage, extractGenericResponseUsage, extractOpenAIResponseUsage, inspectOpenAIStreamChunk, trackTokens, wrapAnthropicStream, wrapGeminiStream, wrapOpenAIStream, wrapStream, wrapUniversalStream } from './meter/index.mjs';
|
|
2
|
+
import { VibezCheckModelOptions, withBilling, createVibezSession } from './ai-sdk/index.mjs';
|
|
3
|
+
export { VibezSession, VibezSessionOptions, WithBillingOptions, createVibezModel, meteredModel } from './ai-sdk/index.mjs';
|
|
4
|
+
import { calculateCost, getModelPricing, registerModelPricing } from './pricing/index.mjs';
|
|
5
|
+
export { CalculateCostParams, MODEL_PRICING_TABLE, calculateUsageCost, normalizeModelKey } from './pricing/index.mjs';
|
|
6
|
+
import { M as MeterOptions, S as StreamWrapOptions, C as CustomerParam, U as UsageEvent, a as UsageSummary } from './types-Zbzxg-Ka.mjs';
|
|
7
|
+
export { B as BillingConfig, b as BudgetExceededEvent, c as CircuitBreakerOptions, I as InferenceCost, d as InlineRateConfig, K as KnownModel, e as ModelPricingRates, P as PricingConfig, R as RecordUsageOptions, f as SupportedAnthropicModel, g as SupportedDeepSeekModel, h as SupportedGoogleModel, i as SupportedModel, j as SupportedOpenAIModel, T as TokenUsage, k as ToolMeterOptions, V as VibezCircuitBreakerError } from './types-Zbzxg-Ka.mjs';
|
|
8
|
+
import { V as VibezMeter, c as createMeter } from './client--iq93FQg.mjs';
|
|
5
9
|
import { CustomerManager } from './customers/index.mjs';
|
|
6
10
|
export { CustomerCache, CustomerManagerOptions, GetOrCreateCustomerParams, createCustomerManager } from './customers/index.mjs';
|
|
7
11
|
import { ApiKeyAuth } from './auth/index.mjs';
|
|
8
12
|
export { ApiKeyRecord, CreateApiKeyParams, VerifyAuthResult, createApiKeyAuth, extractAuthToken } from './auth/index.mjs';
|
|
9
13
|
import { BillingHelper } from './billing/index.mjs';
|
|
10
14
|
export { CreateCheckoutSessionParams, CreatePortalSessionParams, CreateTopUpSessionParams, createBillingHelper } from './billing/index.mjs';
|
|
11
|
-
export { AnthropicStreamAccumulator, ExtractedUsage, MeterBatcher, UsageDispatchedCallback, detectAndExtractUsage, extractAnthropicResponseUsage, extractGeminiResponseUsage, extractGenericResponseUsage, extractOpenAIResponseUsage, inspectOpenAIStreamChunk, trackTokens, wrapAnthropicStream, wrapGeminiStream, wrapOpenAIStream, wrapStream, wrapUniversalStream } from './meter/index.mjs';
|
|
12
|
-
export { CalculateCostParams, MODEL_PRICING_TABLE, calculateCost, calculateUsageCost, getModelPricing, normalizeModelKey, registerModelPricing } from './pricing/index.mjs';
|
|
13
|
-
export { WithBillingOptions, meteredModel, withBilling } from './ai-sdk/index.mjs';
|
|
14
15
|
import 'stripe';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -48,17 +49,9 @@ declare class VibezCheckClient {
|
|
|
48
49
|
customer?: CustomerParam;
|
|
49
50
|
}): T;
|
|
50
51
|
/**
|
|
51
|
-
*
|
|
52
|
+
* Declarative model resolver for Vercel AI SDK
|
|
52
53
|
*/
|
|
53
|
-
|
|
54
|
-
model: string;
|
|
55
|
-
messages: Array<{
|
|
56
|
-
role: string;
|
|
57
|
-
content: string;
|
|
58
|
-
}>;
|
|
59
|
-
customer?: CustomerParam;
|
|
60
|
-
temperature?: number;
|
|
61
|
-
}): Promise<Response>;
|
|
54
|
+
model(modelOrId: any, options?: VibezCheckModelOptions): any;
|
|
62
55
|
/**
|
|
63
56
|
* Flush pending meter events (vital for serverless runtimes)
|
|
64
57
|
*/
|
|
@@ -73,20 +66,51 @@ declare class VibezCheckClient {
|
|
|
73
66
|
*/
|
|
74
67
|
declare function createVibezCheck(config?: VibezCheckConfig): VibezCheckClient;
|
|
75
68
|
/**
|
|
76
|
-
*
|
|
69
|
+
* Declarative 1-line factory & model resolver for Vercel AI SDK
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* import { generateText, streamText } from 'ai';
|
|
74
|
+
* import { vibezcheck } from 'vibezcheck';
|
|
75
|
+
*
|
|
76
|
+
* // 1. Use string model identifier:
|
|
77
|
+
* const { text } = await generateText({
|
|
78
|
+
* model: vibezcheck('openai/gpt-4o-mini', { customer: 'alex@example.com' }),
|
|
79
|
+
* prompt: 'What is love?',
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* // 2. Use with streamText:
|
|
83
|
+
* const result = streamText({
|
|
84
|
+
* model: vibezcheck('gpt-4o-mini', { customer: 'alex@example.com' }),
|
|
85
|
+
* messages,
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* // 3. Wrap existing model instance:
|
|
89
|
+
* const result = streamText({
|
|
90
|
+
* model: vibezcheck(openai('gpt-4o-mini'), { customer: 'alex@example.com' }),
|
|
91
|
+
* messages,
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
77
94
|
*/
|
|
78
|
-
declare
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
95
|
+
declare function vibezcheck(modelOrId: any, options?: VibezCheckModelOptions): any;
|
|
96
|
+
declare function vibezcheck(config?: VibezCheckConfig): VibezCheckClient;
|
|
97
|
+
declare namespace vibezcheck {
|
|
98
|
+
var calculateCost: typeof calculateCost;
|
|
99
|
+
var getModelPricing: typeof getModelPricing;
|
|
100
|
+
var registerModelPricing: typeof registerModelPricing;
|
|
101
|
+
var create: typeof createVibezCheck;
|
|
102
|
+
var withBilling: typeof withBilling;
|
|
103
|
+
var createMeter: typeof createMeter;
|
|
104
|
+
var session: typeof createVibezSession;
|
|
105
|
+
}
|
|
83
106
|
/**
|
|
84
|
-
* Singleton instance
|
|
107
|
+
* Singleton client instance
|
|
85
108
|
*/
|
|
86
109
|
declare const vibez: VibezCheckClient;
|
|
87
110
|
/**
|
|
88
|
-
*
|
|
111
|
+
* Aliases for developer typing convenience
|
|
89
112
|
*/
|
|
113
|
+
declare const vibescheck: typeof vibezcheck;
|
|
90
114
|
declare const vibes: VibezCheckClient;
|
|
91
115
|
|
|
92
|
-
export { ApiKeyAuth, BillingHelper, CustomerManager, CustomerParam, MeterOptions, StreamWrapOptions, UsageEvent, UsageSummary, VibezCheckClient, type VibezCheckConfig, VibezMeter, createVibezCheck, vibes, vibescheck, vibez, vibezcheck };
|
|
116
|
+
export { ApiKeyAuth, BillingHelper, CustomerManager, CustomerParam, MeterOptions, StreamWrapOptions, UsageEvent, UsageSummary, VibezCheckClient, type VibezCheckConfig, VibezCheckModelOptions, VibezMeter, calculateCost, createMeter, createVibezCheck, createVibezSession, getModelPricing, registerModelPricing, vibes, vibescheck, vibez, vibezcheck, withBilling };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export { AnthropicStreamAccumulator, ExtractedUsage, MeterBatcher, UsageDispatchedCallback, detectAndExtractUsage, extractAnthropicResponseUsage, extractGeminiResponseUsage, extractGenericResponseUsage, extractOpenAIResponseUsage, inspectOpenAIStreamChunk, trackTokens, wrapAnthropicStream, wrapGeminiStream, wrapOpenAIStream, wrapStream, wrapUniversalStream } from './meter/index.js';
|
|
2
|
+
import { VibezCheckModelOptions, withBilling, createVibezSession } from './ai-sdk/index.js';
|
|
3
|
+
export { VibezSession, VibezSessionOptions, WithBillingOptions, createVibezModel, meteredModel } from './ai-sdk/index.js';
|
|
4
|
+
import { calculateCost, getModelPricing, registerModelPricing } from './pricing/index.js';
|
|
5
|
+
export { CalculateCostParams, MODEL_PRICING_TABLE, calculateUsageCost, normalizeModelKey } from './pricing/index.js';
|
|
6
|
+
import { M as MeterOptions, S as StreamWrapOptions, C as CustomerParam, U as UsageEvent, a as UsageSummary } from './types-Zbzxg-Ka.js';
|
|
7
|
+
export { B as BillingConfig, b as BudgetExceededEvent, c as CircuitBreakerOptions, I as InferenceCost, d as InlineRateConfig, K as KnownModel, e as ModelPricingRates, P as PricingConfig, R as RecordUsageOptions, f as SupportedAnthropicModel, g as SupportedDeepSeekModel, h as SupportedGoogleModel, i as SupportedModel, j as SupportedOpenAIModel, T as TokenUsage, k as ToolMeterOptions, V as VibezCircuitBreakerError } from './types-Zbzxg-Ka.js';
|
|
8
|
+
import { V as VibezMeter, c as createMeter } from './client-kJN_Znan.js';
|
|
5
9
|
import { CustomerManager } from './customers/index.js';
|
|
6
10
|
export { CustomerCache, CustomerManagerOptions, GetOrCreateCustomerParams, createCustomerManager } from './customers/index.js';
|
|
7
11
|
import { ApiKeyAuth } from './auth/index.js';
|
|
8
12
|
export { ApiKeyRecord, CreateApiKeyParams, VerifyAuthResult, createApiKeyAuth, extractAuthToken } from './auth/index.js';
|
|
9
13
|
import { BillingHelper } from './billing/index.js';
|
|
10
14
|
export { CreateCheckoutSessionParams, CreatePortalSessionParams, CreateTopUpSessionParams, createBillingHelper } from './billing/index.js';
|
|
11
|
-
export { AnthropicStreamAccumulator, ExtractedUsage, MeterBatcher, UsageDispatchedCallback, detectAndExtractUsage, extractAnthropicResponseUsage, extractGeminiResponseUsage, extractGenericResponseUsage, extractOpenAIResponseUsage, inspectOpenAIStreamChunk, trackTokens, wrapAnthropicStream, wrapGeminiStream, wrapOpenAIStream, wrapStream, wrapUniversalStream } from './meter/index.js';
|
|
12
|
-
export { CalculateCostParams, MODEL_PRICING_TABLE, calculateCost, calculateUsageCost, getModelPricing, normalizeModelKey, registerModelPricing } from './pricing/index.js';
|
|
13
|
-
export { WithBillingOptions, meteredModel, withBilling } from './ai-sdk/index.js';
|
|
14
15
|
import 'stripe';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -48,17 +49,9 @@ declare class VibezCheckClient {
|
|
|
48
49
|
customer?: CustomerParam;
|
|
49
50
|
}): T;
|
|
50
51
|
/**
|
|
51
|
-
*
|
|
52
|
+
* Declarative model resolver for Vercel AI SDK
|
|
52
53
|
*/
|
|
53
|
-
|
|
54
|
-
model: string;
|
|
55
|
-
messages: Array<{
|
|
56
|
-
role: string;
|
|
57
|
-
content: string;
|
|
58
|
-
}>;
|
|
59
|
-
customer?: CustomerParam;
|
|
60
|
-
temperature?: number;
|
|
61
|
-
}): Promise<Response>;
|
|
54
|
+
model(modelOrId: any, options?: VibezCheckModelOptions): any;
|
|
62
55
|
/**
|
|
63
56
|
* Flush pending meter events (vital for serverless runtimes)
|
|
64
57
|
*/
|
|
@@ -73,20 +66,51 @@ declare class VibezCheckClient {
|
|
|
73
66
|
*/
|
|
74
67
|
declare function createVibezCheck(config?: VibezCheckConfig): VibezCheckClient;
|
|
75
68
|
/**
|
|
76
|
-
*
|
|
69
|
+
* Declarative 1-line factory & model resolver for Vercel AI SDK
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* import { generateText, streamText } from 'ai';
|
|
74
|
+
* import { vibezcheck } from 'vibezcheck';
|
|
75
|
+
*
|
|
76
|
+
* // 1. Use string model identifier:
|
|
77
|
+
* const { text } = await generateText({
|
|
78
|
+
* model: vibezcheck('openai/gpt-4o-mini', { customer: 'alex@example.com' }),
|
|
79
|
+
* prompt: 'What is love?',
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* // 2. Use with streamText:
|
|
83
|
+
* const result = streamText({
|
|
84
|
+
* model: vibezcheck('gpt-4o-mini', { customer: 'alex@example.com' }),
|
|
85
|
+
* messages,
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* // 3. Wrap existing model instance:
|
|
89
|
+
* const result = streamText({
|
|
90
|
+
* model: vibezcheck(openai('gpt-4o-mini'), { customer: 'alex@example.com' }),
|
|
91
|
+
* messages,
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
77
94
|
*/
|
|
78
|
-
declare
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
95
|
+
declare function vibezcheck(modelOrId: any, options?: VibezCheckModelOptions): any;
|
|
96
|
+
declare function vibezcheck(config?: VibezCheckConfig): VibezCheckClient;
|
|
97
|
+
declare namespace vibezcheck {
|
|
98
|
+
var calculateCost: typeof calculateCost;
|
|
99
|
+
var getModelPricing: typeof getModelPricing;
|
|
100
|
+
var registerModelPricing: typeof registerModelPricing;
|
|
101
|
+
var create: typeof createVibezCheck;
|
|
102
|
+
var withBilling: typeof withBilling;
|
|
103
|
+
var createMeter: typeof createMeter;
|
|
104
|
+
var session: typeof createVibezSession;
|
|
105
|
+
}
|
|
83
106
|
/**
|
|
84
|
-
* Singleton instance
|
|
107
|
+
* Singleton client instance
|
|
85
108
|
*/
|
|
86
109
|
declare const vibez: VibezCheckClient;
|
|
87
110
|
/**
|
|
88
|
-
*
|
|
111
|
+
* Aliases for developer typing convenience
|
|
89
112
|
*/
|
|
113
|
+
declare const vibescheck: typeof vibezcheck;
|
|
90
114
|
declare const vibes: VibezCheckClient;
|
|
91
115
|
|
|
92
|
-
export { ApiKeyAuth, BillingHelper, CustomerManager, CustomerParam, MeterOptions, StreamWrapOptions, UsageEvent, UsageSummary, VibezCheckClient, type VibezCheckConfig, VibezMeter, createVibezCheck, vibes, vibescheck, vibez, vibezcheck };
|
|
116
|
+
export { ApiKeyAuth, BillingHelper, CustomerManager, CustomerParam, MeterOptions, StreamWrapOptions, UsageEvent, UsageSummary, VibezCheckClient, type VibezCheckConfig, VibezCheckModelOptions, VibezMeter, calculateCost, createMeter, createVibezCheck, createVibezSession, getModelPricing, registerModelPricing, vibes, vibescheck, vibez, vibezcheck, withBilling };
|