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.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ AIModels: () => AIModels,
23
24
  ModelCollection: () => ModelCollection,
24
25
  creators: () => creators_default,
25
26
  models: () => models
@@ -64,11 +65,20 @@ var ModelCollection = class _ModelCollection extends Array {
64
65
  fromProvider(provider) {
65
66
  return this.filter((model) => model.providers.includes(provider));
66
67
  }
68
+ /** Get models available from a specific creator */
69
+ fromCreator(creator) {
70
+ return new _ModelCollection(
71
+ this.filter((model) => model.creator === creator)
72
+ );
73
+ }
67
74
  /** Filter models by minimum context window size */
68
75
  withMinContext(tokens) {
69
76
  return this.filter((model) => {
70
77
  const context = model.context;
71
- if (!("total" in context) || context.total === null) {
78
+ if (context.type !== "token" && context.type !== "character") {
79
+ return false;
80
+ }
81
+ if (context.total === null) {
72
82
  return false;
73
83
  }
74
84
  return context.total >= tokens;
@@ -81,61 +91,74 @@ var openai_models_default = {
81
91
  creator: "openai",
82
92
  models: [
83
93
  {
84
- id: "whisper-large-v3",
85
- name: "Whisper Large v3",
86
- license: "mit",
94
+ id: "gpt-4",
95
+ name: "GPT-4",
96
+ license: "proprietary",
87
97
  providers: [
88
98
  "openai",
89
- "azure",
90
- "groq"
99
+ "azure"
91
100
  ],
92
101
  can: [
93
- "sound-in",
94
- "text-out"
102
+ "chat",
103
+ "text-in",
104
+ "text-out",
105
+ "json-out",
106
+ "function-out"
95
107
  ],
96
108
  context: {
97
- total: null,
98
- maxOutput: null
109
+ type: "token",
110
+ total: 8192,
111
+ maxOutput: 4096
99
112
  }
100
113
  },
101
114
  {
102
- id: "whisper-large-v3-turbo",
103
- name: "Whisper Large v3 Turbo",
104
- license: "mit",
105
- providers: [
106
- "openai",
107
- "azure",
108
- "groq"
109
- ],
110
- can: [
111
- "sound-in",
112
- "text-out"
113
- ],
114
- context: {
115
- total: null,
116
- maxOutput: null
115
+ id: "gpt-4-turbo-preview",
116
+ extends: "gpt-4",
117
+ overrides: {
118
+ name: "GPT-4 Turbo",
119
+ context: {
120
+ type: "token",
121
+ total: 128e3,
122
+ maxOutput: 4096
123
+ }
117
124
  }
118
125
  },
119
126
  {
120
- id: "tts-1",
121
- name: "TTS-1",
127
+ id: "gpt-3.5-turbo",
128
+ name: "GPT-3.5 Turbo",
122
129
  license: "proprietary",
123
130
  providers: [
124
131
  "openai",
125
132
  "azure"
126
133
  ],
127
134
  can: [
135
+ "chat",
128
136
  "text-in",
129
- "sound-out"
137
+ "text-out",
138
+ "json-out",
139
+ "function-out"
130
140
  ],
131
141
  context: {
132
- total: null,
133
- maxOutput: null
142
+ type: "token",
143
+ total: 16385,
144
+ maxOutput: 4096
134
145
  }
135
146
  },
136
147
  {
137
- id: "tts-1-hd",
138
- name: "TTS-1 HD",
148
+ id: "gpt-3.5-turbo-16k",
149
+ extends: "gpt-3.5-turbo",
150
+ overrides: {
151
+ name: "GPT-3.5 Turbo 16K",
152
+ context: {
153
+ type: "token",
154
+ total: 16385,
155
+ maxOutput: 4096
156
+ }
157
+ }
158
+ },
159
+ {
160
+ id: "gpt-3.5-turbo-instruct",
161
+ name: "GPT-3.5 Turbo Instruct",
139
162
  license: "proprietary",
140
163
  providers: [
141
164
  "openai",
@@ -143,11 +166,12 @@ var openai_models_default = {
143
166
  ],
144
167
  can: [
145
168
  "text-in",
146
- "sound-out"
169
+ "text-out"
147
170
  ],
148
171
  context: {
149
- total: null,
150
- maxOutput: null
172
+ type: "token",
173
+ total: 4096,
174
+ maxOutput: 4096
151
175
  }
152
176
  },
153
177
  {
@@ -160,32 +184,184 @@ var openai_models_default = {
160
184
  ],
161
185
  can: [
162
186
  "chat",
187
+ "text-in",
188
+ "text-out",
163
189
  "img-in",
164
190
  "json-out",
165
191
  "function-out"
166
192
  ],
167
193
  context: {
194
+ type: "token",
168
195
  total: 128e3,
169
196
  maxOutput: 16384
170
197
  }
171
198
  },
199
+ {
200
+ id: "chatgpt-4o-latest",
201
+ extends: "gpt-4o",
202
+ overrides: {
203
+ name: "GPT-4o used in ChatGPT"
204
+ }
205
+ },
206
+ {
207
+ id: "gpt-4o-2024-11-20",
208
+ extends: "gpt-4o",
209
+ overrides: {
210
+ name: "GPT-4o (2024-11-20)"
211
+ }
212
+ },
213
+ {
214
+ id: "gpt-4o-2024-08-06",
215
+ extends: "gpt-4o",
216
+ overrides: {
217
+ name: "GPT-4o (2024-08-06)"
218
+ }
219
+ },
220
+ {
221
+ id: "gpt-4o-2024-05-13",
222
+ extends: "gpt-4o",
223
+ overrides: {
224
+ name: "GPT-4o (2024-05-13)",
225
+ context: {
226
+ type: "token",
227
+ total: 128e3,
228
+ maxOutput: 4096
229
+ }
230
+ }
231
+ },
172
232
  {
173
233
  id: "gpt-4o-mini",
174
- name: "GPT-4O Mini",
175
- license: "proprietary",
176
- providers: [
177
- "openai",
178
- "azure"
179
- ],
180
- can: [
181
- "chat",
182
- "img-in",
183
- "json-out",
184
- "function-out"
185
- ],
186
- context: {
187
- total: 128e3,
188
- maxOutput: 16384
234
+ extends: "gpt-4o",
235
+ overrides: {
236
+ name: "GPT-4o Mini",
237
+ context: {
238
+ type: "token",
239
+ total: 128e3,
240
+ maxOutput: 16384
241
+ }
242
+ }
243
+ },
244
+ {
245
+ id: "gpt-4o-audio-preview",
246
+ extends: "gpt-4o",
247
+ overrides: {
248
+ name: "GPT-4o Audio",
249
+ can: [
250
+ "chat",
251
+ "text-in",
252
+ "text-out",
253
+ "sound-in",
254
+ "json-out",
255
+ "function-out"
256
+ ],
257
+ context: {
258
+ type: "token",
259
+ total: 128e3,
260
+ maxOutput: 16384
261
+ }
262
+ }
263
+ },
264
+ {
265
+ id: "gpt-4o-audio-preview-2024-12-17",
266
+ extends: "gpt-4o-audio-preview",
267
+ overrides: {
268
+ name: "GPT-4o Audio (2024-12-17)"
269
+ }
270
+ },
271
+ {
272
+ id: "gpt-4o-audio-preview-2024-10-01",
273
+ extends: "gpt-4o-audio-preview",
274
+ overrides: {
275
+ name: "GPT-4o Audio (2024-10-01)"
276
+ }
277
+ },
278
+ {
279
+ id: "gpt-4o-mini-audio-preview",
280
+ extends: "gpt-4o-mini",
281
+ overrides: {
282
+ name: "GPT-4o Mini Audio",
283
+ can: [
284
+ "chat",
285
+ "text-in",
286
+ "text-out",
287
+ "sound-in",
288
+ "sound-out",
289
+ "json-out",
290
+ "function-out"
291
+ ],
292
+ context: {
293
+ type: "token",
294
+ total: 128e3,
295
+ maxOutput: 16384
296
+ }
297
+ }
298
+ },
299
+ {
300
+ id: "gpt-4o-mini-audio-preview-2024-12-17",
301
+ extends: "gpt-4o-mini-audio-preview",
302
+ overrides: {
303
+ name: "GPT-4o Mini Audio (2024-12-17)"
304
+ }
305
+ },
306
+ {
307
+ id: "gpt-4o-realtime-preview",
308
+ extends: "gpt-4o",
309
+ overrides: {
310
+ name: "GPT-4o Realtime",
311
+ can: [
312
+ "chat",
313
+ "text-in",
314
+ "text-out",
315
+ "sound-in",
316
+ "json-out",
317
+ "function-out"
318
+ ],
319
+ context: {
320
+ type: "token",
321
+ total: 128e3,
322
+ maxOutput: 4096
323
+ }
324
+ }
325
+ },
326
+ {
327
+ id: "gpt-4o-realtime-preview-2024-12-17",
328
+ extends: "gpt-4o-realtime-preview",
329
+ overrides: {
330
+ name: "GPT-4o Realtime (2024-12-17)"
331
+ }
332
+ },
333
+ {
334
+ id: "gpt-4o-realtime-preview-2024-10-01",
335
+ extends: "gpt-4o-realtime-preview",
336
+ overrides: {
337
+ name: "GPT-4o Realtime (2024-10-01)"
338
+ }
339
+ },
340
+ {
341
+ id: "gpt-4o-mini-realtime-preview",
342
+ extends: "gpt-4o-mini",
343
+ overrides: {
344
+ name: "GPT-4o Mini Realtime",
345
+ can: [
346
+ "chat",
347
+ "text-in",
348
+ "text-out",
349
+ "sound-in",
350
+ "json-out",
351
+ "function-out"
352
+ ],
353
+ context: {
354
+ type: "token",
355
+ total: 128e3,
356
+ maxOutput: 4096
357
+ }
358
+ }
359
+ },
360
+ {
361
+ id: "gpt-4o-mini-realtime-preview-2024-12-17",
362
+ extends: "gpt-4o-mini-realtime-preview",
363
+ overrides: {
364
+ name: "GPT-4o Mini Realtime (2024-12-17)"
189
365
  }
190
366
  },
191
367
  {
@@ -198,19 +374,75 @@ var openai_models_default = {
198
374
  ],
199
375
  can: [
200
376
  "chat",
377
+ "text-in",
378
+ "text-out",
201
379
  "img-in",
202
380
  "json-out",
203
381
  "function-out",
204
382
  "reason"
205
383
  ],
206
384
  context: {
385
+ type: "token",
207
386
  total: 2e5,
208
387
  maxOutput: 1e5
209
388
  }
210
389
  },
390
+ {
391
+ id: "o1-2024-12-17",
392
+ extends: "o1",
393
+ overrides: {
394
+ name: "OpenAI O1 (2024-12-17)"
395
+ }
396
+ },
211
397
  {
212
398
  id: "o1-mini",
213
- name: "OpenAI O1 Mini",
399
+ extends: "o1",
400
+ overrides: {
401
+ name: "OpenAI O1 Mini",
402
+ can: [
403
+ "chat",
404
+ "text-in",
405
+ "text-out",
406
+ "json-out",
407
+ "function-out",
408
+ "reason"
409
+ ],
410
+ context: {
411
+ type: "token",
412
+ total: 128e3,
413
+ maxOutput: 65536
414
+ }
415
+ }
416
+ },
417
+ {
418
+ id: "o1-mini-2024-09-12",
419
+ extends: "o1-mini",
420
+ overrides: {
421
+ name: "OpenAI O1 Mini (2024-09-12)"
422
+ }
423
+ },
424
+ {
425
+ id: "o1-preview",
426
+ extends: "o1",
427
+ overrides: {
428
+ name: "OpenAI O1 Preview",
429
+ context: {
430
+ type: "token",
431
+ total: 128e3,
432
+ maxOutput: 32768
433
+ }
434
+ }
435
+ },
436
+ {
437
+ id: "o1-preview-2024-09-12",
438
+ extends: "o1-preview",
439
+ overrides: {
440
+ name: "OpenAI O1 Preview (2024-09-12)"
441
+ }
442
+ },
443
+ {
444
+ id: "o3-mini",
445
+ name: "OpenAI O3 Mini",
214
446
  license: "proprietary",
215
447
  providers: [
216
448
  "openai",
@@ -218,70 +450,89 @@ var openai_models_default = {
218
450
  ],
219
451
  can: [
220
452
  "chat",
453
+ "text-in",
454
+ "text-out",
221
455
  "json-out",
222
456
  "function-out",
223
457
  "reason"
224
458
  ],
225
459
  context: {
226
- total: 128e3,
227
- maxOutput: 65536
460
+ type: "token",
461
+ total: 2e5,
462
+ maxOutput: 1e5
228
463
  }
229
464
  },
230
465
  {
231
- id: "o3-mini",
232
- name: "OpenAI O3 Mini",
466
+ id: "o3-mini-2025-01-31",
467
+ extends: "o3-mini",
468
+ overrides: {
469
+ name: "OpenAI O3 Mini (2025-01-31)"
470
+ }
471
+ },
472
+ {
473
+ id: "whisper-1",
474
+ name: "Whisper",
233
475
  license: "proprietary",
234
476
  providers: [
235
477
  "openai",
236
478
  "azure"
237
479
  ],
238
480
  can: [
239
- "chat",
240
- "json-out",
241
- "function-out",
242
- "reason"
481
+ "sound-in",
482
+ "text-out"
243
483
  ],
244
484
  context: {
245
- total: 2e5,
246
- maxOutput: 1e5
485
+ type: "audio-in",
486
+ total: null,
487
+ maxOutput: null
247
488
  }
248
489
  },
249
490
  {
250
- id: "gpt-4o-audio-preview",
251
- name: "GPT-4O Audio",
491
+ id: "tts-1",
492
+ name: "TTS-1",
252
493
  license: "proprietary",
253
494
  providers: [
254
495
  "openai",
255
496
  "azure"
256
497
  ],
257
498
  can: [
258
- "chat",
259
- "sound-in",
260
- "json-out",
261
- "function-out"
499
+ "text-in",
500
+ "sound-out"
262
501
  ],
263
502
  context: {
264
- total: 128e3,
265
- maxOutput: 16384
503
+ type: "audio-out",
504
+ total: null,
505
+ maxOutput: null
266
506
  }
267
507
  },
268
508
  {
269
- id: "gpt-4o-realtime-preview",
270
- name: "GPT-4O Realtime",
509
+ id: "tts-1-hd",
510
+ extends: "tts-1",
511
+ overrides: {
512
+ name: "TTS-1 HD"
513
+ }
514
+ },
515
+ {
516
+ id: "dall-e-2",
517
+ name: "DALL-E 2",
271
518
  license: "proprietary",
272
519
  providers: [
273
520
  "openai",
274
521
  "azure"
275
522
  ],
276
523
  can: [
277
- "chat",
278
- "sound-in",
279
- "json-out",
280
- "function-out"
524
+ "img-out"
281
525
  ],
282
526
  context: {
283
- total: 128e3,
284
- maxOutput: 4096
527
+ maxOutput: 1,
528
+ sizes: [
529
+ "256x256",
530
+ "512x512",
531
+ "1024x1024"
532
+ ],
533
+ qualities: [
534
+ "standard"
535
+ ]
285
536
  }
286
537
  },
287
538
  {
@@ -293,6 +544,7 @@ var openai_models_default = {
293
544
  "azure"
294
545
  ],
295
546
  can: [
547
+ "text-in",
296
548
  "img-out"
297
549
  ],
298
550
  context: {
@@ -307,6 +559,69 @@ var openai_models_default = {
307
559
  "hd"
308
560
  ]
309
561
  }
562
+ },
563
+ {
564
+ id: "text-embedding-ada-002",
565
+ name: "Text Embedding Ada 002",
566
+ license: "proprietary",
567
+ providers: [
568
+ "openai",
569
+ "azure"
570
+ ],
571
+ can: [
572
+ "text-in",
573
+ "vectors-out"
574
+ ],
575
+ context: {
576
+ type: "embedding",
577
+ total: 8191,
578
+ unit: "tokens",
579
+ dimensions: 1536,
580
+ embeddingType: "text",
581
+ normalized: true
582
+ }
583
+ },
584
+ {
585
+ id: "text-embedding-3-small",
586
+ name: "Text Embedding 3 Small",
587
+ license: "proprietary",
588
+ providers: [
589
+ "openai",
590
+ "azure"
591
+ ],
592
+ can: [
593
+ "text-in",
594
+ "vectors-out"
595
+ ],
596
+ context: {
597
+ type: "embedding",
598
+ total: 8191,
599
+ unit: "tokens",
600
+ dimensions: 1536,
601
+ embeddingType: "text",
602
+ normalized: true
603
+ }
604
+ },
605
+ {
606
+ id: "text-embedding-3-large",
607
+ name: "Text Embedding 3 Large",
608
+ license: "proprietary",
609
+ providers: [
610
+ "openai",
611
+ "azure"
612
+ ],
613
+ can: [
614
+ "text-in",
615
+ "vectors-out"
616
+ ],
617
+ context: {
618
+ type: "embedding",
619
+ total: 8191,
620
+ unit: "tokens",
621
+ dimensions: 3072,
622
+ embeddingType: "text",
623
+ normalized: true
624
+ }
310
625
  }
311
626
  ]
312
627
  };
@@ -316,14 +631,10 @@ var anthropic_models_default = {
316
631
  creator: "anthropic",
317
632
  models: [
318
633
  {
319
- id: "claude-3-opus-20240229",
634
+ id: "claude-3-opus",
320
635
  name: "Claude 3 Opus",
321
636
  license: "proprietary",
322
- providers: [
323
- "anthropic",
324
- "aws",
325
- "google"
326
- ],
637
+ providers: ["anthropic", "aws", "google"],
327
638
  can: [
328
639
  "chat",
329
640
  "text-in",
@@ -333,20 +644,25 @@ var anthropic_models_default = {
333
644
  "function-out"
334
645
  ],
335
646
  context: {
647
+ type: "token",
336
648
  total: 2e5,
337
649
  maxOutput: 4096,
338
650
  outputIsFixed: 1
651
+ },
652
+ aliases: ["claude-3-opus-latest"]
653
+ },
654
+ {
655
+ id: "claude-3-opus-20240229",
656
+ extends: "claude-3-opus",
657
+ overrides: {
658
+ name: "Claude 3 Opus (2024-02-29)"
339
659
  }
340
660
  },
341
661
  {
342
- id: "claude-3-5-sonnet-20241022",
662
+ id: "claude-3-sonnet",
343
663
  name: "Claude 3 Sonnet",
344
664
  license: "proprietary",
345
- providers: [
346
- "anthropic",
347
- "aws",
348
- "google"
349
- ],
665
+ providers: ["anthropic", "aws", "google"],
350
666
  can: [
351
667
  "chat",
352
668
  "text-in",
@@ -356,20 +672,52 @@ var anthropic_models_default = {
356
672
  "function-out"
357
673
  ],
358
674
  context: {
675
+ type: "token",
359
676
  total: 2e5,
360
- maxOutput: 8192,
677
+ maxOutput: 4096,
361
678
  outputIsFixed: 1
679
+ },
680
+ aliases: ["claude-3-sonnet-latest"]
681
+ },
682
+ {
683
+ id: "claude-3-sonnet-20240229",
684
+ extends: "claude-3-sonnet",
685
+ overrides: {
686
+ name: "Claude 3 Sonnet (2024-02-29)"
362
687
  }
363
688
  },
364
689
  {
365
- id: "claude-3-5-haiku-20241022",
690
+ id: "claude-3-haiku",
366
691
  name: "Claude 3 Haiku",
367
692
  license: "proprietary",
368
- providers: [
369
- "anthropic",
370
- "aws",
371
- "google"
693
+ providers: ["anthropic", "aws", "google"],
694
+ can: [
695
+ "chat",
696
+ "text-in",
697
+ "text-out",
698
+ "img-in",
699
+ "json-out",
700
+ "function-out"
372
701
  ],
702
+ context: {
703
+ type: "token",
704
+ total: 2e5,
705
+ maxOutput: 4096,
706
+ outputIsFixed: 1
707
+ }
708
+ },
709
+ {
710
+ id: "claude-3-haiku-20240307",
711
+ extends: "claude-3-haiku",
712
+ overrides: {
713
+ name: "Claude 3 Haiku (2024-03-07)"
714
+ }
715
+ },
716
+ {
717
+ id: "claude-3-5-sonnet",
718
+ name: "Claude 3.5 Sonnet",
719
+ license: "proprietary",
720
+ providers: ["anthropic", "aws", "google"],
373
721
  can: [
374
722
  "chat",
375
723
  "text-in",
@@ -379,9 +727,45 @@ var anthropic_models_default = {
379
727
  "function-out"
380
728
  ],
381
729
  context: {
730
+ type: "token",
731
+ total: 2e5,
732
+ maxOutput: 8192,
733
+ outputIsFixed: 1
734
+ },
735
+ aliases: ["claude-3-5-sonnet-latest"]
736
+ },
737
+ {
738
+ id: "claude-3-5-sonnet-20241022",
739
+ extends: "claude-3-5-sonnet",
740
+ overrides: {
741
+ name: "Claude 3.5 Sonnet (2024-10-22)"
742
+ }
743
+ },
744
+ {
745
+ id: "claude-3-5-haiku",
746
+ name: "Claude 3.5 Haiku",
747
+ license: "proprietary",
748
+ providers: ["anthropic", "aws", "google"],
749
+ can: [
750
+ "chat",
751
+ "text-in",
752
+ "text-out",
753
+ "json-out",
754
+ "function-out"
755
+ ],
756
+ context: {
757
+ type: "token",
382
758
  total: 2e5,
383
759
  maxOutput: 8192,
384
760
  outputIsFixed: 1
761
+ },
762
+ aliases: ["claude-3-5-haiku-latest"]
763
+ },
764
+ {
765
+ id: "claude-3-5-haiku-20241022",
766
+ extends: "claude-3-5-haiku",
767
+ overrides: {
768
+ name: "Claude 3.5 Haiku (2024-10-22)"
385
769
  }
386
770
  }
387
771
  ]
@@ -398,6 +782,7 @@ var meta_models_default = {
398
782
  providers: ["groq"],
399
783
  can: ["chat", "text-in", "text-out", "json-out", "function-out"],
400
784
  context: {
785
+ type: "token",
401
786
  total: 8192,
402
787
  maxOutput: 4096
403
788
  }
@@ -409,6 +794,7 @@ var meta_models_default = {
409
794
  providers: ["groq"],
410
795
  can: ["chat", "text-in", "text-out", "json-out", "function-out"],
411
796
  context: {
797
+ type: "token",
412
798
  total: 8192,
413
799
  maxOutput: 4096
414
800
  }
@@ -420,6 +806,7 @@ var meta_models_default = {
420
806
  providers: ["groq"],
421
807
  can: ["chat", "text-in", "text-out", "img-in"],
422
808
  context: {
809
+ type: "token",
423
810
  total: 4096,
424
811
  maxOutput: 4096
425
812
  }
@@ -431,6 +818,7 @@ var meta_models_default = {
431
818
  providers: ["groq"],
432
819
  can: ["chat", "text-in", "text-out", "img-in"],
433
820
  context: {
821
+ type: "token",
434
822
  total: 4096,
435
823
  maxOutput: 4096
436
824
  }
@@ -442,6 +830,7 @@ var meta_models_default = {
442
830
  providers: ["groq"],
443
831
  can: ["chat", "text-in", "text-out"],
444
832
  context: {
833
+ type: "token",
445
834
  total: 4096,
446
835
  maxOutput: 4096
447
836
  }
@@ -466,6 +855,7 @@ var mistral_models_default = {
466
855
  "function-out"
467
856
  ],
468
857
  context: {
858
+ type: "token",
469
859
  total: 32768,
470
860
  maxOutput: 4096
471
861
  }
@@ -483,6 +873,7 @@ var mistral_models_default = {
483
873
  "function-out"
484
874
  ],
485
875
  context: {
876
+ type: "token",
486
877
  total: 32768,
487
878
  maxOutput: 4096
488
879
  }
@@ -498,6 +889,7 @@ var mistral_models_default = {
498
889
  "text-out"
499
890
  ],
500
891
  context: {
892
+ type: "token",
501
893
  total: 32768,
502
894
  maxOutput: 4096
503
895
  }
@@ -513,6 +905,7 @@ var mistral_models_default = {
513
905
  "text-out"
514
906
  ],
515
907
  context: {
908
+ type: "token",
516
909
  total: 32768,
517
910
  maxOutput: 4096
518
911
  }
@@ -528,6 +921,7 @@ var mistral_models_default = {
528
921
  "text-out"
529
922
  ],
530
923
  context: {
924
+ type: "token",
531
925
  total: 32768,
532
926
  maxOutput: 4096
533
927
  }
@@ -546,6 +940,7 @@ var google_models_default = {
546
940
  providers: ["google"],
547
941
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in", "reason"],
548
942
  context: {
943
+ type: "token",
549
944
  total: 1048576,
550
945
  maxOutput: 8192
551
946
  },
@@ -558,6 +953,7 @@ var google_models_default = {
558
953
  providers: ["google"],
559
954
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in"],
560
955
  context: {
956
+ type: "token",
561
957
  total: 1048576,
562
958
  maxOutput: 8192
563
959
  },
@@ -570,6 +966,7 @@ var google_models_default = {
570
966
  providers: ["google"],
571
967
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in"],
572
968
  context: {
969
+ type: "token",
573
970
  total: 2097152,
574
971
  maxOutput: 8192
575
972
  }
@@ -581,6 +978,7 @@ var google_models_default = {
581
978
  providers: ["google"],
582
979
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in"],
583
980
  context: {
981
+ type: "token",
584
982
  total: 2097152,
585
983
  maxOutput: 8192
586
984
  }
@@ -592,6 +990,7 @@ var google_models_default = {
592
990
  providers: ["google"],
593
991
  can: ["chat", "text-in", "text-out", "json-out", "function-out", "img-in", "sound-in", "reason"],
594
992
  context: {
993
+ type: "token",
595
994
  total: 2097152,
596
995
  maxOutput: 8192
597
996
  },
@@ -604,6 +1003,7 @@ var google_models_default = {
604
1003
  providers: ["google"],
605
1004
  can: ["text-in", "vectors-out"],
606
1005
  context: {
1006
+ type: "token",
607
1007
  total: 2048,
608
1008
  maxOutput: 768
609
1009
  }
@@ -615,6 +1015,7 @@ var google_models_default = {
615
1015
  providers: ["google"],
616
1016
  can: ["chat", "text-in", "text-out", "json-out", "function-out"],
617
1017
  context: {
1018
+ type: "token",
618
1019
  total: 8192,
619
1020
  maxOutput: 4096
620
1021
  }
@@ -626,6 +1027,7 @@ var google_models_default = {
626
1027
  providers: ["google"],
627
1028
  can: ["chat", "text-in", "text-out", "json-out", "function-out"],
628
1029
  context: {
1030
+ type: "token",
629
1031
  total: 8192,
630
1032
  maxOutput: 4096
631
1033
  }
@@ -650,6 +1052,7 @@ var deepseek_models_default = {
650
1052
  "function-out"
651
1053
  ],
652
1054
  context: {
1055
+ type: "token",
653
1056
  total: 131072,
654
1057
  maxOutput: 8192
655
1058
  }
@@ -668,6 +1071,7 @@ var deepseek_models_default = {
668
1071
  "reason"
669
1072
  ],
670
1073
  context: {
1074
+ type: "token",
671
1075
  total: 131072,
672
1076
  maxOutput: 8192
673
1077
  }
@@ -687,6 +1091,7 @@ var xai_models_default = {
687
1091
  providers: ["xai"],
688
1092
  can: ["chat", "text-in", "text-out", "img-in"],
689
1093
  context: {
1094
+ type: "token",
690
1095
  total: 32768,
691
1096
  maxOutput: 4096
692
1097
  },
@@ -700,6 +1105,7 @@ var xai_models_default = {
700
1105
  providers: ["xai"],
701
1106
  can: ["chat", "text-in", "text-out"],
702
1107
  context: {
1108
+ type: "token",
703
1109
  total: 131072,
704
1110
  maxOutput: 4096
705
1111
  },
@@ -713,6 +1119,7 @@ var xai_models_default = {
713
1119
  providers: ["xai"],
714
1120
  can: ["chat", "text-in", "text-out", "img-in"],
715
1121
  context: {
1122
+ type: "token",
716
1123
  total: 8192,
717
1124
  maxOutput: 4096
718
1125
  }
@@ -725,6 +1132,7 @@ var xai_models_default = {
725
1132
  providers: ["xai"],
726
1133
  can: ["chat", "text-in", "text-out"],
727
1134
  context: {
1135
+ type: "token",
728
1136
  total: 131072,
729
1137
  maxOutput: 4096
730
1138
  }
@@ -744,6 +1152,7 @@ var cohere_models_default = {
744
1152
  providers: ["cohere"],
745
1153
  can: ["chat", "text-in", "text-out", "reason", "function-out"],
746
1154
  context: {
1155
+ type: "token",
747
1156
  total: 128e3,
748
1157
  maxOutput: 4096
749
1158
  }
@@ -756,6 +1165,7 @@ var cohere_models_default = {
756
1165
  providers: ["cohere", "bedrock", "azure", "oracle"],
757
1166
  can: ["chat", "text-in", "text-out", "reason", "function-out"],
758
1167
  context: {
1168
+ type: "token",
759
1169
  total: 128e3,
760
1170
  maxOutput: 4096
761
1171
  },
@@ -769,6 +1179,7 @@ var cohere_models_default = {
769
1179
  providers: ["cohere", "bedrock", "azure", "oracle"],
770
1180
  can: ["chat", "text-in", "text-out", "reason", "function-out"],
771
1181
  context: {
1182
+ type: "token",
772
1183
  total: 128e3,
773
1184
  maxOutput: 4096
774
1185
  },
@@ -782,6 +1193,7 @@ var cohere_models_default = {
782
1193
  providers: ["cohere", "bedrock", "oracle"],
783
1194
  can: ["chat", "text-in", "text-out"],
784
1195
  context: {
1196
+ type: "token",
785
1197
  total: 4096,
786
1198
  maxOutput: 4096
787
1199
  }
@@ -794,6 +1206,7 @@ var cohere_models_default = {
794
1206
  providers: ["cohere", "bedrock", "oracle"],
795
1207
  can: ["chat", "text-in", "text-out"],
796
1208
  context: {
1209
+ type: "token",
797
1210
  total: 4096,
798
1211
  maxOutput: 4096
799
1212
  }
@@ -806,6 +1219,7 @@ var cohere_models_default = {
806
1219
  providers: ["cohere", "bedrock", "azure", "oracle"],
807
1220
  can: ["text-in", "img-in", "vectors-out"],
808
1221
  context: {
1222
+ type: "token",
809
1223
  total: 512,
810
1224
  maxOutput: 1024
811
1225
  }
@@ -818,6 +1232,7 @@ var cohere_models_default = {
818
1232
  providers: ["cohere", "oracle"],
819
1233
  can: ["text-in", "img-in", "vectors-out"],
820
1234
  context: {
1235
+ type: "token",
821
1236
  total: 512,
822
1237
  maxOutput: 384
823
1238
  }
@@ -830,6 +1245,7 @@ var cohere_models_default = {
830
1245
  providers: ["cohere", "bedrock", "azure", "oracle"],
831
1246
  can: ["text-in", "img-in", "vectors-out"],
832
1247
  context: {
1248
+ type: "token",
833
1249
  total: 512,
834
1250
  maxOutput: 1024
835
1251
  }
@@ -842,6 +1258,7 @@ var cohere_models_default = {
842
1258
  providers: ["cohere", "oracle"],
843
1259
  can: ["text-in", "img-in", "vectors-out"],
844
1260
  context: {
1261
+ type: "token",
845
1262
  total: 512,
846
1263
  maxOutput: 384
847
1264
  }
@@ -854,6 +1271,7 @@ var cohere_models_default = {
854
1271
  providers: ["cohere", "bedrock", "azure"],
855
1272
  can: ["text-in", "text-out"],
856
1273
  context: {
1274
+ type: "token",
857
1275
  total: 4096,
858
1276
  maxOutput: null
859
1277
  }
@@ -866,6 +1284,7 @@ var cohere_models_default = {
866
1284
  providers: ["cohere", "azure"],
867
1285
  can: ["text-in", "text-out"],
868
1286
  context: {
1287
+ type: "token",
869
1288
  total: 4096,
870
1289
  maxOutput: null
871
1290
  }
@@ -878,6 +1297,7 @@ var cohere_models_default = {
878
1297
  providers: ["cohere", "azure"],
879
1298
  can: ["text-in", "text-out"],
880
1299
  context: {
1300
+ type: "token",
881
1301
  total: 4096,
882
1302
  maxOutput: null
883
1303
  }
@@ -897,6 +1317,19 @@ function validateModel(raw) {
897
1317
  throw new Error(`Model ${field} must be a string`);
898
1318
  }
899
1319
  }
1320
+ if (model.extends !== void 0 && typeof model.extends !== "string") {
1321
+ throw new Error("Model extends must be a string");
1322
+ }
1323
+ if (model.overrides !== void 0) {
1324
+ if (typeof model.overrides !== "object" || model.overrides === null) {
1325
+ throw new Error("Model overrides must be an object");
1326
+ }
1327
+ const validOverrideFields = ["name", "creator", "license", "providers", "can", "languages", "aliases", "context"];
1328
+ const invalidFields = Object.keys(model.overrides).filter((field) => !validOverrideFields.includes(field));
1329
+ if (invalidFields.length > 0) {
1330
+ throw new Error(`Invalid override fields: ${invalidFields.join(", ")}`);
1331
+ }
1332
+ }
900
1333
  if (!Array.isArray(model.providers)) {
901
1334
  throw new Error("Model providers must be an array");
902
1335
  }
@@ -938,6 +1371,16 @@ function validateModel(raw) {
938
1371
  if (typeof context.maxOutput !== "number") {
939
1372
  throw new Error("Image model context.maxOutput must be a number");
940
1373
  }
1374
+ } else if (context.type === "embedding") {
1375
+ if (typeof context.total !== "number") {
1376
+ throw new Error("Embedding model context.total must be a number");
1377
+ }
1378
+ if (typeof context.unit !== "string") {
1379
+ throw new Error("Embedding model context.unit must be a string");
1380
+ }
1381
+ if (typeof context.dimensions !== "number") {
1382
+ throw new Error("Embedding model context.dimensions must be a number");
1383
+ }
941
1384
  } else {
942
1385
  if (typeof context.total !== "number" && context.total !== null) {
943
1386
  throw new Error("Token model context.total must be a number or null");
@@ -955,8 +1398,41 @@ function validateModel(raw) {
955
1398
  can: model.can,
956
1399
  context: model.context,
957
1400
  ...model.languages ? { languages: model.languages } : {},
958
- ...model.aliases ? { aliases: model.aliases } : {}
1401
+ ...model.aliases ? { aliases: model.aliases } : {},
1402
+ ...model.extends ? { extends: model.extends } : {},
1403
+ ...model.overrides ? { overrides: model.overrides } : {}
1404
+ };
1405
+ }
1406
+ function resolveModel(model, allModels2, visited = /* @__PURE__ */ new Set()) {
1407
+ if (!model.extends) {
1408
+ return model;
1409
+ }
1410
+ if (visited.has(model.id)) {
1411
+ throw new Error(`Circular dependency detected for model ${model.id}`);
1412
+ }
1413
+ visited.add(model.id);
1414
+ const baseModel = allModels2[model.extends];
1415
+ if (!baseModel) {
1416
+ throw new Error(`Base model ${model.extends} not found for ${model.id}`);
1417
+ }
1418
+ const resolvedBase = resolveModel(baseModel, allModels2, visited);
1419
+ if (!model.overrides) {
1420
+ return {
1421
+ ...resolvedBase,
1422
+ id: model.id,
1423
+ extends: model.extends
1424
+ };
1425
+ }
1426
+ const resolved = {
1427
+ ...resolvedBase,
1428
+ ...model.overrides,
1429
+ id: model.id,
1430
+ extends: model.extends
959
1431
  };
1432
+ if (!resolved.name || !resolved.creator || !resolved.license || !resolved.providers || !resolved.can || !resolved.context) {
1433
+ throw new Error(`Missing required fields in resolved model ${model.id}`);
1434
+ }
1435
+ return resolved;
960
1436
  }
961
1437
  function buildAllModels() {
962
1438
  const allModelData = [
@@ -970,12 +1446,29 @@ function buildAllModels() {
970
1446
  cohere_models_default
971
1447
  ];
972
1448
  const allModels2 = allModelData.flatMap(
973
- (data) => data.models.map((model) => ({
974
- ...model,
975
- creator: data.creator
976
- }))
1449
+ (data) => data.models.map((model) => {
1450
+ if (typeof model.id !== "string") {
1451
+ throw new Error(`Model id must be a string`);
1452
+ }
1453
+ if (model.extends !== void 0 && typeof model.extends !== "string") {
1454
+ throw new Error("Model extends must be a string");
1455
+ }
1456
+ if (model.overrides !== void 0 && (typeof model.overrides !== "object" || model.overrides === null)) {
1457
+ throw new Error("Model overrides must be an object");
1458
+ }
1459
+ return {
1460
+ ...model,
1461
+ creator: data.creator
1462
+ };
1463
+ })
1464
+ );
1465
+ const modelMap = Object.fromEntries(
1466
+ allModels2.map((model) => [model.id, model])
1467
+ );
1468
+ const resolvedModels = allModels2.map(
1469
+ (model) => resolveModel(model, modelMap)
977
1470
  );
978
- return allModels2.map((model) => validateModel(model));
1471
+ return resolvedModels.map((model) => validateModel(model));
979
1472
  }
980
1473
 
981
1474
  // src/data/providers/openai-provider.json
@@ -1201,31 +1694,42 @@ var creators_default = {
1201
1694
  // src/index.ts
1202
1695
  var allModels = buildAllModels();
1203
1696
  var providersData = buildProvidersData();
1204
- var ModelsCollection = class extends ModelCollection {
1697
+ var AIModels = class _AIModels extends ModelCollection {
1698
+ constructor(models2 = []) {
1699
+ super(models2);
1700
+ Object.setPrototypeOf(this, _AIModels.prototype);
1701
+ }
1205
1702
  get creators() {
1206
1703
  return Object.keys(creators_default.creators);
1207
1704
  }
1208
1705
  get providers() {
1209
1706
  return providersData.providers.map((p) => p.id);
1210
1707
  }
1211
- fromCreator(creator) {
1212
- return new ModelCollection(
1213
- this.filter(
1214
- (model) => model.license.startsWith(creator) || // For open source models
1215
- !!providersData.providers.find((p) => p.id === creator)?.models[model.id]
1216
- // For proprietary models
1217
- )
1218
- );
1219
- }
1220
1708
  getPrice(modelId, provider) {
1221
1709
  const providerData = providersData.providers.find((p) => p.id === provider);
1222
1710
  const price = providerData?.models[modelId];
1223
1711
  return price?.type === "token" ? price : void 0;
1224
1712
  }
1713
+ /** Get provider information by ID */
1714
+ getProvider(providerId) {
1715
+ return providersData.providers.find((p) => p.id === providerId);
1716
+ }
1717
+ /** Get all providers that can serve a specific model */
1718
+ getProvidersForModel(modelId) {
1719
+ let model = this.id(modelId);
1720
+ if (!model) {
1721
+ model = this.find((m) => m.aliases?.includes(modelId));
1722
+ }
1723
+ if (!model) return [];
1724
+ return providersData.providers.filter(
1725
+ (p) => model.providers.includes(p.id)
1726
+ );
1727
+ }
1225
1728
  };
1226
- var models = new ModelsCollection(allModels);
1729
+ var models = new AIModels(allModels);
1227
1730
  // Annotate the CommonJS export names for ESM import in node:
1228
1731
  0 && (module.exports = {
1732
+ AIModels,
1229
1733
  ModelCollection,
1230
1734
  creators,
1231
1735
  models