@layer-ai/sdk 0.1.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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +288 -0
  3. package/dist/client.d.ts +19 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +59 -0
  6. package/dist/config/index.d.ts +5 -0
  7. package/dist/config/index.d.ts.map +1 -0
  8. package/dist/config/index.js +3 -0
  9. package/dist/config/loader.d.ts +7 -0
  10. package/dist/config/loader.d.ts.map +1 -0
  11. package/dist/config/loader.js +21 -0
  12. package/dist/config/parser.d.ts +5 -0
  13. package/dist/config/parser.d.ts.map +1 -0
  14. package/dist/config/parser.js +12 -0
  15. package/dist/config/validator.d.ts +3 -0
  16. package/dist/config/validator.d.ts.map +1 -0
  17. package/dist/config/validator.js +36 -0
  18. package/dist/index.d.ts +7 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +6 -0
  21. package/dist/resources/gates.d.ts +51 -0
  22. package/dist/resources/gates.d.ts.map +1 -0
  23. package/dist/resources/gates.js +83 -0
  24. package/dist/resources/keys.d.ts +30 -0
  25. package/dist/resources/keys.d.ts.map +1 -0
  26. package/dist/resources/keys.js +46 -0
  27. package/dist/resources/logs.d.ts +8 -0
  28. package/dist/resources/logs.d.ts.map +1 -0
  29. package/dist/resources/logs.js +20 -0
  30. package/dist/types/api.d.ts +35 -0
  31. package/dist/types/api.d.ts.map +1 -0
  32. package/dist/types/api.js +1 -0
  33. package/dist/types/config.d.ts +13 -0
  34. package/dist/types/config.d.ts.map +1 -0
  35. package/dist/types/config.js +1 -0
  36. package/dist/types/gates.d.ts +26 -0
  37. package/dist/types/gates.d.ts.map +1 -0
  38. package/dist/types/gates.js +3 -0
  39. package/dist/types/index.d.ts +9 -0
  40. package/dist/types/index.d.ts.map +1 -0
  41. package/dist/types/index.js +9 -0
  42. package/dist/types/keys.d.ts +11 -0
  43. package/dist/types/keys.d.ts.map +1 -0
  44. package/dist/types/keys.js +1 -0
  45. package/dist/types/logs.d.ts +21 -0
  46. package/dist/types/logs.d.ts.map +1 -0
  47. package/dist/types/logs.js +1 -0
  48. package/dist/types/model-registry.d.ts +395 -0
  49. package/dist/types/model-registry.d.ts.map +1 -0
  50. package/dist/types/model-registry.js +338 -0
  51. package/dist/types/models.d.ts +76 -0
  52. package/dist/types/models.d.ts.map +1 -0
  53. package/dist/types/models.js +7 -0
  54. package/dist/types/smart-routing.d.ts +6 -0
  55. package/dist/types/smart-routing.d.ts.map +1 -0
  56. package/dist/types/smart-routing.js +1 -0
  57. package/dist/types.d.ts +28 -0
  58. package/dist/types.d.ts.map +1 -0
  59. package/dist/types.js +1 -0
  60. package/package.json +61 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../src/types/model-registry.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAA;IACD,UAAU,CAAC,EAAE;QACX,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAA;IACD,WAAW,CAAC,EAAE;QACZ,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAA;IACD,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE;YACL,IAAI,EAAE,OAAO,CAAC;YACd,KAAK,EAAE,OAAO,CAAC;YACf,KAAK,EAAE,OAAO,CAAC;YACf,KAAK,EAAE,OAAO,CAAA;SACf,CAAA;QACD,MAAM,EAAE;YACN,IAAI,EAAE,OAAO,CAAC;YACd,KAAK,EAAE,OAAO,CAAC;YACf,KAAK,EAAE,OAAO,CAAC;YACf,KAAK,EAAE,OAAO,CAAC;SAChB,CAAA;KACF,CAAA;IACD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0UjB,CAAC;AAGX,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,cAAc,CAAC;AACzD,MAAM,MAAM,QAAQ,GAAG,OAAO,cAAc,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,CAAC"}
@@ -0,0 +1,338 @@
1
+ // Centralized model registry - single source of truth
2
+ // Data sources:
3
+ // - Artificial Analysis API: pricing, benchmarks, performance metrics
4
+ // - OpenRouter API: context window, input/output modalities
5
+ //
6
+ // To update: Run `pnpm run sync:models` (requires ARTIFICIAL_ANALYSIS_API_KEY in .env)
7
+ // APIs:
8
+ // - https://artificialanalysis.ai/api/v2/data/llms/models
9
+ // - https://openrouter.ai/api/v1/models
10
+ // Data attribution: https://artificialanalysis.ai/
11
+ export const MODEL_REGISTRY = {
12
+ // Openai models
13
+ 'gpt-4o': {
14
+ provider: 'openai',
15
+ displayName: 'GPT-4o (Nov \'24)',
16
+ pricing: { input: 0.0025, output: 0.01 },
17
+ benchmarks: {
18
+ intelligence: 27,
19
+ coding: 24,
20
+ math: 6,
21
+ mmluPro: 0.748,
22
+ gpqa: 0.543,
23
+ },
24
+ performance: {
25
+ outputTokenPerSecond: 137.258,
26
+ timeTofirstToken: 0.531,
27
+ intelligenceScore: 27,
28
+ },
29
+ context: {
30
+ window: 128000,
31
+ input: {
32
+ text: true,
33
+ image: true,
34
+ audio: false,
35
+ video: false,
36
+ },
37
+ output: {
38
+ text: true,
39
+ image: false,
40
+ audio: false,
41
+ video: false,
42
+ },
43
+ },
44
+ lastUpdated: '2025-11-27',
45
+ },
46
+ 'gpt-4o-mini': {
47
+ provider: 'openai',
48
+ displayName: 'GPT-4o mini',
49
+ pricing: { input: 0.00015, output: 0.0006 },
50
+ benchmarks: {
51
+ intelligence: 21.2,
52
+ math: 14.7,
53
+ mmluPro: 0.648,
54
+ gpqa: 0.426,
55
+ },
56
+ performance: {
57
+ outputTokenPerSecond: 49.306,
58
+ timeTofirstToken: 0.503,
59
+ intelligenceScore: 21.2,
60
+ },
61
+ context: {
62
+ window: 128000,
63
+ input: {
64
+ text: true,
65
+ image: true,
66
+ audio: false,
67
+ video: false,
68
+ },
69
+ output: {
70
+ text: true,
71
+ image: false,
72
+ audio: false,
73
+ video: false,
74
+ },
75
+ },
76
+ lastUpdated: '2025-11-27',
77
+ },
78
+ // Anthropic models
79
+ 'claude-haiku-4-5-20251001': {
80
+ provider: 'anthropic',
81
+ displayName: 'Claude 4.5 Haiku (Non-reasoning)',
82
+ pricing: { input: 0.001, output: 0.005 },
83
+ benchmarks: {
84
+ intelligence: 41.7,
85
+ coding: 37,
86
+ math: 39,
87
+ mmluPro: 0.8,
88
+ gpqa: 0.646,
89
+ },
90
+ performance: {
91
+ outputTokenPerSecond: 100.11,
92
+ timeTofirstToken: 1.035,
93
+ intelligenceScore: 41.7,
94
+ },
95
+ context: {
96
+ window: 200000,
97
+ input: {
98
+ text: true,
99
+ image: true,
100
+ audio: false,
101
+ video: false,
102
+ },
103
+ output: {
104
+ text: true,
105
+ image: false,
106
+ audio: false,
107
+ video: false,
108
+ },
109
+ },
110
+ lastUpdated: '2025-11-27',
111
+ },
112
+ 'claude-opus-4-1-20250805': {
113
+ provider: 'anthropic',
114
+ displayName: 'Claude 4.1 Opus (Non-reasoning)',
115
+ pricing: { input: 0.015, output: 0.075 },
116
+ benchmarks: {
117
+ intelligence: 44.6,
118
+ },
119
+ performance: {
120
+ outputTokenPerSecond: 39.947,
121
+ timeTofirstToken: 1.445,
122
+ intelligenceScore: 44.6,
123
+ },
124
+ context: {
125
+ window: 200000,
126
+ input: {
127
+ text: true,
128
+ image: true,
129
+ audio: false,
130
+ video: false,
131
+ },
132
+ output: {
133
+ text: true,
134
+ image: false,
135
+ audio: false,
136
+ video: false,
137
+ },
138
+ },
139
+ lastUpdated: '2025-11-27',
140
+ },
141
+ 'claude-sonnet-4-5-20250929': {
142
+ provider: 'anthropic',
143
+ displayName: 'Claude 4.5 Sonnet (Non-reasoning)',
144
+ pricing: { input: 0.003, output: 0.015 },
145
+ benchmarks: {
146
+ intelligence: 49.6,
147
+ coding: 42.9,
148
+ math: 37,
149
+ mmluPro: 0.86,
150
+ gpqa: 0.727,
151
+ },
152
+ performance: {
153
+ outputTokenPerSecond: 70.948,
154
+ timeTofirstToken: 2.006,
155
+ intelligenceScore: 49.6,
156
+ },
157
+ context: {
158
+ window: 1000000,
159
+ input: {
160
+ text: true,
161
+ image: true,
162
+ audio: false,
163
+ video: false,
164
+ },
165
+ output: {
166
+ text: true,
167
+ image: false,
168
+ audio: false,
169
+ video: false,
170
+ },
171
+ },
172
+ lastUpdated: '2025-11-27',
173
+ },
174
+ 'claude-3-5-haiku-20241022': {
175
+ provider: 'anthropic',
176
+ displayName: 'Claude 3.5 Haiku',
177
+ pricing: { input: 0.0008, output: 0.004 },
178
+ benchmarks: {
179
+ intelligence: 20.2,
180
+ mmluPro: 0.634,
181
+ gpqa: 0.408,
182
+ },
183
+ performance: {
184
+ outputTokenPerSecond: 47.501,
185
+ timeTofirstToken: 0.713,
186
+ intelligenceScore: 20.2,
187
+ },
188
+ context: {
189
+ window: 200000,
190
+ input: {
191
+ text: true,
192
+ image: true,
193
+ audio: false,
194
+ video: false,
195
+ },
196
+ output: {
197
+ text: true,
198
+ image: false,
199
+ audio: false,
200
+ video: false,
201
+ },
202
+ },
203
+ lastUpdated: '2025-11-27',
204
+ },
205
+ 'claude-3-7-sonnet-20250219': {
206
+ provider: 'anthropic',
207
+ displayName: 'Claude 3.7 Sonnet (Non-reasoning)',
208
+ pricing: { input: 0.003, output: 0.015 },
209
+ benchmarks: {
210
+ intelligence: 41.1,
211
+ coding: 32.3,
212
+ math: 21,
213
+ mmluPro: 0.803,
214
+ gpqa: 0.656,
215
+ },
216
+ performance: {
217
+ outputTokenPerSecond: 56.392,
218
+ timeTofirstToken: 0.551,
219
+ intelligenceScore: 41.1,
220
+ },
221
+ context: {
222
+ window: 200000,
223
+ input: {
224
+ text: true,
225
+ image: true,
226
+ audio: false,
227
+ video: false,
228
+ },
229
+ output: {
230
+ text: true,
231
+ image: false,
232
+ audio: false,
233
+ video: false,
234
+ },
235
+ },
236
+ lastUpdated: '2025-11-27',
237
+ },
238
+ // Google models
239
+ 'gemini-2.5-pro': {
240
+ provider: 'google',
241
+ displayName: 'Gemini 2.5 Pro',
242
+ pricing: { input: 0.00125, output: 0.01 },
243
+ benchmarks: {
244
+ intelligence: 59.6,
245
+ coding: 49.3,
246
+ math: 87.7,
247
+ mmluPro: 0.862,
248
+ gpqa: 0.844,
249
+ },
250
+ performance: {
251
+ outputTokenPerSecond: 42.557,
252
+ timeTofirstToken: 15.534,
253
+ intelligenceScore: 59.6,
254
+ },
255
+ context: {
256
+ window: 1048576,
257
+ input: {
258
+ text: true,
259
+ image: true,
260
+ audio: false,
261
+ video: false,
262
+ },
263
+ output: {
264
+ text: true,
265
+ image: false,
266
+ audio: false,
267
+ video: false,
268
+ },
269
+ },
270
+ lastUpdated: '2025-11-27',
271
+ },
272
+ 'gemini-2.0-flash': {
273
+ provider: 'google',
274
+ displayName: 'Gemini 2.0 Flash (Feb \'25)',
275
+ pricing: { input: 0.0001, output: 0.0004 },
276
+ benchmarks: {
277
+ intelligence: 33.6,
278
+ coding: 23.4,
279
+ math: 21.7,
280
+ mmluPro: 0.779,
281
+ gpqa: 0.623,
282
+ },
283
+ performance: {
284
+ outputTokenPerSecond: 161.857,
285
+ timeTofirstToken: 0.375,
286
+ intelligenceScore: 33.6,
287
+ },
288
+ context: {
289
+ window: 1048576,
290
+ input: {
291
+ text: true,
292
+ image: true,
293
+ audio: false,
294
+ video: false,
295
+ },
296
+ output: {
297
+ text: true,
298
+ image: false,
299
+ audio: false,
300
+ video: false,
301
+ },
302
+ },
303
+ lastUpdated: '2025-11-27',
304
+ },
305
+ 'gemini-2.5-flash': {
306
+ provider: 'google',
307
+ displayName: 'Gemini 2.5 Flash (Non-reasoning)',
308
+ pricing: { input: 0.0003, output: 0.0025 },
309
+ benchmarks: {
310
+ intelligence: 40.4,
311
+ coding: 30,
312
+ math: 60.3,
313
+ mmluPro: 0.809,
314
+ gpqa: 0.683,
315
+ },
316
+ performance: {
317
+ outputTokenPerSecond: 230.517,
318
+ timeTofirstToken: 0.401,
319
+ intelligenceScore: 40.4,
320
+ },
321
+ context: {
322
+ window: 1048576,
323
+ input: {
324
+ text: true,
325
+ image: true,
326
+ audio: false,
327
+ video: false,
328
+ },
329
+ output: {
330
+ text: true,
331
+ image: false,
332
+ audio: false,
333
+ video: false,
334
+ },
335
+ },
336
+ lastUpdated: '2025-11-27',
337
+ },
338
+ };
@@ -0,0 +1,76 @@
1
+ import type { SupportedModel } from "./gates.js";
2
+ import { TaskAnalysis } from "./smart-routing.js";
3
+ export interface User {
4
+ id: string;
5
+ email: string;
6
+ passwordHash: string;
7
+ createdAt: Date;
8
+ updatedAt: Date;
9
+ }
10
+ export interface ApiKey {
11
+ id: string;
12
+ userId: string;
13
+ keyHash: string;
14
+ keyPrefix: string;
15
+ name: string;
16
+ isActive: boolean;
17
+ lastUsedAt: Date | null;
18
+ createdAt: Date;
19
+ }
20
+ export interface GateBase {
21
+ name: string;
22
+ model: SupportedModel;
23
+ description?: string;
24
+ systemPrompt?: string;
25
+ allowOverrides?: boolean | OverrideConfig;
26
+ temperature?: number;
27
+ maxTokens?: number;
28
+ topP?: number;
29
+ tags?: string[];
30
+ routingStrategy?: 'single' | 'fallback' | 'round-robin';
31
+ fallbackModels?: SupportedModel[];
32
+ costWeight?: number;
33
+ latencyWeight?: number;
34
+ qualityWeight?: number;
35
+ maxCostPer1kTokens?: number;
36
+ maxLatencyMs?: number;
37
+ taskAnalysis?: TaskAnalysis;
38
+ }
39
+ export interface Gate extends GateBase {
40
+ id: string;
41
+ userId: string;
42
+ createdAt: Date;
43
+ updatedAt: Date;
44
+ }
45
+ export interface OverrideConfig {
46
+ model?: boolean;
47
+ temperature?: boolean;
48
+ maxTokens?: boolean;
49
+ topP?: boolean;
50
+ }
51
+ export declare enum OverrideField {
52
+ Model = "model",
53
+ Temperature = "temperature",
54
+ MaxTokens = "maxTokens",
55
+ TopP = "topP"
56
+ }
57
+ export interface Request {
58
+ id: string;
59
+ userId: string;
60
+ gateId: string | null;
61
+ gateName: string | null;
62
+ modelRequested: string;
63
+ modelUsed: string;
64
+ promptTokens: number;
65
+ completionTokens: number;
66
+ totalTokens: number;
67
+ costUsd: number;
68
+ latencyMs: number;
69
+ success: boolean;
70
+ errorMessage: string | null;
71
+ createdAt: Date;
72
+ userAgent?: string;
73
+ ipAddress?: string;
74
+ duration?: number;
75
+ }
76
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/types/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAGD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;CACjB;AAGD,MAAM,WAAW,QAAQ;IAEvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,CAAC;IAGtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,eAAe,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAC;IACxD,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC;IAIlC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,WAAW,IAAK,SAAQ,QAAQ;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,oBAAY,aAAa;IACvB,KAAK,UAAU;IACf,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,IAAI,SAAS;CACd;AAGD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,7 @@
1
+ export var OverrideField;
2
+ (function (OverrideField) {
3
+ OverrideField["Model"] = "model";
4
+ OverrideField["Temperature"] = "temperature";
5
+ OverrideField["MaxTokens"] = "maxTokens";
6
+ OverrideField["TopP"] = "topP";
7
+ })(OverrideField || (OverrideField = {}));
@@ -0,0 +1,6 @@
1
+ export interface TaskAnalysis {
2
+ primary: string;
3
+ alternatives: string[];
4
+ reasoning: string;
5
+ }
6
+ //# sourceMappingURL=smart-routing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-routing.d.ts","sourceRoot":"","sources":["../../src/types/smart-routing.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ export interface LayerConfig {
2
+ apiKey: string;
3
+ baseUrl?: string;
4
+ /**
5
+ * Enable admin mode for mutation operations.
6
+ *
7
+ * WARNING: Only set to true in setup scripts and IaC (infrastructure as code), and not in runtime code.
8
+ *
9
+ * Admin mode enables:
10
+ * - layer.gates.create/udpate/delete()
11
+ * - layer.keys.create/delete()
12
+ *
13
+ * Read operations are always available without admin mode:
14
+ * - layer.gates.list/get()
15
+ * - layer.keys.list()
16
+ * - layer.complete()
17
+ *
18
+ * @default false
19
+ * @see https://docs.uselayer.ai/sdk/admin-mode
20
+ */
21
+ adminMode?: boolean;
22
+ }
23
+ export interface RequestOptions {
24
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
25
+ path: string;
26
+ body?: unknown;
27
+ }
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@layer-ai/sdk",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript SDK for Layer AI - Manage LLM requests with intelligent routing and fallbacks",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./config": {
14
+ "types": "./dist/config/index.d.ts",
15
+ "import": "./dist/config/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsc",
25
+ "dev": "tsc --watch",
26
+ "clean": "rm -rf dist"
27
+ },
28
+ "keywords": [
29
+ "ai",
30
+ "llm",
31
+ "openai",
32
+ "anthropic",
33
+ "google",
34
+ "gemini",
35
+ "claude",
36
+ "gpt",
37
+ "gateway",
38
+ "proxy",
39
+ "routing",
40
+ "fallback"
41
+ ],
42
+ "author": "Micah Nettey",
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "https://github.com/micah-nettey/layer-ai.git",
47
+ "directory": "packages/sdk"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/micah-nettey/layer-ai/issues"
51
+ },
52
+ "homepage": "https://github.com/micah-nettey/layer-ai#readme",
53
+ "dependencies": {
54
+ "yaml": "^2.3.4",
55
+ "zod": "^3.22.4"
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "^20.10.0",
59
+ "typescript": "^5.9.3"
60
+ }
61
+ }