@lavapayments/nodejs 5.3.1 → 5.3.2

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/dist/index.d.mts CHANGED
@@ -1,98 +1,5 @@
1
- type ApiVersion = "2025-04-28.v1";
2
- interface Config {
3
- apiVersion: ApiVersion;
4
- /**
5
- * Base URL for the API.
6
- * If not provided, it will be inferred from the secret key (production or sandbox).
7
- */
8
- baseUrl?: string;
9
- }
10
- type ForwardTokenOptions = {
11
- connection_secret: string;
12
- product_secret: string;
13
- provider_key?: string;
14
- } | {
15
- connection_secret: null;
16
- product_secret: null;
17
- provider_key: string;
18
- };
19
- declare class Lava {
20
- private readonly secretKey;
21
- private readonly baseUrl;
22
- private readonly apiVersion;
23
- /**
24
- * The checkout sessions resource
25
- */
26
- readonly checkoutSessions: Resources.CheckoutSessionsResource;
27
- /**
28
- * The connections resource
29
- */
30
- readonly connections: Resources.ConnectionsResource;
31
- /**
32
- * The requests resource
33
- */
34
- readonly requests: Resources.RequestsResource;
35
- /**
36
- * The usage resource
37
- */
38
- readonly usage: Resources.UsageResource;
39
- /**
40
- * Provider URLs for convenience
41
- */
42
- readonly providers: {
43
- openai: string;
44
- anthropic: string;
45
- mistral: string;
46
- deepseek: string;
47
- xai: string;
48
- google: string;
49
- googleOpenaiCompatible: string;
50
- kluster: string;
51
- inference: string;
52
- groq: string;
53
- novita: string;
54
- vercel: string;
55
- together: string;
56
- hyperbolic: string;
57
- elevenlabs: string;
58
- sambanova: string;
59
- deepinfra: string;
60
- cohere: string;
61
- parasail: string;
62
- nebius: string;
63
- fireworks: string;
64
- cerebras: string;
65
- targon: string;
66
- gmicloud: string;
67
- chutes: string;
68
- };
69
- /**
70
- * Create a new Lava client
71
- * @param secretKey Your Lava secret key
72
- * @param config Configuration options
73
- */
74
- constructor(secretKey: string, config: Config);
75
- /**
76
- * Make a request to the Lava API
77
- * @param method HTTP method
78
- * @param path API path
79
- * @param options Request options
80
- * @returns Response data
81
- */
82
- request<T>(method: string, path: string, { data, query }?: {
83
- data?: any;
84
- query?: Record<string, string>;
85
- }): Promise<T>;
86
- /**
87
- * Generate a token for the forward endpoint
88
- * @param options Token options
89
- * @returns Base64 encoded token
90
- */
91
- generateForwardToken(options: ForwardTokenOptions): string;
92
- }
93
-
94
1
  interface CreateCheckoutSessionParams {
95
- checkout_mode: "onboarding" | "topup";
2
+ checkout_mode: 'onboarding' | 'topup';
96
3
  origin_url: string;
97
4
  reference_id?: string;
98
5
  connection_id?: string;
@@ -146,7 +53,7 @@ interface ListResponse<T> {
146
53
  type RestCheckoutSession = {
147
54
  checkout_session_id: string;
148
55
  checkout_session_token: string;
149
- checkout_mode: "onboarding" | "topup";
56
+ checkout_mode: 'onboarding' | 'topup';
150
57
  origin_url: string;
151
58
  connection_id?: string;
152
59
  reference_id?: string;
@@ -171,11 +78,11 @@ type RestConnection = {
171
78
  };
172
79
  type RestRequest = {
173
80
  request_id: string;
174
- status: "pending" | "completed" | "error";
81
+ status: 'pending' | 'completed' | 'error';
175
82
  connection_id?: string;
176
83
  product_id?: string;
177
84
  provider: string;
178
- provider_key_type: "managed" | "unmanaged";
85
+ provider_key_type: 'managed' | 'unmanaged';
179
86
  model?: string;
180
87
  endpoint: string;
181
88
  response_id?: string;
@@ -192,17 +99,17 @@ type RestRequest = {
192
99
  input_cost: string;
193
100
  output_cost: string;
194
101
  total_cost: string;
195
- payer: "wallet" | "merchant";
102
+ payer: 'wallet' | 'merchant';
196
103
  };
197
104
  fee: {
198
105
  amount: string;
199
- rate_type: "fixed" | "percentage";
200
- token_basis: "input+output" | "output";
106
+ rate_type: 'fixed' | 'percentage';
107
+ token_basis: 'input+output' | 'output';
201
108
  breakdown: {
202
109
  tier: {
203
110
  start: number;
204
111
  rate: string;
205
- type: "tokens_1m" | "characters_1m" | "minutes" | "requests";
112
+ type: 'tokens_1m' | 'characters_1m' | 'minutes' | 'requests';
206
113
  };
207
114
  tokens: number;
208
115
  characters: number;
@@ -212,7 +119,7 @@ type RestRequest = {
212
119
  };
213
120
  service_charge: {
214
121
  amount: string;
215
- payer: "wallet" | "merchant";
122
+ payer: 'wallet' | 'merchant';
216
123
  };
217
124
  total_request_cost: string;
218
125
  total_wallet_cost: string;
@@ -247,6 +154,8 @@ type RestUsage = {
247
154
  };
248
155
  };
249
156
 
157
+ /** biome-ignore-all lint/style/noNamespace: <explanation> */
158
+
250
159
  declare namespace Resources {
251
160
  abstract class BaseResource {
252
161
  protected lava: Lava;
@@ -337,4 +246,98 @@ declare namespace Resources {
337
246
  export { };
338
247
  }
339
248
 
249
+ type ApiVersion = '2025-04-28.v1';
250
+ interface Config {
251
+ apiVersion: ApiVersion;
252
+ /**
253
+ * Base URL for the API.
254
+ * If not provided, it will be inferred from the secret key (production or sandbox).
255
+ */
256
+ baseUrl?: string;
257
+ }
258
+ type ForwardTokenOptions = {
259
+ connection_secret: string;
260
+ product_secret: string;
261
+ provider_key?: string;
262
+ } | {
263
+ connection_secret: null;
264
+ product_secret: null;
265
+ provider_key: string;
266
+ };
267
+ declare class Lava {
268
+ private readonly secretKey;
269
+ private readonly baseUrl;
270
+ private readonly apiVersion;
271
+ /**
272
+ * The checkout sessions resource
273
+ */
274
+ readonly checkoutSessions: Resources.CheckoutSessionsResource;
275
+ /**
276
+ * The connections resource
277
+ */
278
+ readonly connections: Resources.ConnectionsResource;
279
+ /**
280
+ * The requests resource
281
+ */
282
+ readonly requests: Resources.RequestsResource;
283
+ /**
284
+ * The usage resource
285
+ */
286
+ readonly usage: Resources.UsageResource;
287
+ /**
288
+ * Provider URLs for convenience
289
+ */
290
+ readonly providers: {
291
+ openai: string;
292
+ anthropic: string;
293
+ mistral: string;
294
+ deepseek: string;
295
+ xai: string;
296
+ google: string;
297
+ googleOpenaiCompatible: string;
298
+ kluster: string;
299
+ inference: string;
300
+ groq: string;
301
+ novita: string;
302
+ vercel: string;
303
+ together: string;
304
+ hyperbolic: string;
305
+ elevenlabs: string;
306
+ sambanova: string;
307
+ deepinfra: string;
308
+ cohere: string;
309
+ parasail: string;
310
+ nebius: string;
311
+ fireworks: string;
312
+ cerebras: string;
313
+ targon: string;
314
+ gmicloud: string;
315
+ chutes: string;
316
+ baseten: string;
317
+ };
318
+ /**
319
+ * Create a new Lava client
320
+ * @param secretKey Your Lava secret key
321
+ * @param config Configuration options
322
+ */
323
+ constructor(secretKey: string, config: Config);
324
+ /**
325
+ * Make a request to the Lava API
326
+ * @param method HTTP method
327
+ * @param path API path
328
+ * @param options Request options
329
+ * @returns Response data
330
+ */
331
+ request<T>(method: string, path: string, { data, query }?: {
332
+ data?: any;
333
+ query?: Record<string, string>;
334
+ }): Promise<T>;
335
+ /**
336
+ * Generate a token for the forward endpoint
337
+ * @param options Token options
338
+ * @returns Base64 encoded token
339
+ */
340
+ generateForwardToken(options: ForwardTokenOptions): string;
341
+ }
342
+
340
343
  export { type ApiVersion, type CheckoutSessionsListParams, type Config, type ConnectionsListParams, type CreateCheckoutSessionParams, type CreateRequestParams, type ForwardTokenOptions, Lava, type ListResponse, type RequestsListParams, type RequestsListResponse, Resources, type RestCheckoutSession, type RestConnection, type RestRequest, type RestUsage, type UsageParams };
package/dist/index.d.ts CHANGED
@@ -1,98 +1,5 @@
1
- type ApiVersion = "2025-04-28.v1";
2
- interface Config {
3
- apiVersion: ApiVersion;
4
- /**
5
- * Base URL for the API.
6
- * If not provided, it will be inferred from the secret key (production or sandbox).
7
- */
8
- baseUrl?: string;
9
- }
10
- type ForwardTokenOptions = {
11
- connection_secret: string;
12
- product_secret: string;
13
- provider_key?: string;
14
- } | {
15
- connection_secret: null;
16
- product_secret: null;
17
- provider_key: string;
18
- };
19
- declare class Lava {
20
- private readonly secretKey;
21
- private readonly baseUrl;
22
- private readonly apiVersion;
23
- /**
24
- * The checkout sessions resource
25
- */
26
- readonly checkoutSessions: Resources.CheckoutSessionsResource;
27
- /**
28
- * The connections resource
29
- */
30
- readonly connections: Resources.ConnectionsResource;
31
- /**
32
- * The requests resource
33
- */
34
- readonly requests: Resources.RequestsResource;
35
- /**
36
- * The usage resource
37
- */
38
- readonly usage: Resources.UsageResource;
39
- /**
40
- * Provider URLs for convenience
41
- */
42
- readonly providers: {
43
- openai: string;
44
- anthropic: string;
45
- mistral: string;
46
- deepseek: string;
47
- xai: string;
48
- google: string;
49
- googleOpenaiCompatible: string;
50
- kluster: string;
51
- inference: string;
52
- groq: string;
53
- novita: string;
54
- vercel: string;
55
- together: string;
56
- hyperbolic: string;
57
- elevenlabs: string;
58
- sambanova: string;
59
- deepinfra: string;
60
- cohere: string;
61
- parasail: string;
62
- nebius: string;
63
- fireworks: string;
64
- cerebras: string;
65
- targon: string;
66
- gmicloud: string;
67
- chutes: string;
68
- };
69
- /**
70
- * Create a new Lava client
71
- * @param secretKey Your Lava secret key
72
- * @param config Configuration options
73
- */
74
- constructor(secretKey: string, config: Config);
75
- /**
76
- * Make a request to the Lava API
77
- * @param method HTTP method
78
- * @param path API path
79
- * @param options Request options
80
- * @returns Response data
81
- */
82
- request<T>(method: string, path: string, { data, query }?: {
83
- data?: any;
84
- query?: Record<string, string>;
85
- }): Promise<T>;
86
- /**
87
- * Generate a token for the forward endpoint
88
- * @param options Token options
89
- * @returns Base64 encoded token
90
- */
91
- generateForwardToken(options: ForwardTokenOptions): string;
92
- }
93
-
94
1
  interface CreateCheckoutSessionParams {
95
- checkout_mode: "onboarding" | "topup";
2
+ checkout_mode: 'onboarding' | 'topup';
96
3
  origin_url: string;
97
4
  reference_id?: string;
98
5
  connection_id?: string;
@@ -146,7 +53,7 @@ interface ListResponse<T> {
146
53
  type RestCheckoutSession = {
147
54
  checkout_session_id: string;
148
55
  checkout_session_token: string;
149
- checkout_mode: "onboarding" | "topup";
56
+ checkout_mode: 'onboarding' | 'topup';
150
57
  origin_url: string;
151
58
  connection_id?: string;
152
59
  reference_id?: string;
@@ -171,11 +78,11 @@ type RestConnection = {
171
78
  };
172
79
  type RestRequest = {
173
80
  request_id: string;
174
- status: "pending" | "completed" | "error";
81
+ status: 'pending' | 'completed' | 'error';
175
82
  connection_id?: string;
176
83
  product_id?: string;
177
84
  provider: string;
178
- provider_key_type: "managed" | "unmanaged";
85
+ provider_key_type: 'managed' | 'unmanaged';
179
86
  model?: string;
180
87
  endpoint: string;
181
88
  response_id?: string;
@@ -192,17 +99,17 @@ type RestRequest = {
192
99
  input_cost: string;
193
100
  output_cost: string;
194
101
  total_cost: string;
195
- payer: "wallet" | "merchant";
102
+ payer: 'wallet' | 'merchant';
196
103
  };
197
104
  fee: {
198
105
  amount: string;
199
- rate_type: "fixed" | "percentage";
200
- token_basis: "input+output" | "output";
106
+ rate_type: 'fixed' | 'percentage';
107
+ token_basis: 'input+output' | 'output';
201
108
  breakdown: {
202
109
  tier: {
203
110
  start: number;
204
111
  rate: string;
205
- type: "tokens_1m" | "characters_1m" | "minutes" | "requests";
112
+ type: 'tokens_1m' | 'characters_1m' | 'minutes' | 'requests';
206
113
  };
207
114
  tokens: number;
208
115
  characters: number;
@@ -212,7 +119,7 @@ type RestRequest = {
212
119
  };
213
120
  service_charge: {
214
121
  amount: string;
215
- payer: "wallet" | "merchant";
122
+ payer: 'wallet' | 'merchant';
216
123
  };
217
124
  total_request_cost: string;
218
125
  total_wallet_cost: string;
@@ -247,6 +154,8 @@ type RestUsage = {
247
154
  };
248
155
  };
249
156
 
157
+ /** biome-ignore-all lint/style/noNamespace: <explanation> */
158
+
250
159
  declare namespace Resources {
251
160
  abstract class BaseResource {
252
161
  protected lava: Lava;
@@ -337,4 +246,98 @@ declare namespace Resources {
337
246
  export { };
338
247
  }
339
248
 
249
+ type ApiVersion = '2025-04-28.v1';
250
+ interface Config {
251
+ apiVersion: ApiVersion;
252
+ /**
253
+ * Base URL for the API.
254
+ * If not provided, it will be inferred from the secret key (production or sandbox).
255
+ */
256
+ baseUrl?: string;
257
+ }
258
+ type ForwardTokenOptions = {
259
+ connection_secret: string;
260
+ product_secret: string;
261
+ provider_key?: string;
262
+ } | {
263
+ connection_secret: null;
264
+ product_secret: null;
265
+ provider_key: string;
266
+ };
267
+ declare class Lava {
268
+ private readonly secretKey;
269
+ private readonly baseUrl;
270
+ private readonly apiVersion;
271
+ /**
272
+ * The checkout sessions resource
273
+ */
274
+ readonly checkoutSessions: Resources.CheckoutSessionsResource;
275
+ /**
276
+ * The connections resource
277
+ */
278
+ readonly connections: Resources.ConnectionsResource;
279
+ /**
280
+ * The requests resource
281
+ */
282
+ readonly requests: Resources.RequestsResource;
283
+ /**
284
+ * The usage resource
285
+ */
286
+ readonly usage: Resources.UsageResource;
287
+ /**
288
+ * Provider URLs for convenience
289
+ */
290
+ readonly providers: {
291
+ openai: string;
292
+ anthropic: string;
293
+ mistral: string;
294
+ deepseek: string;
295
+ xai: string;
296
+ google: string;
297
+ googleOpenaiCompatible: string;
298
+ kluster: string;
299
+ inference: string;
300
+ groq: string;
301
+ novita: string;
302
+ vercel: string;
303
+ together: string;
304
+ hyperbolic: string;
305
+ elevenlabs: string;
306
+ sambanova: string;
307
+ deepinfra: string;
308
+ cohere: string;
309
+ parasail: string;
310
+ nebius: string;
311
+ fireworks: string;
312
+ cerebras: string;
313
+ targon: string;
314
+ gmicloud: string;
315
+ chutes: string;
316
+ baseten: string;
317
+ };
318
+ /**
319
+ * Create a new Lava client
320
+ * @param secretKey Your Lava secret key
321
+ * @param config Configuration options
322
+ */
323
+ constructor(secretKey: string, config: Config);
324
+ /**
325
+ * Make a request to the Lava API
326
+ * @param method HTTP method
327
+ * @param path API path
328
+ * @param options Request options
329
+ * @returns Response data
330
+ */
331
+ request<T>(method: string, path: string, { data, query }?: {
332
+ data?: any;
333
+ query?: Record<string, string>;
334
+ }): Promise<T>;
335
+ /**
336
+ * Generate a token for the forward endpoint
337
+ * @param options Token options
338
+ * @returns Base64 encoded token
339
+ */
340
+ generateForwardToken(options: ForwardTokenOptions): string;
341
+ }
342
+
340
343
  export { type ApiVersion, type CheckoutSessionsListParams, type Config, type ConnectionsListParams, type CreateCheckoutSessionParams, type CreateRequestParams, type ForwardTokenOptions, Lava, type ListResponse, type RequestsListParams, type RequestsListResponse, Resources, type RestCheckoutSession, type RestConnection, type RestRequest, type RestUsage, type UsageParams };
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ var Resources;
39
39
  * @param params Checkout session parameters
40
40
  * @returns Created checkout session
41
41
  */
42
- async create(params) {
42
+ create(params) {
43
43
  return this.lava.request(
44
44
  "POST",
45
45
  "checkout_sessions",
@@ -53,12 +53,18 @@ var Resources;
53
53
  * @param params List parameters
54
54
  * @returns Paginated list of checkout sessions
55
55
  */
56
- async list(params) {
56
+ list(params) {
57
57
  const queryParams = {};
58
58
  if (params) {
59
- if (params.cursor) queryParams.cursor = params.cursor;
60
- if (params.limit) queryParams.limit = params.limit.toString();
61
- if (params.reference_id) queryParams.reference_id = params.reference_id;
59
+ if (params.cursor) {
60
+ queryParams.cursor = params.cursor;
61
+ }
62
+ if (params.limit) {
63
+ queryParams.limit = params.limit.toString();
64
+ }
65
+ if (params.reference_id) {
66
+ queryParams.reference_id = params.reference_id;
67
+ }
62
68
  }
63
69
  return this.lava.request(
64
70
  "GET",
@@ -73,7 +79,7 @@ var Resources;
73
79
  * @param checkoutSessionId Checkout session ID
74
80
  * @returns Checkout session details
75
81
  */
76
- async retrieve(checkoutSessionId) {
82
+ retrieve(checkoutSessionId) {
77
83
  return this.lava.request(
78
84
  "GET",
79
85
  `checkout_sessions/${checkoutSessionId}`
@@ -87,12 +93,18 @@ var Resources;
87
93
  * @param params List parameters
88
94
  * @returns Paginated list of connections
89
95
  */
90
- async list(params) {
96
+ list(params) {
91
97
  const queryParams = {};
92
98
  if (params) {
93
- if (params.cursor) queryParams.cursor = params.cursor;
94
- if (params.limit) queryParams.limit = params.limit.toString();
95
- if (params.reference_id) queryParams.reference_id = params.reference_id;
99
+ if (params.cursor) {
100
+ queryParams.cursor = params.cursor;
101
+ }
102
+ if (params.limit) {
103
+ queryParams.limit = params.limit.toString();
104
+ }
105
+ if (params.reference_id) {
106
+ queryParams.reference_id = params.reference_id;
107
+ }
96
108
  }
97
109
  return this.lava.request(
98
110
  "GET",
@@ -107,7 +119,7 @@ var Resources;
107
119
  * @param connectionId Connection ID
108
120
  * @returns Connection details
109
121
  */
110
- async retrieve(connectionId) {
122
+ retrieve(connectionId) {
111
123
  return this.lava.request(
112
124
  "GET",
113
125
  `connections/${connectionId}`
@@ -118,7 +130,7 @@ var Resources;
118
130
  * @param connectionId Connection ID
119
131
  * @returns Success status
120
132
  */
121
- async delete(connectionId) {
133
+ delete(connectionId) {
122
134
  return this.lava.request(
123
135
  "DELETE",
124
136
  `connections/${connectionId}`
@@ -132,18 +144,26 @@ var Resources;
132
144
  * @param params List parameters
133
145
  * @returns Paginated list of requests
134
146
  */
135
- async list(params) {
147
+ list(params) {
136
148
  const queryParams = {};
137
149
  if (params) {
138
- if (params.cursor) queryParams.cursor = params.cursor;
139
- if (params.limit) queryParams.limit = params.limit.toString();
140
- if (params.connection_id)
150
+ if (params.cursor) {
151
+ queryParams.cursor = params.cursor;
152
+ }
153
+ if (params.limit) {
154
+ queryParams.limit = params.limit.toString();
155
+ }
156
+ if (params.connection_id) {
141
157
  queryParams.connection_id = params.connection_id;
142
- if (params.product_id) queryParams.product_id = params.product_id;
143
- if (params.metadata_filters)
158
+ }
159
+ if (params.product_id) {
160
+ queryParams.product_id = params.product_id;
161
+ }
162
+ if (params.metadata_filters) {
144
163
  queryParams.metadata_filters = JSON.stringify(
145
164
  Object.entries(params.metadata_filters)
146
165
  );
166
+ }
147
167
  }
148
168
  return this.lava.request("GET", "requests", {
149
169
  query: queryParams
@@ -154,7 +174,7 @@ var Resources;
154
174
  * @param params Request parameters
155
175
  * @returns Created request details
156
176
  */
157
- async create(params) {
177
+ create(params) {
158
178
  return this.lava.request("POST", "requests", {
159
179
  data: params
160
180
  });
@@ -164,7 +184,7 @@ var Resources;
164
184
  * @param requestId Request ID
165
185
  * @returns Request details
166
186
  */
167
- async retrieve(requestId) {
187
+ retrieve(requestId) {
168
188
  return this.lava.request("GET", `requests/${requestId}`);
169
189
  }
170
190
  }
@@ -175,18 +195,24 @@ var Resources;
175
195
  * @param params Usage parameters
176
196
  * @returns Usage data
177
197
  */
178
- async retrieve(params) {
198
+ retrieve(params) {
179
199
  const queryParams = {
180
200
  start: params.start
181
201
  };
182
- if (params.end) queryParams.end = params.end;
183
- if (params.connection_id)
202
+ if (params.end) {
203
+ queryParams.end = params.end;
204
+ }
205
+ if (params.connection_id) {
184
206
  queryParams.connection_id = params.connection_id;
185
- if (params.product_id) queryParams.product_id = params.product_id;
186
- if (params.metadata_filters)
207
+ }
208
+ if (params.product_id) {
209
+ queryParams.product_id = params.product_id;
210
+ }
211
+ if (params.metadata_filters) {
187
212
  queryParams.metadata_filters = JSON.stringify(
188
213
  Object.entries(params.metadata_filters)
189
214
  );
215
+ }
190
216
  return this.lava.request("GET", "usage", {
191
217
  query: queryParams
192
218
  });
@@ -236,7 +262,8 @@ var Lava = class {
236
262
  cerebras: `${this.baseUrl}forward?u=https://api.cerebras.ai/v1`,
237
263
  targon: `${this.baseUrl}forward?u=https://api.targon.com/v1`,
238
264
  gmicloud: `${this.baseUrl}forward?u=https://api.gmi-serving.com/v1`,
239
- chutes: `${this.baseUrl}forward?u=https://llm.chutes.ai/v1`
265
+ chutes: `${this.baseUrl}forward?u=https://llm.chutes.ai/v1`,
266
+ baseten: `${this.baseUrl}forward?u=https://inference.baseten.co/v1`
240
267
  };
241
268
  }
242
269
  /**
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ var Resources;
12
12
  * @param params Checkout session parameters
13
13
  * @returns Created checkout session
14
14
  */
15
- async create(params) {
15
+ create(params) {
16
16
  return this.lava.request(
17
17
  "POST",
18
18
  "checkout_sessions",
@@ -26,12 +26,18 @@ var Resources;
26
26
  * @param params List parameters
27
27
  * @returns Paginated list of checkout sessions
28
28
  */
29
- async list(params) {
29
+ list(params) {
30
30
  const queryParams = {};
31
31
  if (params) {
32
- if (params.cursor) queryParams.cursor = params.cursor;
33
- if (params.limit) queryParams.limit = params.limit.toString();
34
- if (params.reference_id) queryParams.reference_id = params.reference_id;
32
+ if (params.cursor) {
33
+ queryParams.cursor = params.cursor;
34
+ }
35
+ if (params.limit) {
36
+ queryParams.limit = params.limit.toString();
37
+ }
38
+ if (params.reference_id) {
39
+ queryParams.reference_id = params.reference_id;
40
+ }
35
41
  }
36
42
  return this.lava.request(
37
43
  "GET",
@@ -46,7 +52,7 @@ var Resources;
46
52
  * @param checkoutSessionId Checkout session ID
47
53
  * @returns Checkout session details
48
54
  */
49
- async retrieve(checkoutSessionId) {
55
+ retrieve(checkoutSessionId) {
50
56
  return this.lava.request(
51
57
  "GET",
52
58
  `checkout_sessions/${checkoutSessionId}`
@@ -60,12 +66,18 @@ var Resources;
60
66
  * @param params List parameters
61
67
  * @returns Paginated list of connections
62
68
  */
63
- async list(params) {
69
+ list(params) {
64
70
  const queryParams = {};
65
71
  if (params) {
66
- if (params.cursor) queryParams.cursor = params.cursor;
67
- if (params.limit) queryParams.limit = params.limit.toString();
68
- if (params.reference_id) queryParams.reference_id = params.reference_id;
72
+ if (params.cursor) {
73
+ queryParams.cursor = params.cursor;
74
+ }
75
+ if (params.limit) {
76
+ queryParams.limit = params.limit.toString();
77
+ }
78
+ if (params.reference_id) {
79
+ queryParams.reference_id = params.reference_id;
80
+ }
69
81
  }
70
82
  return this.lava.request(
71
83
  "GET",
@@ -80,7 +92,7 @@ var Resources;
80
92
  * @param connectionId Connection ID
81
93
  * @returns Connection details
82
94
  */
83
- async retrieve(connectionId) {
95
+ retrieve(connectionId) {
84
96
  return this.lava.request(
85
97
  "GET",
86
98
  `connections/${connectionId}`
@@ -91,7 +103,7 @@ var Resources;
91
103
  * @param connectionId Connection ID
92
104
  * @returns Success status
93
105
  */
94
- async delete(connectionId) {
106
+ delete(connectionId) {
95
107
  return this.lava.request(
96
108
  "DELETE",
97
109
  `connections/${connectionId}`
@@ -105,18 +117,26 @@ var Resources;
105
117
  * @param params List parameters
106
118
  * @returns Paginated list of requests
107
119
  */
108
- async list(params) {
120
+ list(params) {
109
121
  const queryParams = {};
110
122
  if (params) {
111
- if (params.cursor) queryParams.cursor = params.cursor;
112
- if (params.limit) queryParams.limit = params.limit.toString();
113
- if (params.connection_id)
123
+ if (params.cursor) {
124
+ queryParams.cursor = params.cursor;
125
+ }
126
+ if (params.limit) {
127
+ queryParams.limit = params.limit.toString();
128
+ }
129
+ if (params.connection_id) {
114
130
  queryParams.connection_id = params.connection_id;
115
- if (params.product_id) queryParams.product_id = params.product_id;
116
- if (params.metadata_filters)
131
+ }
132
+ if (params.product_id) {
133
+ queryParams.product_id = params.product_id;
134
+ }
135
+ if (params.metadata_filters) {
117
136
  queryParams.metadata_filters = JSON.stringify(
118
137
  Object.entries(params.metadata_filters)
119
138
  );
139
+ }
120
140
  }
121
141
  return this.lava.request("GET", "requests", {
122
142
  query: queryParams
@@ -127,7 +147,7 @@ var Resources;
127
147
  * @param params Request parameters
128
148
  * @returns Created request details
129
149
  */
130
- async create(params) {
150
+ create(params) {
131
151
  return this.lava.request("POST", "requests", {
132
152
  data: params
133
153
  });
@@ -137,7 +157,7 @@ var Resources;
137
157
  * @param requestId Request ID
138
158
  * @returns Request details
139
159
  */
140
- async retrieve(requestId) {
160
+ retrieve(requestId) {
141
161
  return this.lava.request("GET", `requests/${requestId}`);
142
162
  }
143
163
  }
@@ -148,18 +168,24 @@ var Resources;
148
168
  * @param params Usage parameters
149
169
  * @returns Usage data
150
170
  */
151
- async retrieve(params) {
171
+ retrieve(params) {
152
172
  const queryParams = {
153
173
  start: params.start
154
174
  };
155
- if (params.end) queryParams.end = params.end;
156
- if (params.connection_id)
175
+ if (params.end) {
176
+ queryParams.end = params.end;
177
+ }
178
+ if (params.connection_id) {
157
179
  queryParams.connection_id = params.connection_id;
158
- if (params.product_id) queryParams.product_id = params.product_id;
159
- if (params.metadata_filters)
180
+ }
181
+ if (params.product_id) {
182
+ queryParams.product_id = params.product_id;
183
+ }
184
+ if (params.metadata_filters) {
160
185
  queryParams.metadata_filters = JSON.stringify(
161
186
  Object.entries(params.metadata_filters)
162
187
  );
188
+ }
163
189
  return this.lava.request("GET", "usage", {
164
190
  query: queryParams
165
191
  });
@@ -209,7 +235,8 @@ var Lava = class {
209
235
  cerebras: `${this.baseUrl}forward?u=https://api.cerebras.ai/v1`,
210
236
  targon: `${this.baseUrl}forward?u=https://api.targon.com/v1`,
211
237
  gmicloud: `${this.baseUrl}forward?u=https://api.gmi-serving.com/v1`,
212
- chutes: `${this.baseUrl}forward?u=https://llm.chutes.ai/v1`
238
+ chutes: `${this.baseUrl}forward?u=https://llm.chutes.ai/v1`,
239
+ baseten: `${this.baseUrl}forward?u=https://inference.baseten.co/v1`
213
240
  };
214
241
  }
215
242
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lavapayments/nodejs",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "description": "Backend SDK for Lava Payments API - enabling usage-based billing for AI services",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -11,8 +11,6 @@
11
11
  "scripts": {
12
12
  "build": "tsup --dts --format cjs,esm src/index.ts",
13
13
  "typecheck": "tsc --noEmit",
14
- "lint": "eslint src/",
15
- "format": "prettier --write \"src/**/*.ts\"",
16
14
  "prepublishOnly": "npm run build",
17
15
  "clean": "rm -rf dist"
18
16
  },
@@ -37,11 +35,6 @@
37
35
  "homepage": "https://github.com/lavapayments/nodejs",
38
36
  "devDependencies": {
39
37
  "@types/node": "^20.0.0",
40
- "@types/eslint": "^8.0.0",
41
- "@typescript-eslint/eslint-plugin": "^6.0.0",
42
- "@typescript-eslint/parser": "^6.0.0",
43
- "eslint": "^8.0.0",
44
- "prettier": "^3.0.0",
45
38
  "tsup": "^8.0.0",
46
39
  "typescript": "^5.0.0"
47
40
  },