aimodels 0.3.3 → 0.3.6

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.mjs CHANGED
@@ -36,11 +36,20 @@ var ModelCollection = class _ModelCollection extends Array {
36
36
  fromProvider(provider) {
37
37
  return this.filter((model) => model.providers.includes(provider));
38
38
  }
39
+ /** Get models available from a specific creator */
40
+ fromCreator(creator) {
41
+ return new _ModelCollection(
42
+ this.filter((model) => model.creator === creator)
43
+ );
44
+ }
39
45
  /** Filter models by minimum context window size */
40
46
  withMinContext(tokens) {
41
47
  return this.filter((model) => {
42
48
  const context = model.context;
43
- if (!("total" in context) || context.total === null) {
49
+ if (context.type !== "token" && context.type !== "character") {
50
+ return false;
51
+ }
52
+ if (context.total === null) {
44
53
  return false;
45
54
  }
46
55
  return context.total >= tokens;
@@ -53,61 +62,74 @@ var openai_models_default = {
53
62
  creator: "openai",
54
63
  models: [
55
64
  {
56
- id: "whisper-large-v3",
57
- name: "Whisper Large v3",
58
- license: "mit",
65
+ id: "gpt-4",
66
+ name: "GPT-4",
67
+ license: "proprietary",
59
68
  providers: [
60
69
  "openai",
61
- "azure",
62
- "groq"
70
+ "azure"
63
71
  ],
64
72
  can: [
65
- "sound-in",
66
- "text-out"
73
+ "chat",
74
+ "text-in",
75
+ "text-out",
76
+ "json-out",
77
+ "function-out"
67
78
  ],
68
79
  context: {
69
- total: null,
70
- maxOutput: null
80
+ type: "token",
81
+ total: 8192,
82
+ maxOutput: 4096
71
83
  }
72
84
  },
73
85
  {
74
- id: "whisper-large-v3-turbo",
75
- name: "Whisper Large v3 Turbo",
76
- license: "mit",
77
- providers: [
78
- "openai",
79
- "azure",
80
- "groq"
81
- ],
82
- can: [
83
- "sound-in",
84
- "text-out"
85
- ],
86
- context: {
87
- total: null,
88
- maxOutput: null
86
+ id: "gpt-4-turbo-preview",
87
+ extends: "gpt-4",
88
+ overrides: {
89
+ name: "GPT-4 Turbo",
90
+ context: {
91
+ type: "token",
92
+ total: 128e3,
93
+ maxOutput: 4096
94
+ }
89
95
  }
90
96
  },
91
97
  {
92
- id: "tts-1",
93
- name: "TTS-1",
98
+ id: "gpt-3.5-turbo",
99
+ name: "GPT-3.5 Turbo",
94
100
  license: "proprietary",
95
101
  providers: [
96
102
  "openai",
97
103
  "azure"
98
104
  ],
99
105
  can: [
106
+ "chat",
100
107
  "text-in",
101
- "sound-out"
108
+ "text-out",
109
+ "json-out",
110
+ "function-out"
102
111
  ],
103
112
  context: {
104
- total: null,
105
- maxOutput: null
113
+ type: "token",
114
+ total: 16385,
115
+ maxOutput: 4096
106
116
  }
107
117
  },
108
118
  {
109
- id: "tts-1-hd",
110
- name: "TTS-1 HD",
119
+ id: "gpt-3.5-turbo-16k",
120
+ extends: "gpt-3.5-turbo",
121
+ overrides: {
122
+ name: "GPT-3.5 Turbo 16K",
123
+ context: {
124
+ type: "token",
125
+ total: 16385,
126
+ maxOutput: 4096
127
+ }
128
+ }
129
+ },
130
+ {
131
+ id: "gpt-3.5-turbo-instruct",
132
+ name: "GPT-3.5 Turbo Instruct",
111
133
  license: "proprietary",
112
134
  providers: [
113
135
  "openai",
@@ -115,11 +137,12 @@ var openai_models_default = {
115
137
  ],
116
138
  can: [
117
139
  "text-in",
118
- "sound-out"
140
+ "text-out"
119
141
  ],
120
142
  context: {
121
- total: null,
122
- maxOutput: null
143
+ type: "token",
144
+ total: 4096,
145
+ maxOutput: 4096
123
146
  }
124
147
  },
125
148
  {
@@ -132,32 +155,184 @@ var openai_models_default = {
132
155
  ],
133
156
  can: [
134
157
  "chat",
158
+ "text-in",
159
+ "text-out",
135
160
  "img-in",
136
161
  "json-out",
137
162
  "function-out"
138
163
  ],
139
164
  context: {
165
+ type: "token",
140
166
  total: 128e3,
141
167
  maxOutput: 16384
142
168
  }
143
169
  },
170
+ {
171
+ id: "chatgpt-4o-latest",
172
+ extends: "gpt-4o",
173
+ overrides: {
174
+ name: "GPT-4o used in ChatGPT"
175
+ }
176
+ },
177
+ {
178
+ id: "gpt-4o-2024-11-20",
179
+ extends: "gpt-4o",
180
+ overrides: {
181
+ name: "GPT-4o (2024-11-20)"
182
+ }
183
+ },
184
+ {
185
+ id: "gpt-4o-2024-08-06",
186
+ extends: "gpt-4o",
187
+ overrides: {
188
+ name: "GPT-4o (2024-08-06)"
189
+ }
190
+ },
191
+ {
192
+ id: "gpt-4o-2024-05-13",
193
+ extends: "gpt-4o",
194
+ overrides: {
195
+ name: "GPT-4o (2024-05-13)",
196
+ context: {
197
+ type: "token",
198
+ total: 128e3,
199
+ maxOutput: 4096
200
+ }
201
+ }
202
+ },
144
203
  {
145
204
  id: "gpt-4o-mini",
146
- name: "GPT-4O Mini",
147
- license: "proprietary",
148
- providers: [
149
- "openai",
150
- "azure"
151
- ],
152
- can: [
153
- "chat",
154
- "img-in",
155
- "json-out",
156
- "function-out"
157
- ],
158
- context: {
159
- total: 128e3,
160
- maxOutput: 16384
205
+ extends: "gpt-4o",
206
+ overrides: {
207
+ name: "GPT-4o Mini",
208
+ context: {
209
+ type: "token",
210
+ total: 128e3,
211
+ maxOutput: 16384
212
+ }
213
+ }
214
+ },
215
+ {
216
+ id: "gpt-4o-audio-preview",
217
+ extends: "gpt-4o",
218
+ overrides: {
219
+ name: "GPT-4o Audio",
220
+ can: [
221
+ "chat",
222
+ "text-in",
223
+ "text-out",
224
+ "sound-in",
225
+ "json-out",
226
+ "function-out"
227
+ ],
228
+ context: {
229
+ type: "token",
230
+ total: 128e3,
231
+ maxOutput: 16384
232
+ }
233
+ }
234
+ },
235
+ {
236
+ id: "gpt-4o-audio-preview-2024-12-17",
237
+ extends: "gpt-4o-audio-preview",
238
+ overrides: {
239
+ name: "GPT-4o Audio (2024-12-17)"
240
+ }
241
+ },
242
+ {
243
+ id: "gpt-4o-audio-preview-2024-10-01",
244
+ extends: "gpt-4o-audio-preview",
245
+ overrides: {
246
+ name: "GPT-4o Audio (2024-10-01)"
247
+ }
248
+ },
249
+ {
250
+ id: "gpt-4o-mini-audio-preview",
251
+ extends: "gpt-4o-mini",
252
+ overrides: {
253
+ name: "GPT-4o Mini Audio",
254
+ can: [
255
+ "chat",
256
+ "text-in",
257
+ "text-out",
258
+ "sound-in",
259
+ "sound-out",
260
+ "json-out",
261
+ "function-out"
262
+ ],
263
+ context: {
264
+ type: "token",
265
+ total: 128e3,
266
+ maxOutput: 16384
267
+ }
268
+ }
269
+ },
270
+ {
271
+ id: "gpt-4o-mini-audio-preview-2024-12-17",
272
+ extends: "gpt-4o-mini-audio-preview",
273
+ overrides: {
274
+ name: "GPT-4o Mini Audio (2024-12-17)"
275
+ }
276
+ },
277
+ {
278
+ id: "gpt-4o-realtime-preview",
279
+ extends: "gpt-4o",
280
+ overrides: {
281
+ name: "GPT-4o Realtime",
282
+ can: [
283
+ "chat",
284
+ "text-in",
285
+ "text-out",
286
+ "sound-in",
287
+ "json-out",
288
+ "function-out"
289
+ ],
290
+ context: {
291
+ type: "token",
292
+ total: 128e3,
293
+ maxOutput: 4096
294
+ }
295
+ }
296
+ },
297
+ {
298
+ id: "gpt-4o-realtime-preview-2024-12-17",
299
+ extends: "gpt-4o-realtime-preview",
300
+ overrides: {
301
+ name: "GPT-4o Realtime (2024-12-17)"
302
+ }
303
+ },
304
+ {
305
+ id: "gpt-4o-realtime-preview-2024-10-01",
306
+ extends: "gpt-4o-realtime-preview",
307
+ overrides: {
308
+ name: "GPT-4o Realtime (2024-10-01)"
309
+ }
310
+ },
311
+ {
312
+ id: "gpt-4o-mini-realtime-preview",
313
+ extends: "gpt-4o-mini",
314
+ overrides: {
315
+ name: "GPT-4o Mini Realtime",
316
+ can: [
317
+ "chat",
318
+ "text-in",
319
+ "text-out",
320
+ "sound-in",
321
+ "json-out",
322
+ "function-out"
323
+ ],
324
+ context: {
325
+ type: "token",
326
+ total: 128e3,
327
+ maxOutput: 4096
328
+ }
329
+ }
330
+ },
331
+ {
332
+ id: "gpt-4o-mini-realtime-preview-2024-12-17",
333
+ extends: "gpt-4o-mini-realtime-preview",
334
+ overrides: {
335
+ name: "GPT-4o Mini Realtime (2024-12-17)"
161
336
  }
162
337
  },
163
338
  {
@@ -170,19 +345,75 @@ var openai_models_default = {
170
345
  ],
171
346
  can: [
172
347
  "chat",
348
+ "text-in",
349
+ "text-out",
173
350
  "img-in",
174
351
  "json-out",
175
352
  "function-out",
176
353
  "reason"
177
354
  ],
178
355
  context: {
356
+ type: "token",
179
357
  total: 2e5,
180
358
  maxOutput: 1e5
181
359
  }
182
360
  },
361
+ {
362
+ id: "o1-2024-12-17",
363
+ extends: "o1",
364
+ overrides: {
365
+ name: "OpenAI O1 (2024-12-17)"
366
+ }
367
+ },
183
368
  {
184
369
  id: "o1-mini",
185
- name: "OpenAI O1 Mini",
370
+ extends: "o1",
371
+ overrides: {
372
+ name: "OpenAI O1 Mini",
373
+ can: [
374
+ "chat",
375
+ "text-in",
376
+ "text-out",
377
+ "json-out",
378
+ "function-out",
379
+ "reason"
380
+ ],
381
+ context: {
382
+ type: "token",
383
+ total: 128e3,
384
+ maxOutput: 65536
385
+ }
386
+ }
387
+ },
388
+ {
389
+ id: "o1-mini-2024-09-12",
390
+ extends: "o1-mini",
391
+ overrides: {
392
+ name: "OpenAI O1 Mini (2024-09-12)"
393
+ }
394
+ },
395
+ {
396
+ id: "o1-preview",
397
+ extends: "o1",
398
+ overrides: {
399
+ name: "OpenAI O1 Preview",
400
+ context: {
401
+ type: "token",
402
+ total: 128e3,
403
+ maxOutput: 32768
404
+ }
405
+ }
406
+ },
407
+ {
408
+ id: "o1-preview-2024-09-12",
409
+ extends: "o1-preview",
410
+ overrides: {
411
+ name: "OpenAI O1 Preview (2024-09-12)"
412
+ }
413
+ },
414
+ {
415
+ id: "o3-mini",
416
+ name: "OpenAI O3 Mini",
186
417
  license: "proprietary",
187
418
  providers: [
188
419
  "openai",
@@ -190,70 +421,89 @@ var openai_models_default = {
190
421
  ],
191
422
  can: [
192
423
  "chat",
424
+ "text-in",
425
+ "text-out",
193
426
  "json-out",
194
427
  "function-out",
195
428
  "reason"
196
429
  ],
197
430
  context: {
198
- total: 128e3,
199
- maxOutput: 65536
431
+ type: "token",
432
+ total: 2e5,
433
+ maxOutput: 1e5
200
434
  }
201
435
  },
202
436
  {
203
- id: "o3-mini",
204
- name: "OpenAI O3 Mini",
437
+ id: "o3-mini-2025-01-31",
438
+ extends: "o3-mini",
439
+ overrides: {
440
+ name: "OpenAI O3 Mini (2025-01-31)"
441
+ }
442
+ },
443
+ {
444
+ id: "whisper-1",
445
+ name: "Whisper",
205
446
  license: "proprietary",
206
447
  providers: [
207
448
  "openai",
208
449
  "azure"
209
450
  ],
210
451
  can: [
211
- "chat",
212
- "json-out",
213
- "function-out",
214
- "reason"
452
+ "sound-in",
453
+ "text-out"
215
454
  ],
216
455
  context: {
217
- total: 2e5,
218
- maxOutput: 1e5
456
+ type: "audio-in",
457
+ total: null,
458
+ maxOutput: null
219
459
  }
220
460
  },
221
461
  {
222
- id: "gpt-4o-audio-preview",
223
- name: "GPT-4O Audio",
462
+ id: "tts-1",
463
+ name: "TTS-1",
224
464
  license: "proprietary",
225
465
  providers: [
226
466
  "openai",
227
467
  "azure"
228
468
  ],
229
469
  can: [
230
- "chat",
231
- "sound-in",
232
- "json-out",
233
- "function-out"
470
+ "text-in",
471
+ "sound-out"
234
472
  ],
235
473
  context: {
236
- total: 128e3,
237
- maxOutput: 16384
474
+ type: "audio-out",
475
+ total: null,
476
+ maxOutput: null
238
477
  }
239
478
  },
240
479
  {
241
- id: "gpt-4o-realtime-preview",
242
- name: "GPT-4O Realtime",
480
+ id: "tts-1-hd",
481
+ extends: "tts-1",
482
+ overrides: {
483
+ name: "TTS-1 HD"
484
+ }
485
+ },
486
+ {
487
+ id: "dall-e-2",
488
+ name: "DALL-E 2",
243
489
  license: "proprietary",
244
490
  providers: [
245
491
  "openai",
246
492
  "azure"
247
493
  ],
248
494
  can: [
249
- "chat",
250
- "sound-in",
251
- "json-out",
252
- "function-out"
495
+ "img-out"
253
496
  ],
254
497
  context: {
255
- total: 128e3,
256
- maxOutput: 4096
498
+ maxOutput: 1,
499
+ sizes: [
500
+ "256x256",
501
+ "512x512",
502
+ "1024x1024"
503
+ ],
504
+ qualities: [
505
+ "standard"
506
+ ]
257
507
  }
258
508
  },
259
509
  {
@@ -265,6 +515,7 @@ var openai_models_default = {
265
515
  "azure"
266
516
  ],
267
517
  can: [
518
+ "text-in",
268
519
  "img-out"
269
520
  ],
270
521
  context: {
@@ -279,6 +530,69 @@ var openai_models_default = {
279
530
  "hd"
280
531
  ]
281
532
  }
533
+ },
534
+ {
535
+ id: "text-embedding-ada-002",
536
+ name: "Text Embedding Ada 002",
537
+ license: "proprietary",
538
+ providers: [
539
+ "openai",
540
+ "azure"
541
+ ],
542
+ can: [
543
+ "text-in",
544
+ "vectors-out"
545
+ ],
546
+ context: {
547
+ type: "embedding",
548
+ total: 8191,
549
+ unit: "tokens",
550
+ dimensions: 1536,
551
+ embeddingType: "text",
552
+ normalized: true
553
+ }
554
+ },
555
+ {
556
+ id: "text-embedding-3-small",
557
+ name: "Text Embedding 3 Small",
558
+ license: "proprietary",
559
+ providers: [
560
+ "openai",
561
+ "azure"
562
+ ],
563
+ can: [
564
+ "text-in",
565
+ "vectors-out"
566
+ ],
567
+ context: {
568
+ type: "embedding",
569
+ total: 8191,
570
+ unit: "tokens",
571
+ dimensions: 1536,
572
+ embeddingType: "text",
573
+ normalized: true
574
+ }
575
+ },
576
+ {
577
+ id: "text-embedding-3-large",
578
+ name: "Text Embedding 3 Large",
579
+ license: "proprietary",
580
+ providers: [
581
+ "openai",
582
+ "azure"
583
+ ],
584
+ can: [
585
+ "text-in",
586
+ "vectors-out"
587
+ ],
588
+ context: {
589
+ type: "embedding",
590
+ total: 8191,
591
+ unit: "tokens",
592
+ dimensions: 3072,
593
+ embeddingType: "text",
594
+ normalized: true
595
+ }
282
596
  }
283
597
  ]
284
598
  };
@@ -288,14 +602,10 @@ var anthropic_models_default = {
288
602
  creator: "anthropic",
289
603
  models: [
290
604
  {
291
- id: "claude-3-opus-20240229",
605
+ id: "claude-3-opus",
292
606
  name: "Claude 3 Opus",
293
607
  license: "proprietary",
294
- providers: [
295
- "anthropic",
296
- "aws",
297
- "google"
298
- ],
608
+ providers: ["anthropic", "aws", "google"],
299
609
  can: [
300
610
  "chat",
301
611
  "text-in",
@@ -305,20 +615,25 @@ var anthropic_models_default = {
305
615
  "function-out"
306
616
  ],
307
617
  context: {
618
+ type: "token",
308
619
  total: 2e5,
309
620
  maxOutput: 4096,
310
621
  outputIsFixed: 1
622
+ },
623
+ aliases: ["claude-3-opus-latest"]
624
+ },
625
+ {
626
+ id: "claude-3-opus-20240229",
627
+ extends: "claude-3-opus",
628
+ overrides: {
629
+ name: "Claude 3 Opus (2024-02-29)"
311
630
  }
312
631
  },
313
632
  {
314
- id: "claude-3-5-sonnet-20241022",
633
+ id: "claude-3-sonnet",
315
634
  name: "Claude 3 Sonnet",
316
635
  license: "proprietary",
317
- providers: [
318
- "anthropic",
319
- "aws",
320
- "google"
321
- ],
636
+ providers: ["anthropic", "aws", "google"],
322
637
  can: [
323
638
  "chat",
324
639
  "text-in",
@@ -328,20 +643,52 @@ var anthropic_models_default = {
328
643
  "function-out"
329
644
  ],
330
645
  context: {
646
+ type: "token",
331
647
  total: 2e5,
332
- maxOutput: 8192,
648
+ maxOutput: 4096,
333
649
  outputIsFixed: 1
650
+ },
651
+ aliases: ["claude-3-sonnet-latest"]
652
+ },
653
+ {
654
+ id: "claude-3-sonnet-20240229",
655
+ extends: "claude-3-sonnet",
656
+ overrides: {
657
+ name: "Claude 3 Sonnet (2024-02-29)"
334
658
  }
335
659
  },
336
660
  {
337
- id: "claude-3-5-haiku-20241022",
661
+ id: "claude-3-haiku",
338
662
  name: "Claude 3 Haiku",
339
663
  license: "proprietary",
340
- providers: [
341
- "anthropic",
342
- "aws",
343
- "google"
664
+ providers: ["anthropic", "aws", "google"],
665
+ can: [
666
+ "chat",
667
+ "text-in",
668
+ "text-out",
669
+ "img-in",
670
+ "json-out",
671
+ "function-out"
344
672
  ],
673
+ context: {
674
+ type: "token",
675
+ total: 2e5,
676
+ maxOutput: 4096,
677
+ outputIsFixed: 1
678
+ }
679
+ },
680
+ {
681
+ id: "claude-3-haiku-20240307",
682
+ extends: "claude-3-haiku",
683
+ overrides: {
684
+ name: "Claude 3 Haiku (2024-03-07)"
685
+ }
686
+ },
687
+ {
688
+ id: "claude-3-5-sonnet",
689
+ name: "Claude 3.5 Sonnet",
690
+ license: "proprietary",
691
+ providers: ["anthropic", "aws", "google"],
345
692
  can: [
346
693
  "chat",
347
694
  "text-in",
@@ -351,9 +698,45 @@ var anthropic_models_default = {
351
698
  "function-out"
352
699
  ],
353
700
  context: {
701
+ type: "token",
702
+ total: 2e5,
703
+ maxOutput: 8192,
704
+ outputIsFixed: 1
705
+ },
706
+ aliases: ["claude-3-5-sonnet-latest"]
707
+ },
708
+ {
709
+ id: "claude-3-5-sonnet-20241022",
710
+ extends: "claude-3-5-sonnet",
711
+ overrides: {
712
+ name: "Claude 3.5 Sonnet (2024-10-22)"
713
+ }
714
+ },
715
+ {
716
+ id: "claude-3-5-haiku",
717
+ name: "Claude 3.5 Haiku",
718
+ license: "proprietary",
719
+ providers: ["anthropic", "aws", "google"],
720
+ can: [
721
+ "chat",
722
+ "text-in",
723
+ "text-out",
724
+ "json-out",
725
+ "function-out"
726
+ ],
727
+ context: {
728
+ type: "token",
354
729
  total: 2e5,
355
730
  maxOutput: 8192,
356
731
  outputIsFixed: 1
732
+ },
733
+ aliases: ["claude-3-5-haiku-latest"]
734
+ },
735
+ {
736
+ id: "claude-3-5-haiku-20241022",
737
+ extends: "claude-3-5-haiku",
738
+ overrides: {
739
+ name: "Claude 3.5 Haiku (2024-10-22)"
357
740
  }
358
741
  }
359
742
  ]
@@ -370,6 +753,7 @@ var meta_models_default = {
370
753
  providers: ["groq"],
371
754
  can: ["chat", "text-in", "text-out", "json-out", "function-out"],
372
755
  context: {
756
+ type: "token",
373
757
  total: 8192,
374
758
  maxOutput: 4096
375
759
  }
@@ -381,6 +765,7 @@ var meta_models_default = {
381
765
  providers: ["groq"],
382
766
  can: ["chat", "text-in", "text-out", "json-out", "function-out"],
383
767
  context: {
768
+ type: "token",
384
769
  total: 8192,
385
770
  maxOutput: 4096
386
771
  }
@@ -392,6 +777,7 @@ var meta_models_default = {
392
777
  providers: ["groq"],
393
778
  can: ["chat", "text-in", "text-out", "img-in"],
394
779
  context: {
780
+ type: "token",
395
781
  total: 4096,
396
782
  maxOutput: 4096
397
783
  }
@@ -403,6 +789,7 @@ var meta_models_default = {
403
789
  providers: ["groq"],
404
790
  can: ["chat", "text-in", "text-out", "img-in"],
405
791
  context: {
792
+ type: "token",
406
793
  total: 4096,
407
794
  maxOutput: 4096
408
795
  }
@@ -414,6 +801,7 @@ var meta_models_default = {
414
801
  providers: ["groq"],
415
802
  can: ["chat", "text-in", "text-out"],
416
803
  context: {
804
+ type: "token",
417
805
  total: 4096,
418
806
  maxOutput: 4096
419
807
  }
@@ -438,6 +826,7 @@ var mistral_models_default = {
438
826
  "function-out"
439
827
  ],
440
828
  context: {
829
+ type: "token",
441
830
  total: 32768,
442
831
  maxOutput: 4096
443
832
  }
@@ -455,6 +844,7 @@ var mistral_models_default = {
455
844
  "function-out"
456
845
  ],
457
846
  context: {
847
+ type: "token",
458
848
  total: 32768,
459
849
  maxOutput: 4096
460
850
  }
@@ -470,6 +860,7 @@ var mistral_models_default = {
470
860
  "text-out"
471
861
  ],
472
862
  context: {
863
+ type: "token",
473
864
  total: 32768,
474
865
  maxOutput: 4096
475
866
  }
@@ -485,6 +876,7 @@ var mistral_models_default = {
485
876
  "text-out"
486
877
  ],
487
878
  context: {
879
+ type: "token",
488
880
  total: 32768,
489
881
  maxOutput: 4096
490
882
  }
@@ -500,6 +892,7 @@ var mistral_models_default = {
500
892
  "text-out"
501
893
  ],
502
894
  context: {
895
+ type: "token",
503
896
  total: 32768,
504
897
  maxOutput: 4096
505
898
  }
@@ -518,6 +911,7 @@ var google_models_default = {
518
911
  providers: ["google"],
519
912
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in", "reason"],
520
913
  context: {
914
+ type: "token",
521
915
  total: 1048576,
522
916
  maxOutput: 8192
523
917
  },
@@ -530,6 +924,7 @@ var google_models_default = {
530
924
  providers: ["google"],
531
925
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in"],
532
926
  context: {
927
+ type: "token",
533
928
  total: 1048576,
534
929
  maxOutput: 8192
535
930
  },
@@ -542,6 +937,7 @@ var google_models_default = {
542
937
  providers: ["google"],
543
938
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in"],
544
939
  context: {
940
+ type: "token",
545
941
  total: 2097152,
546
942
  maxOutput: 8192
547
943
  }
@@ -553,6 +949,7 @@ var google_models_default = {
553
949
  providers: ["google"],
554
950
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in"],
555
951
  context: {
952
+ type: "token",
556
953
  total: 2097152,
557
954
  maxOutput: 8192
558
955
  }
@@ -564,6 +961,7 @@ var google_models_default = {
564
961
  providers: ["google"],
565
962
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in", "reason"],
566
963
  context: {
964
+ type: "token",
567
965
  total: 2097152,
568
966
  maxOutput: 8192
569
967
  },
@@ -576,6 +974,7 @@ var google_models_default = {
576
974
  providers: ["google"],
577
975
  can: ["text-in", "vectors-out"],
578
976
  context: {
977
+ type: "token",
579
978
  total: 2048,
580
979
  maxOutput: 768
581
980
  }
@@ -587,6 +986,7 @@ var google_models_default = {
587
986
  providers: ["google"],
588
987
  can: ["chat", "text-in", "text-out", "json-out", "function-out"],
589
988
  context: {
989
+ type: "token",
590
990
  total: 8192,
591
991
  maxOutput: 4096
592
992
  }
@@ -598,6 +998,7 @@ var google_models_default = {
598
998
  providers: ["google"],
599
999
  can: ["chat", "text-in", "text-out", "json-out", "function-out"],
600
1000
  context: {
1001
+ type: "token",
601
1002
  total: 8192,
602
1003
  maxOutput: 4096
603
1004
  }
@@ -622,6 +1023,7 @@ var deepseek_models_default = {
622
1023
  "function-out"
623
1024
  ],
624
1025
  context: {
1026
+ type: "token",
625
1027
  total: 131072,
626
1028
  maxOutput: 8192
627
1029
  }
@@ -640,6 +1042,7 @@ var deepseek_models_default = {
640
1042
  "reason"
641
1043
  ],
642
1044
  context: {
1045
+ type: "token",
643
1046
  total: 131072,
644
1047
  maxOutput: 8192
645
1048
  }
@@ -659,6 +1062,7 @@ var xai_models_default = {
659
1062
  providers: ["xai"],
660
1063
  can: ["chat", "text-in", "text-out", "img-in"],
661
1064
  context: {
1065
+ type: "token",
662
1066
  total: 32768,
663
1067
  maxOutput: 4096
664
1068
  },
@@ -672,6 +1076,7 @@ var xai_models_default = {
672
1076
  providers: ["xai"],
673
1077
  can: ["chat", "text-in", "text-out"],
674
1078
  context: {
1079
+ type: "token",
675
1080
  total: 131072,
676
1081
  maxOutput: 4096
677
1082
  },
@@ -685,6 +1090,7 @@ var xai_models_default = {
685
1090
  providers: ["xai"],
686
1091
  can: ["chat", "text-in", "text-out", "img-in"],
687
1092
  context: {
1093
+ type: "token",
688
1094
  total: 8192,
689
1095
  maxOutput: 4096
690
1096
  }
@@ -697,6 +1103,7 @@ var xai_models_default = {
697
1103
  providers: ["xai"],
698
1104
  can: ["chat", "text-in", "text-out"],
699
1105
  context: {
1106
+ type: "token",
700
1107
  total: 131072,
701
1108
  maxOutput: 4096
702
1109
  }
@@ -716,6 +1123,7 @@ var cohere_models_default = {
716
1123
  providers: ["cohere"],
717
1124
  can: ["chat", "text-in", "text-out", "reason", "function-out"],
718
1125
  context: {
1126
+ type: "token",
719
1127
  total: 128e3,
720
1128
  maxOutput: 4096
721
1129
  }
@@ -728,6 +1136,7 @@ var cohere_models_default = {
728
1136
  providers: ["cohere", "bedrock", "azure", "oracle"],
729
1137
  can: ["chat", "text-in", "text-out", "reason", "function-out"],
730
1138
  context: {
1139
+ type: "token",
731
1140
  total: 128e3,
732
1141
  maxOutput: 4096
733
1142
  },
@@ -741,6 +1150,7 @@ var cohere_models_default = {
741
1150
  providers: ["cohere", "bedrock", "azure", "oracle"],
742
1151
  can: ["chat", "text-in", "text-out", "reason", "function-out"],
743
1152
  context: {
1153
+ type: "token",
744
1154
  total: 128e3,
745
1155
  maxOutput: 4096
746
1156
  },
@@ -754,6 +1164,7 @@ var cohere_models_default = {
754
1164
  providers: ["cohere", "bedrock", "oracle"],
755
1165
  can: ["chat", "text-in", "text-out"],
756
1166
  context: {
1167
+ type: "token",
757
1168
  total: 4096,
758
1169
  maxOutput: 4096
759
1170
  }
@@ -766,6 +1177,7 @@ var cohere_models_default = {
766
1177
  providers: ["cohere", "bedrock", "oracle"],
767
1178
  can: ["chat", "text-in", "text-out"],
768
1179
  context: {
1180
+ type: "token",
769
1181
  total: 4096,
770
1182
  maxOutput: 4096
771
1183
  }
@@ -778,6 +1190,7 @@ var cohere_models_default = {
778
1190
  providers: ["cohere", "bedrock", "azure", "oracle"],
779
1191
  can: ["text-in", "img-in", "vectors-out"],
780
1192
  context: {
1193
+ type: "token",
781
1194
  total: 512,
782
1195
  maxOutput: 1024
783
1196
  }
@@ -790,6 +1203,7 @@ var cohere_models_default = {
790
1203
  providers: ["cohere", "oracle"],
791
1204
  can: ["text-in", "img-in", "vectors-out"],
792
1205
  context: {
1206
+ type: "token",
793
1207
  total: 512,
794
1208
  maxOutput: 384
795
1209
  }
@@ -802,6 +1216,7 @@ var cohere_models_default = {
802
1216
  providers: ["cohere", "bedrock", "azure", "oracle"],
803
1217
  can: ["text-in", "img-in", "vectors-out"],
804
1218
  context: {
1219
+ type: "token",
805
1220
  total: 512,
806
1221
  maxOutput: 1024
807
1222
  }
@@ -814,6 +1229,7 @@ var cohere_models_default = {
814
1229
  providers: ["cohere", "oracle"],
815
1230
  can: ["text-in", "img-in", "vectors-out"],
816
1231
  context: {
1232
+ type: "token",
817
1233
  total: 512,
818
1234
  maxOutput: 384
819
1235
  }
@@ -826,6 +1242,7 @@ var cohere_models_default = {
826
1242
  providers: ["cohere", "bedrock", "azure"],
827
1243
  can: ["text-in", "text-out"],
828
1244
  context: {
1245
+ type: "token",
829
1246
  total: 4096,
830
1247
  maxOutput: null
831
1248
  }
@@ -838,6 +1255,7 @@ var cohere_models_default = {
838
1255
  providers: ["cohere", "azure"],
839
1256
  can: ["text-in", "text-out"],
840
1257
  context: {
1258
+ type: "token",
841
1259
  total: 4096,
842
1260
  maxOutput: null
843
1261
  }
@@ -850,6 +1268,7 @@ var cohere_models_default = {
850
1268
  providers: ["cohere", "azure"],
851
1269
  can: ["text-in", "text-out"],
852
1270
  context: {
1271
+ type: "token",
853
1272
  total: 4096,
854
1273
  maxOutput: null
855
1274
  }
@@ -869,6 +1288,19 @@ function validateModel(raw) {
869
1288
  throw new Error(`Model ${field} must be a string`);
870
1289
  }
871
1290
  }
1291
+ if (model.extends !== void 0 && typeof model.extends !== "string") {
1292
+ throw new Error("Model extends must be a string");
1293
+ }
1294
+ if (model.overrides !== void 0) {
1295
+ if (typeof model.overrides !== "object" || model.overrides === null) {
1296
+ throw new Error("Model overrides must be an object");
1297
+ }
1298
+ const validOverrideFields = ["name", "creator", "license", "providers", "can", "languages", "aliases", "context"];
1299
+ const invalidFields = Object.keys(model.overrides).filter((field) => !validOverrideFields.includes(field));
1300
+ if (invalidFields.length > 0) {
1301
+ throw new Error(`Invalid override fields: ${invalidFields.join(", ")}`);
1302
+ }
1303
+ }
872
1304
  if (!Array.isArray(model.providers)) {
873
1305
  throw new Error("Model providers must be an array");
874
1306
  }
@@ -910,6 +1342,16 @@ function validateModel(raw) {
910
1342
  if (typeof context.maxOutput !== "number") {
911
1343
  throw new Error("Image model context.maxOutput must be a number");
912
1344
  }
1345
+ } else if (context.type === "embedding") {
1346
+ if (typeof context.total !== "number") {
1347
+ throw new Error("Embedding model context.total must be a number");
1348
+ }
1349
+ if (typeof context.unit !== "string") {
1350
+ throw new Error("Embedding model context.unit must be a string");
1351
+ }
1352
+ if (typeof context.dimensions !== "number") {
1353
+ throw new Error("Embedding model context.dimensions must be a number");
1354
+ }
913
1355
  } else {
914
1356
  if (typeof context.total !== "number" && context.total !== null) {
915
1357
  throw new Error("Token model context.total must be a number or null");
@@ -927,8 +1369,41 @@ function validateModel(raw) {
927
1369
  can: model.can,
928
1370
  context: model.context,
929
1371
  ...model.languages ? { languages: model.languages } : {},
930
- ...model.aliases ? { aliases: model.aliases } : {}
1372
+ ...model.aliases ? { aliases: model.aliases } : {},
1373
+ ...model.extends ? { extends: model.extends } : {},
1374
+ ...model.overrides ? { overrides: model.overrides } : {}
1375
+ };
1376
+ }
1377
+ function resolveModel(model, allModels2, visited = /* @__PURE__ */ new Set()) {
1378
+ if (!model.extends) {
1379
+ return model;
1380
+ }
1381
+ if (visited.has(model.id)) {
1382
+ throw new Error(`Circular dependency detected for model ${model.id}`);
1383
+ }
1384
+ visited.add(model.id);
1385
+ const baseModel = allModels2[model.extends];
1386
+ if (!baseModel) {
1387
+ throw new Error(`Base model ${model.extends} not found for ${model.id}`);
1388
+ }
1389
+ const resolvedBase = resolveModel(baseModel, allModels2, visited);
1390
+ if (!model.overrides) {
1391
+ return {
1392
+ ...resolvedBase,
1393
+ id: model.id,
1394
+ extends: model.extends
1395
+ };
1396
+ }
1397
+ const resolved = {
1398
+ ...resolvedBase,
1399
+ ...model.overrides,
1400
+ id: model.id,
1401
+ extends: model.extends
931
1402
  };
1403
+ if (!resolved.name || !resolved.creator || !resolved.license || !resolved.providers || !resolved.can || !resolved.context) {
1404
+ throw new Error(`Missing required fields in resolved model ${model.id}`);
1405
+ }
1406
+ return resolved;
932
1407
  }
933
1408
  function buildAllModels() {
934
1409
  const allModelData = [
@@ -942,12 +1417,29 @@ function buildAllModels() {
942
1417
  cohere_models_default
943
1418
  ];
944
1419
  const allModels2 = allModelData.flatMap(
945
- (data) => data.models.map((model) => ({
946
- ...model,
947
- creator: data.creator
948
- }))
1420
+ (data) => data.models.map((model) => {
1421
+ if (typeof model.id !== "string") {
1422
+ throw new Error(`Model id must be a string`);
1423
+ }
1424
+ if (model.extends !== void 0 && typeof model.extends !== "string") {
1425
+ throw new Error("Model extends must be a string");
1426
+ }
1427
+ if (model.overrides !== void 0 && (typeof model.overrides !== "object" || model.overrides === null)) {
1428
+ throw new Error("Model overrides must be an object");
1429
+ }
1430
+ return {
1431
+ ...model,
1432
+ creator: data.creator
1433
+ };
1434
+ })
1435
+ );
1436
+ const modelMap = Object.fromEntries(
1437
+ allModels2.map((model) => [model.id, model])
1438
+ );
1439
+ const resolvedModels = allModels2.map(
1440
+ (model) => resolveModel(model, modelMap)
949
1441
  );
950
- return allModels2.map((model) => validateModel(model));
1442
+ return resolvedModels.map((model) => validateModel(model));
951
1443
  }
952
1444
 
953
1445
  // src/data/providers/openai-provider.json
@@ -1173,30 +1665,41 @@ var creators_default = {
1173
1665
  // src/index.ts
1174
1666
  var allModels = buildAllModels();
1175
1667
  var providersData = buildProvidersData();
1176
- var ModelsCollection = class extends ModelCollection {
1668
+ var AIModels = class _AIModels extends ModelCollection {
1669
+ constructor(models2 = []) {
1670
+ super(models2);
1671
+ Object.setPrototypeOf(this, _AIModels.prototype);
1672
+ }
1177
1673
  get creators() {
1178
1674
  return Object.keys(creators_default.creators);
1179
1675
  }
1180
1676
  get providers() {
1181
1677
  return providersData.providers.map((p) => p.id);
1182
1678
  }
1183
- fromCreator(creator) {
1184
- return new ModelCollection(
1185
- this.filter(
1186
- (model) => model.license.startsWith(creator) || // For open source models
1187
- !!providersData.providers.find((p) => p.id === creator)?.models[model.id]
1188
- // For proprietary models
1189
- )
1190
- );
1191
- }
1192
1679
  getPrice(modelId, provider) {
1193
1680
  const providerData = providersData.providers.find((p) => p.id === provider);
1194
1681
  const price = providerData?.models[modelId];
1195
1682
  return price?.type === "token" ? price : void 0;
1196
1683
  }
1684
+ /** Get provider information by ID */
1685
+ getProvider(providerId) {
1686
+ return providersData.providers.find((p) => p.id === providerId);
1687
+ }
1688
+ /** Get all providers that can serve a specific model */
1689
+ getProvidersForModel(modelId) {
1690
+ let model = this.id(modelId);
1691
+ if (!model) {
1692
+ model = this.find((m) => m.aliases?.includes(modelId));
1693
+ }
1694
+ if (!model) return [];
1695
+ return providersData.providers.filter(
1696
+ (p) => model.providers.includes(p.id)
1697
+ );
1698
+ }
1197
1699
  };
1198
- var models = new ModelsCollection(allModels);
1700
+ var models = new AIModels(allModels);
1199
1701
  export {
1702
+ AIModels,
1200
1703
  ModelCollection,
1201
1704
  creators_default as creators,
1202
1705
  models