@vly-ai/integrations 0.5.2 → 0.6.1-beta.1

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 CHANGED
@@ -1,26 +1,36 @@
1
- # vly-integrations
1
+ # @vly-ai/integrations
2
2
 
3
- First-order integrations for AI, email, and payments with automatic usage billing through Vly deployment tokens. Built on the AI SDK for reliable, type-safe AI Gateway integration.
3
+ Access AI models and email services through [vly.ai](https://vly.ai) without managing multiple API keys or accounts. Built on the AI SDK for reliable, type-safe AI Gateway integration.
4
+
5
+ ## Why use @vly-ai/integrations?
6
+
7
+ Instead of creating separate accounts and managing API keys for OpenAI, Anthropic, SendGrid, Resend, etc., get a single deployment token from [vly.ai](https://vly.ai) and access all these services with automatic usage-based billing:
8
+
9
+ - **No API key management** - One token for all services (AI models, email, etc.)
10
+ - **No separate accounts** - Skip creating accounts with OpenAI, Anthropic, SendGrid, etc.
11
+ - **Usage-based billing** - Pay only for what you use, billed through your vly.ai deployment
12
+ - **Multiple AI models** - Access GPT-5, Claude 4, Gemini, Llama, and more through one API
13
+ - **Built on AI SDK** - Type-safe, production-ready integration
4
14
 
5
15
  ## Installation
6
16
 
7
17
  ```bash
8
- npm install vly-integrations
9
- # or
10
- yarn add vly-integrations
11
- # or
12
- pnpm add vly-integrations
18
+ pnpm add @vly-ai/integrations
13
19
  ```
14
20
 
15
- No additional dependencies required! Built with fetch and AI SDK.
21
+ ## Getting Started
22
+
23
+ 1. Sign up at [vly.ai](https://vly.ai) and create a deployment
24
+ 2. Get your deployment token from the dashboard
25
+ 3. Set it as an environment variable: `VLY_INTEGRATION_KEY`
16
26
 
17
27
  ## Usage
18
28
 
19
29
  ```typescript
20
- import { createVlyIntegrations } from 'vly-integrations';
30
+ import { createVlyIntegrations } from '@vly-ai/integrations';
21
31
 
22
32
  const vly = createVlyIntegrations({
23
- deploymentToken: process.env.VLY_INTEGRATION_KEY, // Uses VLY_INTEGRATION_KEY env var
33
+ deploymentToken: process.env.VLY_INTEGRATION_KEY,
24
34
  debug: false // optional
25
35
  });
26
36
 
@@ -50,25 +60,15 @@ const emailResult = await vly.email.send({
50
60
  html: '<h1>Welcome to our service!</h1>',
51
61
  text: 'Welcome to our service!'
52
62
  });
53
-
54
- // Create Payment Intent
55
- const paymentIntent = await vly.payments.createPaymentIntent({
56
- amount: 2000, // $20.00 in cents
57
- currency: 'usd',
58
- description: 'Premium subscription',
59
- customer: {
60
- email: 'customer@example.com'
61
- }
62
- });
63
63
  ```
64
64
 
65
65
  ## AI Gateway Integration
66
66
 
67
- Powered by the AI SDK with OpenAI-compatible provider for https://ai-gateway.vly.ai
67
+ Powered by the AI SDK with OpenAI-compatible provider for https://integrations.vly.ai
68
68
 
69
69
  ### Supported Models
70
70
 
71
- The vly-integrations package supports **all models available through the Vercel AI Gateway**. This includes but is not limited to:
71
+ The @vly-ai/integrations package supports **all models available through the Vercel AI Gateway**. This includes but is not limited to:
72
72
 
73
73
  - **OpenAI Models**: GPT-5, GPT-5 Mini, GPT-5 Nano, GPT-4, GPT-3.5, etc.
74
74
  - **Anthropic Claude**: Claude 4 Opus, Claude 4 Sonnet, Claude 3.7, Claude 3.5, Haiku, etc.
@@ -147,37 +147,6 @@ vly.email.verifyDomain(domain: string): Promise<ApiResponse>
147
147
  vly.email.listDomains(): Promise<ApiResponse>
148
148
  ```
149
149
 
150
- ### Payments Integration
151
-
152
- ```typescript
153
- // Payment Intents
154
- vly.payments.createPaymentIntent(intent: PaymentIntent): Promise<ApiResponse<PaymentIntentResponse>>
155
- vly.payments.confirmPaymentIntent(intentId: string, paymentMethodId: string): Promise<ApiResponse>
156
- vly.payments.getPaymentIntent(intentId: string): Promise<ApiResponse>
157
- vly.payments.cancelPaymentIntent(intentId: string): Promise<ApiResponse>
158
-
159
- // Subscriptions
160
- vly.payments.createSubscription(subscription: Subscription): Promise<ApiResponse<SubscriptionResponse>>
161
- vly.payments.updateSubscription(id: string, updates: Partial<Subscription>): Promise<ApiResponse>
162
- vly.payments.cancelSubscription(id: string, immediately?: boolean): Promise<ApiResponse>
163
- vly.payments.getSubscription(id: string): Promise<ApiResponse>
164
- vly.payments.listSubscriptions(customerId?: string): Promise<ApiResponse>
165
-
166
- // Checkout & Portal
167
- vly.payments.createCheckoutSession(session: CheckoutSession): Promise<ApiResponse>
168
- vly.payments.createCustomerPortal(session: CustomerPortalSession): Promise<ApiResponse>
169
-
170
- // Customer Management
171
- vly.payments.createCustomer(customer: Customer): Promise<ApiResponse>
172
- vly.payments.getCustomer(customerId: string): Promise<ApiResponse>
173
- vly.payments.updateCustomer(customerId: string, updates: CustomerUpdate): Promise<ApiResponse>
174
-
175
- // Payment Methods
176
- vly.payments.listPaymentMethods(customerId: string): Promise<ApiResponse>
177
- vly.payments.attachPaymentMethod(methodId: string, customerId: string): Promise<ApiResponse>
178
- vly.payments.detachPaymentMethod(methodId: string): Promise<ApiResponse>
179
- ```
180
-
181
150
  ## Error Handling
182
151
 
183
152
  All methods return an `ApiResponse` object with the following structure:
@@ -227,15 +196,6 @@ const vly = createVlyIntegrations({
227
196
  });
228
197
  ```
229
198
 
230
- ## What's New in v0.2.0
231
-
232
- - ✅ **AI SDK Integration**: Now powered by `@ai-sdk/openai-compatible` for better reliability
233
- - ✅ **No more axios**: Replaced with built-in fetch for lighter weight
234
- - ✅ **New AI models**: Support for GPT-5, Claude 4, and Claude 3.7 models
235
- - ✅ **Direct AI SDK access**: Get the provider for advanced AI SDK usage
236
- - ✅ **Better streaming**: Improved streaming support with AI SDK
237
- - ✅ **Type safety**: Enhanced TypeScript support
238
-
239
199
  ## Billing
240
200
 
241
201
  All API calls are automatically billed to your deployment based on usage. The billing happens transparently through your deployment token, and usage information is included in the API responses.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as _ai_sdk_openai_compatible from '@ai-sdk/openai-compatible';
2
2
  export { CoreMessage } from 'ai';
3
+ export { ScreenshotMessage, initScreenshotListener, initVly } from './project-thumbnail/index.mjs';
3
4
 
4
5
  interface VlyConfig {
5
- deploymentToken: string;
6
+ deploymentToken?: string;
6
7
  debug?: boolean;
7
8
  }
8
9
  interface RequestOptions {
@@ -65,53 +66,6 @@ interface EmailResponse {
65
66
  messageId?: string;
66
67
  error?: string;
67
68
  }
68
- interface PaymentIntent {
69
- amount: number;
70
- currency?: string;
71
- description?: string;
72
- metadata?: Record<string, any>;
73
- customer?: {
74
- email?: string;
75
- name?: string;
76
- id?: string;
77
- };
78
- }
79
- interface PaymentIntentResponse {
80
- id: string;
81
- clientSecret: string;
82
- amount: number;
83
- currency: string;
84
- status: 'requires_payment_method' | 'requires_confirmation' | 'succeeded' | 'processing' | 'canceled';
85
- paymentMethodTypes: string[];
86
- }
87
- interface Subscription {
88
- customerId: string;
89
- priceId: string;
90
- metadata?: Record<string, any>;
91
- trialPeriodDays?: number;
92
- cancelAtPeriodEnd?: boolean;
93
- }
94
- interface SubscriptionResponse {
95
- id: string;
96
- customerId: string;
97
- status: 'active' | 'past_due' | 'canceled' | 'incomplete' | 'trialing';
98
- currentPeriodEnd: string;
99
- items: Array<{
100
- id: string;
101
- priceId: string;
102
- quantity: number;
103
- }>;
104
- }
105
- interface CustomerPortalSession {
106
- customerId: string;
107
- returnUrl?: string;
108
- }
109
- interface CustomerPortalResponse {
110
- id: string;
111
- url: string;
112
- returnUrl?: string;
113
- created: number;
114
- }
115
69
 
116
70
  declare class VlyAI {
117
71
  private provider;
@@ -159,95 +113,12 @@ declare class VlyEmail extends VlyClient {
159
113
  }>>>;
160
114
  }
161
115
 
162
- declare class VlyPayments extends VlyClient {
163
- createPaymentIntent(intent: PaymentIntent, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
164
- confirmPaymentIntent(intentId: string, paymentMethodId: string, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
165
- getPaymentIntent(intentId: string, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
166
- cancelPaymentIntent(intentId: string, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
167
- createSubscription(subscription: Subscription, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
168
- updateSubscription(subscriptionId: string, updates: Partial<Subscription>, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
169
- cancelSubscription(subscriptionId: string, immediately?: boolean, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
170
- getSubscription(subscriptionId: string, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
171
- listSubscriptions(customerId?: string, options?: RequestOptions & {
172
- limit?: number;
173
- offset?: number;
174
- }): Promise<ApiResponse<{
175
- subscriptions: SubscriptionResponse[];
176
- hasMore: boolean;
177
- total: number;
178
- }>>;
179
- createCustomerPortal(session: CustomerPortalSession, options?: RequestOptions): Promise<ApiResponse<CustomerPortalResponse>>;
180
- createCheckoutSession(session: {
181
- customerId?: string;
182
- customerEmail?: string;
183
- lineItems: Array<{
184
- priceId: string;
185
- quantity: number;
186
- }>;
187
- mode: 'payment' | 'subscription';
188
- successUrl: string;
189
- cancelUrl: string;
190
- metadata?: Record<string, any>;
191
- }, options?: RequestOptions): Promise<ApiResponse<{
192
- id: string;
193
- url: string;
194
- }>>;
195
- createCustomer(customer: {
196
- email: string;
197
- name?: string;
198
- metadata?: Record<string, any>;
199
- }, options?: RequestOptions): Promise<ApiResponse<{
200
- id: string;
201
- email: string;
202
- name?: string;
203
- created: number;
204
- }>>;
205
- getCustomer(customerId: string, options?: RequestOptions): Promise<ApiResponse<{
206
- id: string;
207
- email: string;
208
- name?: string;
209
- created: number;
210
- metadata?: Record<string, any>;
211
- }>>;
212
- updateCustomer(customerId: string, updates: {
213
- email?: string;
214
- name?: string;
215
- metadata?: Record<string, any>;
216
- }, options?: RequestOptions): Promise<ApiResponse<{
217
- id: string;
218
- email: string;
219
- name?: string;
220
- created: number;
221
- metadata?: Record<string, any>;
222
- }>>;
223
- listPaymentMethods(customerId: string, options?: RequestOptions): Promise<ApiResponse<Array<{
224
- id: string;
225
- type: string;
226
- card?: {
227
- brand: string;
228
- last4: string;
229
- expMonth: number;
230
- expYear: number;
231
- };
232
- created: number;
233
- }>>>;
234
- attachPaymentMethod(paymentMethodId: string, customerId: string, options?: RequestOptions): Promise<ApiResponse<{
235
- id: string;
236
- customerId: string;
237
- attached: boolean;
238
- }>>;
239
- detachPaymentMethod(paymentMethodId: string, options?: RequestOptions): Promise<ApiResponse<{
240
- id: string;
241
- detached: boolean;
242
- }>>;
243
- }
244
-
245
116
  declare class VlyIntegrations {
246
- ai: VlyAI;
247
- email: VlyEmail;
248
- payments: VlyPayments;
117
+ readonly ai: VlyAI;
118
+ readonly email: VlyEmail;
119
+ readonly config: Required<VlyConfig>;
249
120
  constructor(config: VlyConfig);
250
121
  }
251
122
  declare function createVlyIntegrations(config: VlyConfig): VlyIntegrations;
252
123
 
253
- export { type AICompletionRequest, type AICompletionResponse, type AIModel, type ApiResponse, type CustomerPortalResponse, type CustomerPortalSession, type EmailRequest, type EmailResponse, type PaymentIntent, type PaymentIntentResponse, type RequestOptions, type Subscription, type SubscriptionResponse, VlyAI, type VlyConfig, VlyEmail, VlyIntegrations, VlyPayments, createVlyIntegrations };
124
+ export { type AICompletionRequest, type AICompletionResponse, type AIModel, type ApiResponse, type EmailRequest, type EmailResponse, type RequestOptions, VlyAI, type VlyConfig, VlyEmail, VlyIntegrations, createVlyIntegrations };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as _ai_sdk_openai_compatible from '@ai-sdk/openai-compatible';
2
2
  export { CoreMessage } from 'ai';
3
+ export { ScreenshotMessage, initScreenshotListener, initVly } from './project-thumbnail/index.js';
3
4
 
4
5
  interface VlyConfig {
5
- deploymentToken: string;
6
+ deploymentToken?: string;
6
7
  debug?: boolean;
7
8
  }
8
9
  interface RequestOptions {
@@ -65,53 +66,6 @@ interface EmailResponse {
65
66
  messageId?: string;
66
67
  error?: string;
67
68
  }
68
- interface PaymentIntent {
69
- amount: number;
70
- currency?: string;
71
- description?: string;
72
- metadata?: Record<string, any>;
73
- customer?: {
74
- email?: string;
75
- name?: string;
76
- id?: string;
77
- };
78
- }
79
- interface PaymentIntentResponse {
80
- id: string;
81
- clientSecret: string;
82
- amount: number;
83
- currency: string;
84
- status: 'requires_payment_method' | 'requires_confirmation' | 'succeeded' | 'processing' | 'canceled';
85
- paymentMethodTypes: string[];
86
- }
87
- interface Subscription {
88
- customerId: string;
89
- priceId: string;
90
- metadata?: Record<string, any>;
91
- trialPeriodDays?: number;
92
- cancelAtPeriodEnd?: boolean;
93
- }
94
- interface SubscriptionResponse {
95
- id: string;
96
- customerId: string;
97
- status: 'active' | 'past_due' | 'canceled' | 'incomplete' | 'trialing';
98
- currentPeriodEnd: string;
99
- items: Array<{
100
- id: string;
101
- priceId: string;
102
- quantity: number;
103
- }>;
104
- }
105
- interface CustomerPortalSession {
106
- customerId: string;
107
- returnUrl?: string;
108
- }
109
- interface CustomerPortalResponse {
110
- id: string;
111
- url: string;
112
- returnUrl?: string;
113
- created: number;
114
- }
115
69
 
116
70
  declare class VlyAI {
117
71
  private provider;
@@ -159,95 +113,12 @@ declare class VlyEmail extends VlyClient {
159
113
  }>>>;
160
114
  }
161
115
 
162
- declare class VlyPayments extends VlyClient {
163
- createPaymentIntent(intent: PaymentIntent, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
164
- confirmPaymentIntent(intentId: string, paymentMethodId: string, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
165
- getPaymentIntent(intentId: string, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
166
- cancelPaymentIntent(intentId: string, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
167
- createSubscription(subscription: Subscription, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
168
- updateSubscription(subscriptionId: string, updates: Partial<Subscription>, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
169
- cancelSubscription(subscriptionId: string, immediately?: boolean, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
170
- getSubscription(subscriptionId: string, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
171
- listSubscriptions(customerId?: string, options?: RequestOptions & {
172
- limit?: number;
173
- offset?: number;
174
- }): Promise<ApiResponse<{
175
- subscriptions: SubscriptionResponse[];
176
- hasMore: boolean;
177
- total: number;
178
- }>>;
179
- createCustomerPortal(session: CustomerPortalSession, options?: RequestOptions): Promise<ApiResponse<CustomerPortalResponse>>;
180
- createCheckoutSession(session: {
181
- customerId?: string;
182
- customerEmail?: string;
183
- lineItems: Array<{
184
- priceId: string;
185
- quantity: number;
186
- }>;
187
- mode: 'payment' | 'subscription';
188
- successUrl: string;
189
- cancelUrl: string;
190
- metadata?: Record<string, any>;
191
- }, options?: RequestOptions): Promise<ApiResponse<{
192
- id: string;
193
- url: string;
194
- }>>;
195
- createCustomer(customer: {
196
- email: string;
197
- name?: string;
198
- metadata?: Record<string, any>;
199
- }, options?: RequestOptions): Promise<ApiResponse<{
200
- id: string;
201
- email: string;
202
- name?: string;
203
- created: number;
204
- }>>;
205
- getCustomer(customerId: string, options?: RequestOptions): Promise<ApiResponse<{
206
- id: string;
207
- email: string;
208
- name?: string;
209
- created: number;
210
- metadata?: Record<string, any>;
211
- }>>;
212
- updateCustomer(customerId: string, updates: {
213
- email?: string;
214
- name?: string;
215
- metadata?: Record<string, any>;
216
- }, options?: RequestOptions): Promise<ApiResponse<{
217
- id: string;
218
- email: string;
219
- name?: string;
220
- created: number;
221
- metadata?: Record<string, any>;
222
- }>>;
223
- listPaymentMethods(customerId: string, options?: RequestOptions): Promise<ApiResponse<Array<{
224
- id: string;
225
- type: string;
226
- card?: {
227
- brand: string;
228
- last4: string;
229
- expMonth: number;
230
- expYear: number;
231
- };
232
- created: number;
233
- }>>>;
234
- attachPaymentMethod(paymentMethodId: string, customerId: string, options?: RequestOptions): Promise<ApiResponse<{
235
- id: string;
236
- customerId: string;
237
- attached: boolean;
238
- }>>;
239
- detachPaymentMethod(paymentMethodId: string, options?: RequestOptions): Promise<ApiResponse<{
240
- id: string;
241
- detached: boolean;
242
- }>>;
243
- }
244
-
245
116
  declare class VlyIntegrations {
246
- ai: VlyAI;
247
- email: VlyEmail;
248
- payments: VlyPayments;
117
+ readonly ai: VlyAI;
118
+ readonly email: VlyEmail;
119
+ readonly config: Required<VlyConfig>;
249
120
  constructor(config: VlyConfig);
250
121
  }
251
122
  declare function createVlyIntegrations(config: VlyConfig): VlyIntegrations;
252
123
 
253
- export { type AICompletionRequest, type AICompletionResponse, type AIModel, type ApiResponse, type CustomerPortalResponse, type CustomerPortalSession, type EmailRequest, type EmailResponse, type PaymentIntent, type PaymentIntentResponse, type RequestOptions, type Subscription, type SubscriptionResponse, VlyAI, type VlyConfig, VlyEmail, VlyIntegrations, VlyPayments, createVlyIntegrations };
124
+ export { type AICompletionRequest, type AICompletionResponse, type AIModel, type ApiResponse, type EmailRequest, type EmailResponse, type RequestOptions, VlyAI, type VlyConfig, VlyEmail, VlyIntegrations, createVlyIntegrations };