aimodels 0.1.1 → 0.2.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 +53 -38
- package/dist/index.d.mts +75 -22
- package/dist/index.d.ts +75 -22
- package/dist/index.js +578 -67
- package/dist/index.mjs +577 -67
- package/package.json +16 -5
package/dist/index.mjs
CHANGED
|
@@ -1,83 +1,593 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
var
|
|
3
|
-
{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
// src/types/models.ts
|
|
2
|
+
var ModelCollection = class _ModelCollection extends Array {
|
|
3
|
+
constructor(models2) {
|
|
4
|
+
super(...models2);
|
|
5
|
+
Object.setPrototypeOf(this, _ModelCollection.prototype);
|
|
6
|
+
}
|
|
7
|
+
can(...capabilities) {
|
|
8
|
+
return new _ModelCollection(
|
|
9
|
+
this.filter((model) => capabilities.every((cap) => model.can.includes(cap)))
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
know(...languages) {
|
|
13
|
+
return new _ModelCollection(
|
|
14
|
+
this.filter((model) => languages.every((lang) => model.languages?.includes(lang)))
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
// Override array methods to return ModelCollection
|
|
18
|
+
filter(predicate) {
|
|
19
|
+
return new _ModelCollection(super.filter(predicate));
|
|
20
|
+
}
|
|
21
|
+
slice(start, end) {
|
|
22
|
+
return new _ModelCollection(super.slice(start, end));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// src/data/models/openai.json
|
|
27
|
+
var openai_default = {
|
|
28
|
+
models: [
|
|
29
|
+
{
|
|
30
|
+
id: "whisper-1",
|
|
31
|
+
name: "Whisper-1",
|
|
32
|
+
license: "proprietary",
|
|
33
|
+
providers: [
|
|
34
|
+
"openai",
|
|
35
|
+
"azure"
|
|
36
|
+
],
|
|
37
|
+
can: [
|
|
38
|
+
"sound-in",
|
|
39
|
+
"text-out"
|
|
40
|
+
],
|
|
41
|
+
context: {
|
|
42
|
+
total: null,
|
|
43
|
+
maxOutput: null
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "tts-1",
|
|
48
|
+
name: "TTS-1",
|
|
49
|
+
license: "proprietary",
|
|
50
|
+
providers: [
|
|
51
|
+
"openai",
|
|
52
|
+
"azure"
|
|
53
|
+
],
|
|
54
|
+
can: [
|
|
55
|
+
"text-in",
|
|
56
|
+
"sound-out"
|
|
57
|
+
],
|
|
58
|
+
context: {
|
|
59
|
+
total: null,
|
|
60
|
+
maxOutput: null
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "tts-1-hd",
|
|
65
|
+
name: "TTS-1 HD",
|
|
66
|
+
license: "proprietary",
|
|
67
|
+
providers: [
|
|
68
|
+
"openai",
|
|
69
|
+
"azure"
|
|
70
|
+
],
|
|
71
|
+
can: [
|
|
72
|
+
"text-in",
|
|
73
|
+
"sound-out"
|
|
74
|
+
],
|
|
75
|
+
context: {
|
|
76
|
+
total: null,
|
|
77
|
+
maxOutput: null
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "gpt-4o",
|
|
82
|
+
name: "GPT-4O",
|
|
83
|
+
license: "proprietary",
|
|
84
|
+
providers: [
|
|
85
|
+
"openai",
|
|
86
|
+
"azure"
|
|
87
|
+
],
|
|
88
|
+
can: [
|
|
89
|
+
"chat",
|
|
90
|
+
"img-in",
|
|
91
|
+
"json-out",
|
|
92
|
+
"function-out"
|
|
93
|
+
],
|
|
94
|
+
context: {
|
|
95
|
+
total: 128e3,
|
|
96
|
+
maxOutput: 16384
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "gpt-4o-mini",
|
|
101
|
+
name: "GPT-4O Mini",
|
|
102
|
+
license: "proprietary",
|
|
103
|
+
providers: [
|
|
104
|
+
"openai",
|
|
105
|
+
"azure"
|
|
106
|
+
],
|
|
107
|
+
can: [
|
|
108
|
+
"chat",
|
|
109
|
+
"img-in",
|
|
110
|
+
"json-out",
|
|
111
|
+
"function-out"
|
|
112
|
+
],
|
|
113
|
+
context: {
|
|
114
|
+
total: 128e3,
|
|
115
|
+
maxOutput: 16384
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: "o1",
|
|
120
|
+
name: "OpenAI O1",
|
|
121
|
+
license: "proprietary",
|
|
122
|
+
providers: [
|
|
123
|
+
"openai",
|
|
124
|
+
"azure"
|
|
125
|
+
],
|
|
126
|
+
can: [
|
|
127
|
+
"chat",
|
|
128
|
+
"img-in",
|
|
129
|
+
"json-out",
|
|
130
|
+
"function-out",
|
|
131
|
+
"reason"
|
|
132
|
+
],
|
|
133
|
+
context: {
|
|
134
|
+
total: 2e5,
|
|
135
|
+
maxOutput: 1e5
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: "o1-mini",
|
|
140
|
+
name: "OpenAI O1 Mini",
|
|
141
|
+
license: "proprietary",
|
|
142
|
+
providers: [
|
|
143
|
+
"openai",
|
|
144
|
+
"azure"
|
|
145
|
+
],
|
|
146
|
+
can: [
|
|
147
|
+
"chat",
|
|
148
|
+
"json-out",
|
|
149
|
+
"function-out",
|
|
150
|
+
"reason"
|
|
151
|
+
],
|
|
152
|
+
context: {
|
|
153
|
+
total: 128e3,
|
|
154
|
+
maxOutput: 65536
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "o3-mini",
|
|
159
|
+
name: "OpenAI O3 Mini",
|
|
160
|
+
license: "proprietary",
|
|
161
|
+
providers: [
|
|
162
|
+
"openai",
|
|
163
|
+
"azure"
|
|
164
|
+
],
|
|
165
|
+
can: [
|
|
166
|
+
"chat",
|
|
167
|
+
"json-out",
|
|
168
|
+
"function-out",
|
|
169
|
+
"reason"
|
|
170
|
+
],
|
|
171
|
+
context: {
|
|
172
|
+
total: 2e5,
|
|
173
|
+
maxOutput: 1e5
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: "gpt-4o-audio-preview",
|
|
178
|
+
name: "GPT-4O Audio",
|
|
179
|
+
license: "proprietary",
|
|
180
|
+
providers: [
|
|
181
|
+
"openai",
|
|
182
|
+
"azure"
|
|
183
|
+
],
|
|
184
|
+
can: [
|
|
185
|
+
"chat",
|
|
186
|
+
"sound-in",
|
|
187
|
+
"json-out",
|
|
188
|
+
"function-out"
|
|
189
|
+
],
|
|
190
|
+
context: {
|
|
191
|
+
total: 128e3,
|
|
192
|
+
maxOutput: 16384
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: "gpt-4o-realtime-preview",
|
|
197
|
+
name: "GPT-4O Realtime",
|
|
198
|
+
license: "proprietary",
|
|
199
|
+
providers: [
|
|
200
|
+
"openai",
|
|
201
|
+
"azure"
|
|
202
|
+
],
|
|
203
|
+
can: [
|
|
204
|
+
"chat",
|
|
205
|
+
"sound-in",
|
|
206
|
+
"json-out",
|
|
207
|
+
"function-out"
|
|
208
|
+
],
|
|
209
|
+
context: {
|
|
210
|
+
total: 128e3,
|
|
211
|
+
maxOutput: 4096
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: "dall-e-3",
|
|
216
|
+
name: "DALL-E 3",
|
|
217
|
+
license: "proprietary",
|
|
218
|
+
providers: [
|
|
219
|
+
"openai",
|
|
220
|
+
"azure"
|
|
221
|
+
],
|
|
222
|
+
can: [
|
|
223
|
+
"img-out"
|
|
224
|
+
],
|
|
225
|
+
context: {
|
|
226
|
+
maxOutput: 1,
|
|
227
|
+
sizes: [
|
|
228
|
+
"1024x1024",
|
|
229
|
+
"1024x1792",
|
|
230
|
+
"1792x1024"
|
|
231
|
+
],
|
|
232
|
+
qualities: [
|
|
233
|
+
"standard",
|
|
234
|
+
"hd"
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
// src/data/models/anthropic.json
|
|
242
|
+
var anthropic_default = {
|
|
243
|
+
models: [
|
|
244
|
+
{
|
|
245
|
+
id: "claude-3-opus",
|
|
246
|
+
name: "Claude 3 Opus",
|
|
247
|
+
license: "proprietary",
|
|
248
|
+
providers: ["anthropic", "aws", "google"],
|
|
249
|
+
can: ["chat", "img-in", "json-out", "function-out"],
|
|
250
|
+
context: {
|
|
251
|
+
total: 2e5,
|
|
252
|
+
maxOutput: 4096
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: "claude-3-sonnet",
|
|
257
|
+
name: "Claude 3 Sonnet",
|
|
258
|
+
license: "proprietary",
|
|
259
|
+
providers: ["anthropic", "aws", "google"],
|
|
260
|
+
can: ["chat", "img-in", "json-out", "function-out"],
|
|
261
|
+
context: {
|
|
262
|
+
total: 2e5,
|
|
263
|
+
maxOutput: 4096
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
id: "claude-3-haiku",
|
|
268
|
+
name: "Claude 3 Haiku",
|
|
269
|
+
license: "proprietary",
|
|
270
|
+
providers: ["anthropic", "aws", "google"],
|
|
271
|
+
can: ["chat", "img-in", "json-out", "function-out"],
|
|
272
|
+
context: {
|
|
273
|
+
total: 2e5,
|
|
274
|
+
maxOutput: 4096
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// src/data/models/meta.json
|
|
281
|
+
var meta_default = {
|
|
282
|
+
models: [
|
|
283
|
+
{
|
|
284
|
+
id: "llama2-70b-4096",
|
|
285
|
+
name: "Llama 2 70B",
|
|
286
|
+
license: "llama-2-community",
|
|
287
|
+
providers: ["groq", "ollama"],
|
|
288
|
+
can: ["chat", "json-out", "function-out"],
|
|
289
|
+
context: {
|
|
290
|
+
total: 4096,
|
|
291
|
+
maxOutput: 4096
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// src/data/models/mistral.json
|
|
298
|
+
var mistral_default = {
|
|
299
|
+
models: [
|
|
300
|
+
{
|
|
301
|
+
id: "mixtral-8x7b-32768",
|
|
302
|
+
name: "Mixtral 8x7B",
|
|
303
|
+
license: "apache-2.0",
|
|
304
|
+
providers: ["groq"],
|
|
305
|
+
can: ["chat", "json-out", "function-out"],
|
|
306
|
+
context: {
|
|
307
|
+
total: 32768,
|
|
308
|
+
maxOutput: 4096
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// src/builders/models.ts
|
|
315
|
+
function buildAllModels() {
|
|
316
|
+
return [
|
|
317
|
+
...openai_default.models,
|
|
318
|
+
...anthropic_default.models,
|
|
319
|
+
...meta_default.models,
|
|
320
|
+
...mistral_default.models
|
|
321
|
+
];
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// src/data/providers/openai.json
|
|
325
|
+
var openai_default2 = {
|
|
326
|
+
id: "openai",
|
|
327
|
+
name: "OpenAI",
|
|
328
|
+
websiteUrl: "https://openai.com/",
|
|
329
|
+
apiUrl: "https://api.openai.com/v1",
|
|
330
|
+
defaultModel: "gpt-4o",
|
|
331
|
+
models: {
|
|
332
|
+
"gpt-4o": {
|
|
333
|
+
type: "token",
|
|
334
|
+
input: 20,
|
|
335
|
+
output: 80
|
|
336
|
+
},
|
|
337
|
+
"gpt-3.5-turbo": {
|
|
338
|
+
type: "token",
|
|
339
|
+
input: 5,
|
|
340
|
+
output: 20
|
|
341
|
+
},
|
|
342
|
+
"gpt-4o-vision": {
|
|
343
|
+
type: "token",
|
|
344
|
+
input: 15,
|
|
345
|
+
input_cached: 7.5,
|
|
346
|
+
output: 60
|
|
347
|
+
},
|
|
348
|
+
"o1-mini": {
|
|
349
|
+
type: "token",
|
|
350
|
+
input: 3,
|
|
351
|
+
input_cached: 1.5,
|
|
352
|
+
output: 15
|
|
353
|
+
},
|
|
354
|
+
"o3-mini": {
|
|
355
|
+
type: "token",
|
|
356
|
+
input: 3,
|
|
357
|
+
input_cached: 1.5,
|
|
358
|
+
output: 15
|
|
359
|
+
},
|
|
360
|
+
"gpt-4o-audio-preview": {
|
|
361
|
+
type: "token",
|
|
362
|
+
input: 20,
|
|
363
|
+
output: 80
|
|
364
|
+
},
|
|
365
|
+
"gpt-4o-vision-preview": {
|
|
366
|
+
type: "token",
|
|
367
|
+
input: 20,
|
|
368
|
+
output: 80
|
|
369
|
+
},
|
|
370
|
+
"whisper-1": {
|
|
371
|
+
type: "minute",
|
|
372
|
+
price: 6e-3
|
|
373
|
+
},
|
|
374
|
+
"tts-1": {
|
|
375
|
+
type: "character",
|
|
376
|
+
price: 15e-6
|
|
377
|
+
},
|
|
378
|
+
"tts-1-hd": {
|
|
379
|
+
type: "character",
|
|
380
|
+
price: 3e-5
|
|
381
|
+
},
|
|
382
|
+
"dall-e-2": {
|
|
383
|
+
type: "image",
|
|
384
|
+
price: 0.016,
|
|
385
|
+
size: "256x256",
|
|
386
|
+
unit: "per_image"
|
|
387
|
+
},
|
|
388
|
+
"dall-e-2-512": {
|
|
389
|
+
type: "image",
|
|
390
|
+
price: 0.018,
|
|
391
|
+
size: "512x512",
|
|
392
|
+
unit: "per_image"
|
|
393
|
+
},
|
|
394
|
+
"dall-e-2-1024": {
|
|
395
|
+
type: "image",
|
|
396
|
+
price: 0.02,
|
|
397
|
+
size: "1024x1024",
|
|
398
|
+
unit: "per_image"
|
|
399
|
+
},
|
|
400
|
+
"dall-e-3": {
|
|
401
|
+
type: "image",
|
|
402
|
+
price: 0.04,
|
|
403
|
+
size: "1024x1024",
|
|
404
|
+
unit: "per_image"
|
|
405
|
+
},
|
|
406
|
+
"dall-e-3-hd": {
|
|
407
|
+
type: "image",
|
|
408
|
+
price: 0.08,
|
|
409
|
+
size: "1024x1024",
|
|
410
|
+
unit: "per_image"
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
// src/data/providers/anthropic.json
|
|
416
|
+
var anthropic_default2 = {
|
|
417
|
+
id: "anthropic",
|
|
418
|
+
name: "Anthropic",
|
|
419
|
+
websiteUrl: "https://www.anthropic.com/",
|
|
420
|
+
apiUrl: "https://api.anthropic.com/v1",
|
|
421
|
+
defaultModel: "claude-3-sonnet",
|
|
422
|
+
models: {
|
|
423
|
+
"claude-3-opus": {
|
|
424
|
+
type: "token",
|
|
425
|
+
input: 15,
|
|
426
|
+
output: 75
|
|
427
|
+
},
|
|
428
|
+
"claude-3-sonnet": {
|
|
429
|
+
type: "token",
|
|
430
|
+
input: 3,
|
|
431
|
+
output: 15
|
|
432
|
+
},
|
|
433
|
+
"claude-3-haiku": {
|
|
434
|
+
type: "token",
|
|
435
|
+
input: 2.5,
|
|
436
|
+
output: 12.5
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
// src/data/providers/mistral.json
|
|
442
|
+
var mistral_default2 = {
|
|
443
|
+
id: "mistral",
|
|
444
|
+
name: "Mistral",
|
|
445
|
+
websiteUrl: "https://mistral.ai/",
|
|
446
|
+
apiUrl: "https://api.mistral.ai/v1",
|
|
447
|
+
defaultModel: "mixtral-8x7b-32768",
|
|
448
|
+
models: {
|
|
449
|
+
"mixtral-8x7b-32768": {
|
|
450
|
+
type: "token",
|
|
451
|
+
input: 0.7,
|
|
452
|
+
output: 0.7
|
|
453
|
+
},
|
|
454
|
+
"mistral-large-latest": {
|
|
455
|
+
type: "token",
|
|
456
|
+
input: 0.7,
|
|
457
|
+
output: 0.7
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
// src/builders/providers.ts
|
|
463
|
+
function isTokenPrice(price) {
|
|
464
|
+
return typeof price === "object" && price !== null && "type" in price && price.type === "token" && "input" in price && typeof price.input === "number" && "output" in price && typeof price.output === "number";
|
|
465
|
+
}
|
|
466
|
+
function isImagePrice(price) {
|
|
467
|
+
return typeof price === "object" && price !== null && "type" in price && price.type === "image" && "price" in price && typeof price.price === "number" && "size" in price && typeof price.size === "string" && "unit" in price && price.unit === "per_image";
|
|
468
|
+
}
|
|
469
|
+
function isCharacterPrice(price) {
|
|
470
|
+
return typeof price === "object" && price !== null && "type" in price && price.type === "character" && "price" in price && typeof price.price === "number";
|
|
471
|
+
}
|
|
472
|
+
function isMinutePrice(price) {
|
|
473
|
+
return typeof price === "object" && price !== null && "type" in price && price.type === "minute" && "price" in price && typeof price.price === "number";
|
|
474
|
+
}
|
|
475
|
+
function validateProvider(raw) {
|
|
476
|
+
if (typeof raw !== "object" || raw === null) {
|
|
477
|
+
throw new Error("Provider data must be an object");
|
|
478
|
+
}
|
|
479
|
+
const provider = raw;
|
|
480
|
+
if (typeof provider.id !== "string") {
|
|
481
|
+
throw new Error("Provider id must be a string");
|
|
482
|
+
}
|
|
483
|
+
if (typeof provider.name !== "string") {
|
|
484
|
+
throw new Error("Provider name must be a string");
|
|
485
|
+
}
|
|
486
|
+
if (typeof provider.websiteUrl !== "string") {
|
|
487
|
+
throw new Error("Provider websiteUrl must be a string");
|
|
488
|
+
}
|
|
489
|
+
if (typeof provider.apiUrl !== "string") {
|
|
490
|
+
throw new Error("Provider apiUrl must be a string");
|
|
491
|
+
}
|
|
492
|
+
if (typeof provider.models !== "object" || provider.models === null) {
|
|
493
|
+
throw new Error("Provider models must be an object");
|
|
494
|
+
}
|
|
495
|
+
const models2 = provider.models;
|
|
496
|
+
Object.values(models2).forEach((price) => {
|
|
497
|
+
if (!isTokenPrice(price) && !isImagePrice(price) && !isCharacterPrice(price) && !isMinutePrice(price)) {
|
|
498
|
+
throw new Error(`Invalid price data: ${JSON.stringify(price)}`);
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
return {
|
|
502
|
+
id: provider.id,
|
|
503
|
+
name: provider.name,
|
|
504
|
+
websiteUrl: provider.websiteUrl,
|
|
505
|
+
apiUrl: provider.apiUrl,
|
|
506
|
+
models: provider.models
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
function buildAllProviders() {
|
|
510
|
+
return [
|
|
511
|
+
validateProvider(openai_default2),
|
|
512
|
+
validateProvider(anthropic_default2),
|
|
513
|
+
validateProvider(mistral_default2)
|
|
514
|
+
];
|
|
515
|
+
}
|
|
516
|
+
function buildProvidersData() {
|
|
517
|
+
return {
|
|
518
|
+
providers: buildAllProviders()
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// src/data/creators.json
|
|
523
|
+
var creators_default = {
|
|
524
|
+
creators: {
|
|
525
|
+
openai: {
|
|
526
|
+
name: "OpenAI",
|
|
527
|
+
website: "https://openai.com"
|
|
528
|
+
},
|
|
529
|
+
anthropic: {
|
|
530
|
+
name: "Anthropic",
|
|
531
|
+
website: "https://anthropic.com"
|
|
532
|
+
},
|
|
533
|
+
meta: {
|
|
534
|
+
name: "Meta",
|
|
535
|
+
website: "https://ai.meta.com"
|
|
536
|
+
},
|
|
537
|
+
mistral: {
|
|
538
|
+
name: "Mistral AI",
|
|
539
|
+
website: "https://mistral.ai"
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
};
|
|
55
543
|
|
|
56
544
|
// src/index.ts
|
|
57
|
-
var
|
|
545
|
+
var allModels = buildAllModels();
|
|
546
|
+
var providersData = buildProvidersData();
|
|
58
547
|
var models = {
|
|
59
|
-
all:
|
|
548
|
+
all: new ModelCollection(allModels),
|
|
549
|
+
get creators() {
|
|
550
|
+
return Object.keys(creators_default.creators);
|
|
551
|
+
},
|
|
60
552
|
get providers() {
|
|
61
|
-
return
|
|
553
|
+
return providersData.providers.map((p) => p.id);
|
|
62
554
|
},
|
|
63
|
-
|
|
64
|
-
return
|
|
555
|
+
fromCreator(creator) {
|
|
556
|
+
return new ModelCollection(
|
|
557
|
+
allModels.filter(
|
|
558
|
+
(model) => model.license.startsWith(creator) || // For open source models
|
|
559
|
+
providersData.providers.find((p) => p.id === creator)?.models[model.id]
|
|
560
|
+
// For proprietary models
|
|
561
|
+
)
|
|
562
|
+
);
|
|
563
|
+
},
|
|
564
|
+
fromProvider(provider) {
|
|
565
|
+
return new ModelCollection(
|
|
566
|
+
allModels.filter((model) => model.providers.includes(provider))
|
|
567
|
+
);
|
|
65
568
|
},
|
|
66
569
|
find(id) {
|
|
67
|
-
return
|
|
570
|
+
return allModels.find((model) => model.id === id);
|
|
68
571
|
},
|
|
69
|
-
|
|
70
|
-
return
|
|
572
|
+
can(...capabilities) {
|
|
573
|
+
return new ModelCollection(
|
|
574
|
+
allModels.filter(
|
|
575
|
+
(model) => capabilities.every((capability) => model.can.includes(capability))
|
|
576
|
+
)
|
|
577
|
+
);
|
|
71
578
|
},
|
|
72
579
|
withMinContext(tokens) {
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
withMaxPrice(price) {
|
|
76
|
-
return aimodels.filter(
|
|
77
|
-
(model) => model.pricing.input <= price && model.pricing.output <= price
|
|
580
|
+
return new ModelCollection(
|
|
581
|
+
allModels.filter((model) => model.context.total >= tokens)
|
|
78
582
|
);
|
|
583
|
+
},
|
|
584
|
+
getPrice(modelId, provider) {
|
|
585
|
+
const providerData = providersData.providers.find((p) => p.id === provider);
|
|
586
|
+
const price = providerData?.models[modelId];
|
|
587
|
+
return price?.type === "token" ? price : void 0;
|
|
79
588
|
}
|
|
80
589
|
};
|
|
81
590
|
export {
|
|
591
|
+
creators_default as creators,
|
|
82
592
|
models
|
|
83
593
|
};
|