aimodels 0.1.2 → 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 +54 -14
- package/dist/index.d.mts +22 -8
- package/dist/index.d.ts +22 -8
- package/dist/index.js +147 -34
- package/dist/index.mjs +147 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,36 +17,76 @@ import { models } from 'aimodels';
|
|
|
17
17
|
console.log(models.all);
|
|
18
18
|
|
|
19
19
|
// Get list of all providers
|
|
20
|
-
console.log(models.providers); // ['openai', 'anthropic', '
|
|
20
|
+
console.log(models.providers); // ['openai', 'anthropic', 'mistral', ...]
|
|
21
|
+
|
|
22
|
+
// Get list of model creators
|
|
23
|
+
console.log(models.creators); // ['meta', 'mistral', ...]
|
|
21
24
|
|
|
22
25
|
// Get models from a specific provider
|
|
23
|
-
const openAiModels = models.
|
|
26
|
+
const openAiModels = models.fromProvider('openai');
|
|
27
|
+
|
|
28
|
+
// Get models from a specific creator
|
|
29
|
+
const metaModels = models.fromCreator('meta');
|
|
24
30
|
|
|
25
31
|
// Find a specific model
|
|
26
|
-
const model = models.find('
|
|
27
|
-
console.log(model.
|
|
28
|
-
console.log(model
|
|
29
|
-
|
|
32
|
+
const model = models.find('gpt-4');
|
|
33
|
+
console.log(model?.context.total); // Context window size
|
|
34
|
+
console.log(model?.providers); // ['openai']
|
|
35
|
+
|
|
36
|
+
// Get model pricing for a specific provider
|
|
37
|
+
const price = models.getPrice('gpt-4', 'openai');
|
|
38
|
+
console.log(price); // { type: 'token', input: 0.03, output: 0.06 }
|
|
30
39
|
|
|
31
|
-
// Filter models by
|
|
32
|
-
const chatModels = models.
|
|
40
|
+
// Filter models by capabilities
|
|
41
|
+
const chatModels = models.can('chat');
|
|
42
|
+
const multimodalModels = models.can('chat', 'img-in');
|
|
33
43
|
|
|
34
44
|
// Filter by context window
|
|
35
45
|
const largeContextModels = models.withMinContext(32768);
|
|
36
|
-
|
|
37
|
-
// Filter by maximum price
|
|
38
|
-
const affordableModels = models.withMaxPrice(0.01); // Max $0.01 per 1K tokens
|
|
39
46
|
```
|
|
40
47
|
|
|
41
48
|
## Features
|
|
42
49
|
|
|
43
|
-
- Comprehensive database of AI models
|
|
50
|
+
- Comprehensive database of AI models from major providers (OpenAI, Anthropic, Mistral, etc.)
|
|
44
51
|
- Normalized data structure for easy comparison
|
|
45
|
-
-
|
|
46
|
-
-
|
|
52
|
+
- Model capabilities (chat, img-in, img-out, function-out, etc.)
|
|
53
|
+
- Context window information
|
|
54
|
+
- Pricing information per provider
|
|
55
|
+
- Creator and provider associations
|
|
56
|
+
- TypeScript support with full type safety
|
|
47
57
|
- Zero dependencies
|
|
48
58
|
- Universal JavaScript support (Node.js, browsers, Deno)
|
|
59
|
+
- Regular updates with new models
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Types
|
|
49
63
|
|
|
64
|
+
```typescript
|
|
65
|
+
interface Model {
|
|
66
|
+
id: string; // Unique model identifier
|
|
67
|
+
name: string; // Display name
|
|
68
|
+
can: string[]; // Capabilities (chat, img-in, img-out, etc.)
|
|
69
|
+
providers: string[]; // Available providers
|
|
70
|
+
context: {
|
|
71
|
+
total: number; // Total context window size
|
|
72
|
+
};
|
|
73
|
+
license: string; // License or creator
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type ModelPrice =
|
|
77
|
+
| { type: 'token'; input: number; output: number } // Price per 1K tokens
|
|
78
|
+
| { type: 'image'; price: number; size: string } // Price per image
|
|
79
|
+
| { type: 'character'; price: number } // Price per character
|
|
80
|
+
| { type: 'minute'; price: number }; // Price per minute
|
|
81
|
+
|
|
82
|
+
interface Provider {
|
|
83
|
+
id: string; // Provider identifier
|
|
84
|
+
name: string; // Display name
|
|
85
|
+
websiteUrl: string; // Provider's website
|
|
86
|
+
apiUrl: string; // API documentation URL
|
|
87
|
+
models: Record<string, ModelPrice>; // Model pricing
|
|
88
|
+
}
|
|
89
|
+
```
|
|
50
90
|
|
|
51
91
|
## License
|
|
52
92
|
|
package/dist/index.d.mts
CHANGED
|
@@ -7,6 +7,18 @@ interface ModelPrice {
|
|
|
7
7
|
type: 'token';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Defines all possible model capabilities
|
|
12
|
+
*/
|
|
13
|
+
type Capability = "chat" | "reason" | "text-in" | "text-out" | "img-in" | "img-out" | "sound-in" | "sound-out" | "json-out" | "function-out" | "vectors-out";
|
|
14
|
+
|
|
15
|
+
declare class ModelCollection extends Array<Model> {
|
|
16
|
+
constructor(models: Model[]);
|
|
17
|
+
can(...capabilities: Capability[]): ModelCollection;
|
|
18
|
+
know(...languages: string[]): ModelCollection;
|
|
19
|
+
filter(predicate: (value: Model, index: number, array: Model[]) => boolean): ModelCollection;
|
|
20
|
+
slice(start?: number, end?: number): ModelCollection;
|
|
21
|
+
}
|
|
10
22
|
interface ModelContext {
|
|
11
23
|
/** Maximum total tokens (input + output) */
|
|
12
24
|
total: number;
|
|
@@ -23,27 +35,29 @@ interface Model {
|
|
|
23
35
|
/** List of providers that can serve this model */
|
|
24
36
|
providers: string[];
|
|
25
37
|
/** Model capabilities */
|
|
26
|
-
can:
|
|
38
|
+
can: Capability[];
|
|
39
|
+
/** Languages the model knows */
|
|
40
|
+
languages?: string[];
|
|
27
41
|
/** Context window information */
|
|
28
42
|
context: ModelContext;
|
|
29
43
|
}
|
|
30
|
-
interface
|
|
44
|
+
interface ModelsAPI {
|
|
31
45
|
/** All available models */
|
|
32
|
-
all:
|
|
46
|
+
all: ModelCollection;
|
|
33
47
|
/** List of all creators */
|
|
34
48
|
creators: string[];
|
|
35
49
|
/** List of all providers */
|
|
36
50
|
providers: string[];
|
|
37
51
|
/** Get models from a specific creator */
|
|
38
|
-
fromCreator(creator: string):
|
|
52
|
+
fromCreator(creator: string): ModelCollection;
|
|
39
53
|
/** Get models from a specific provider */
|
|
40
|
-
fromProvider(provider: string):
|
|
54
|
+
fromProvider(provider: string): ModelCollection;
|
|
41
55
|
/** Find a specific model by ID */
|
|
42
56
|
find(id: string): Model | undefined;
|
|
43
57
|
/** Filter models by one or more capabilities (all must be present) */
|
|
44
|
-
can(...capabilities: string[]):
|
|
58
|
+
can(...capabilities: string[]): ModelCollection;
|
|
45
59
|
/** Filter models by minimum context window */
|
|
46
|
-
withMinContext(tokens: number):
|
|
60
|
+
withMinContext(tokens: number): ModelCollection;
|
|
47
61
|
/** Get pricing for a model from a specific provider */
|
|
48
62
|
getPrice(modelId: string, provider: string): ModelPrice | undefined;
|
|
49
63
|
}
|
|
@@ -70,6 +84,6 @@ var creators$1 = {
|
|
|
70
84
|
creators: creators
|
|
71
85
|
};
|
|
72
86
|
|
|
73
|
-
declare const models:
|
|
87
|
+
declare const models: ModelsAPI;
|
|
74
88
|
|
|
75
89
|
export { creators$1 as creators, models };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,18 @@ interface ModelPrice {
|
|
|
7
7
|
type: 'token';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Defines all possible model capabilities
|
|
12
|
+
*/
|
|
13
|
+
type Capability = "chat" | "reason" | "text-in" | "text-out" | "img-in" | "img-out" | "sound-in" | "sound-out" | "json-out" | "function-out" | "vectors-out";
|
|
14
|
+
|
|
15
|
+
declare class ModelCollection extends Array<Model> {
|
|
16
|
+
constructor(models: Model[]);
|
|
17
|
+
can(...capabilities: Capability[]): ModelCollection;
|
|
18
|
+
know(...languages: string[]): ModelCollection;
|
|
19
|
+
filter(predicate: (value: Model, index: number, array: Model[]) => boolean): ModelCollection;
|
|
20
|
+
slice(start?: number, end?: number): ModelCollection;
|
|
21
|
+
}
|
|
10
22
|
interface ModelContext {
|
|
11
23
|
/** Maximum total tokens (input + output) */
|
|
12
24
|
total: number;
|
|
@@ -23,27 +35,29 @@ interface Model {
|
|
|
23
35
|
/** List of providers that can serve this model */
|
|
24
36
|
providers: string[];
|
|
25
37
|
/** Model capabilities */
|
|
26
|
-
can:
|
|
38
|
+
can: Capability[];
|
|
39
|
+
/** Languages the model knows */
|
|
40
|
+
languages?: string[];
|
|
27
41
|
/** Context window information */
|
|
28
42
|
context: ModelContext;
|
|
29
43
|
}
|
|
30
|
-
interface
|
|
44
|
+
interface ModelsAPI {
|
|
31
45
|
/** All available models */
|
|
32
|
-
all:
|
|
46
|
+
all: ModelCollection;
|
|
33
47
|
/** List of all creators */
|
|
34
48
|
creators: string[];
|
|
35
49
|
/** List of all providers */
|
|
36
50
|
providers: string[];
|
|
37
51
|
/** Get models from a specific creator */
|
|
38
|
-
fromCreator(creator: string):
|
|
52
|
+
fromCreator(creator: string): ModelCollection;
|
|
39
53
|
/** Get models from a specific provider */
|
|
40
|
-
fromProvider(provider: string):
|
|
54
|
+
fromProvider(provider: string): ModelCollection;
|
|
41
55
|
/** Find a specific model by ID */
|
|
42
56
|
find(id: string): Model | undefined;
|
|
43
57
|
/** Filter models by one or more capabilities (all must be present) */
|
|
44
|
-
can(...capabilities: string[]):
|
|
58
|
+
can(...capabilities: string[]): ModelCollection;
|
|
45
59
|
/** Filter models by minimum context window */
|
|
46
|
-
withMinContext(tokens: number):
|
|
60
|
+
withMinContext(tokens: number): ModelCollection;
|
|
47
61
|
/** Get pricing for a model from a specific provider */
|
|
48
62
|
getPrice(modelId: string, provider: string): ModelPrice | undefined;
|
|
49
63
|
}
|
|
@@ -70,6 +84,6 @@ var creators$1 = {
|
|
|
70
84
|
creators: creators
|
|
71
85
|
};
|
|
72
86
|
|
|
73
|
-
declare const models:
|
|
87
|
+
declare const models: ModelsAPI;
|
|
74
88
|
|
|
75
89
|
export { creators$1 as creators, models };
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,31 @@ __export(index_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
|
|
28
|
+
// src/types/models.ts
|
|
29
|
+
var ModelCollection = class _ModelCollection extends Array {
|
|
30
|
+
constructor(models2) {
|
|
31
|
+
super(...models2);
|
|
32
|
+
Object.setPrototypeOf(this, _ModelCollection.prototype);
|
|
33
|
+
}
|
|
34
|
+
can(...capabilities) {
|
|
35
|
+
return new _ModelCollection(
|
|
36
|
+
this.filter((model) => capabilities.every((cap) => model.can.includes(cap)))
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
know(...languages) {
|
|
40
|
+
return new _ModelCollection(
|
|
41
|
+
this.filter((model) => languages.every((lang) => model.languages?.includes(lang)))
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
// Override array methods to return ModelCollection
|
|
45
|
+
filter(predicate) {
|
|
46
|
+
return new _ModelCollection(super.filter(predicate));
|
|
47
|
+
}
|
|
48
|
+
slice(start, end) {
|
|
49
|
+
return new _ModelCollection(super.slice(start, end));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
28
53
|
// src/data/models/openai.json
|
|
29
54
|
var openai_default = {
|
|
30
55
|
models: [
|
|
@@ -32,8 +57,14 @@ var openai_default = {
|
|
|
32
57
|
id: "whisper-1",
|
|
33
58
|
name: "Whisper-1",
|
|
34
59
|
license: "proprietary",
|
|
35
|
-
providers: [
|
|
36
|
-
|
|
60
|
+
providers: [
|
|
61
|
+
"openai",
|
|
62
|
+
"azure"
|
|
63
|
+
],
|
|
64
|
+
can: [
|
|
65
|
+
"sound-in",
|
|
66
|
+
"text-out"
|
|
67
|
+
],
|
|
37
68
|
context: {
|
|
38
69
|
total: null,
|
|
39
70
|
maxOutput: null
|
|
@@ -43,8 +74,14 @@ var openai_default = {
|
|
|
43
74
|
id: "tts-1",
|
|
44
75
|
name: "TTS-1",
|
|
45
76
|
license: "proprietary",
|
|
46
|
-
providers: [
|
|
47
|
-
|
|
77
|
+
providers: [
|
|
78
|
+
"openai",
|
|
79
|
+
"azure"
|
|
80
|
+
],
|
|
81
|
+
can: [
|
|
82
|
+
"text-in",
|
|
83
|
+
"sound-out"
|
|
84
|
+
],
|
|
48
85
|
context: {
|
|
49
86
|
total: null,
|
|
50
87
|
maxOutput: null
|
|
@@ -54,8 +91,14 @@ var openai_default = {
|
|
|
54
91
|
id: "tts-1-hd",
|
|
55
92
|
name: "TTS-1 HD",
|
|
56
93
|
license: "proprietary",
|
|
57
|
-
providers: [
|
|
58
|
-
|
|
94
|
+
providers: [
|
|
95
|
+
"openai",
|
|
96
|
+
"azure"
|
|
97
|
+
],
|
|
98
|
+
can: [
|
|
99
|
+
"text-in",
|
|
100
|
+
"sound-out"
|
|
101
|
+
],
|
|
59
102
|
context: {
|
|
60
103
|
total: null,
|
|
61
104
|
maxOutput: null
|
|
@@ -65,8 +108,16 @@ var openai_default = {
|
|
|
65
108
|
id: "gpt-4o",
|
|
66
109
|
name: "GPT-4O",
|
|
67
110
|
license: "proprietary",
|
|
68
|
-
providers: [
|
|
69
|
-
|
|
111
|
+
providers: [
|
|
112
|
+
"openai",
|
|
113
|
+
"azure"
|
|
114
|
+
],
|
|
115
|
+
can: [
|
|
116
|
+
"chat",
|
|
117
|
+
"img-in",
|
|
118
|
+
"json-out",
|
|
119
|
+
"function-out"
|
|
120
|
+
],
|
|
70
121
|
context: {
|
|
71
122
|
total: 128e3,
|
|
72
123
|
maxOutput: 16384
|
|
@@ -76,8 +127,16 @@ var openai_default = {
|
|
|
76
127
|
id: "gpt-4o-mini",
|
|
77
128
|
name: "GPT-4O Mini",
|
|
78
129
|
license: "proprietary",
|
|
79
|
-
providers: [
|
|
80
|
-
|
|
130
|
+
providers: [
|
|
131
|
+
"openai",
|
|
132
|
+
"azure"
|
|
133
|
+
],
|
|
134
|
+
can: [
|
|
135
|
+
"chat",
|
|
136
|
+
"img-in",
|
|
137
|
+
"json-out",
|
|
138
|
+
"function-out"
|
|
139
|
+
],
|
|
81
140
|
context: {
|
|
82
141
|
total: 128e3,
|
|
83
142
|
maxOutput: 16384
|
|
@@ -87,8 +146,17 @@ var openai_default = {
|
|
|
87
146
|
id: "o1",
|
|
88
147
|
name: "OpenAI O1",
|
|
89
148
|
license: "proprietary",
|
|
90
|
-
providers: [
|
|
91
|
-
|
|
149
|
+
providers: [
|
|
150
|
+
"openai",
|
|
151
|
+
"azure"
|
|
152
|
+
],
|
|
153
|
+
can: [
|
|
154
|
+
"chat",
|
|
155
|
+
"img-in",
|
|
156
|
+
"json-out",
|
|
157
|
+
"function-out",
|
|
158
|
+
"reason"
|
|
159
|
+
],
|
|
92
160
|
context: {
|
|
93
161
|
total: 2e5,
|
|
94
162
|
maxOutput: 1e5
|
|
@@ -98,8 +166,16 @@ var openai_default = {
|
|
|
98
166
|
id: "o1-mini",
|
|
99
167
|
name: "OpenAI O1 Mini",
|
|
100
168
|
license: "proprietary",
|
|
101
|
-
providers: [
|
|
102
|
-
|
|
169
|
+
providers: [
|
|
170
|
+
"openai",
|
|
171
|
+
"azure"
|
|
172
|
+
],
|
|
173
|
+
can: [
|
|
174
|
+
"chat",
|
|
175
|
+
"json-out",
|
|
176
|
+
"function-out",
|
|
177
|
+
"reason"
|
|
178
|
+
],
|
|
103
179
|
context: {
|
|
104
180
|
total: 128e3,
|
|
105
181
|
maxOutput: 65536
|
|
@@ -109,8 +185,16 @@ var openai_default = {
|
|
|
109
185
|
id: "o3-mini",
|
|
110
186
|
name: "OpenAI O3 Mini",
|
|
111
187
|
license: "proprietary",
|
|
112
|
-
providers: [
|
|
113
|
-
|
|
188
|
+
providers: [
|
|
189
|
+
"openai",
|
|
190
|
+
"azure"
|
|
191
|
+
],
|
|
192
|
+
can: [
|
|
193
|
+
"chat",
|
|
194
|
+
"json-out",
|
|
195
|
+
"function-out",
|
|
196
|
+
"reason"
|
|
197
|
+
],
|
|
114
198
|
context: {
|
|
115
199
|
total: 2e5,
|
|
116
200
|
maxOutput: 1e5
|
|
@@ -120,8 +204,16 @@ var openai_default = {
|
|
|
120
204
|
id: "gpt-4o-audio-preview",
|
|
121
205
|
name: "GPT-4O Audio",
|
|
122
206
|
license: "proprietary",
|
|
123
|
-
providers: [
|
|
124
|
-
|
|
207
|
+
providers: [
|
|
208
|
+
"openai",
|
|
209
|
+
"azure"
|
|
210
|
+
],
|
|
211
|
+
can: [
|
|
212
|
+
"chat",
|
|
213
|
+
"sound-in",
|
|
214
|
+
"json-out",
|
|
215
|
+
"function-out"
|
|
216
|
+
],
|
|
125
217
|
context: {
|
|
126
218
|
total: 128e3,
|
|
127
219
|
maxOutput: 16384
|
|
@@ -131,8 +223,16 @@ var openai_default = {
|
|
|
131
223
|
id: "gpt-4o-realtime-preview",
|
|
132
224
|
name: "GPT-4O Realtime",
|
|
133
225
|
license: "proprietary",
|
|
134
|
-
providers: [
|
|
135
|
-
|
|
226
|
+
providers: [
|
|
227
|
+
"openai",
|
|
228
|
+
"azure"
|
|
229
|
+
],
|
|
230
|
+
can: [
|
|
231
|
+
"chat",
|
|
232
|
+
"sound-in",
|
|
233
|
+
"json-out",
|
|
234
|
+
"function-out"
|
|
235
|
+
],
|
|
136
236
|
context: {
|
|
137
237
|
total: 128e3,
|
|
138
238
|
maxOutput: 4096
|
|
@@ -142,8 +242,13 @@ var openai_default = {
|
|
|
142
242
|
id: "dall-e-3",
|
|
143
243
|
name: "DALL-E 3",
|
|
144
244
|
license: "proprietary",
|
|
145
|
-
providers: [
|
|
146
|
-
|
|
245
|
+
providers: [
|
|
246
|
+
"openai",
|
|
247
|
+
"azure"
|
|
248
|
+
],
|
|
249
|
+
can: [
|
|
250
|
+
"img-out"
|
|
251
|
+
],
|
|
147
252
|
context: {
|
|
148
253
|
maxOutput: 1,
|
|
149
254
|
sizes: [
|
|
@@ -167,7 +272,7 @@ var anthropic_default = {
|
|
|
167
272
|
id: "claude-3-opus",
|
|
168
273
|
name: "Claude 3 Opus",
|
|
169
274
|
license: "proprietary",
|
|
170
|
-
providers: ["anthropic"],
|
|
275
|
+
providers: ["anthropic", "aws", "google"],
|
|
171
276
|
can: ["chat", "img-in", "json-out", "function-out"],
|
|
172
277
|
context: {
|
|
173
278
|
total: 2e5,
|
|
@@ -178,7 +283,7 @@ var anthropic_default = {
|
|
|
178
283
|
id: "claude-3-sonnet",
|
|
179
284
|
name: "Claude 3 Sonnet",
|
|
180
285
|
license: "proprietary",
|
|
181
|
-
providers: ["anthropic"],
|
|
286
|
+
providers: ["anthropic", "aws", "google"],
|
|
182
287
|
can: ["chat", "img-in", "json-out", "function-out"],
|
|
183
288
|
context: {
|
|
184
289
|
total: 2e5,
|
|
@@ -189,7 +294,7 @@ var anthropic_default = {
|
|
|
189
294
|
id: "claude-3-haiku",
|
|
190
295
|
name: "Claude 3 Haiku",
|
|
191
296
|
license: "proprietary",
|
|
192
|
-
providers: ["anthropic"],
|
|
297
|
+
providers: ["anthropic", "aws", "google"],
|
|
193
298
|
can: ["chat", "img-in", "json-out", "function-out"],
|
|
194
299
|
context: {
|
|
195
300
|
total: 2e5,
|
|
@@ -467,7 +572,7 @@ var creators_default = {
|
|
|
467
572
|
var allModels = buildAllModels();
|
|
468
573
|
var providersData = buildProvidersData();
|
|
469
574
|
var models = {
|
|
470
|
-
all: allModels,
|
|
575
|
+
all: new ModelCollection(allModels),
|
|
471
576
|
get creators() {
|
|
472
577
|
return Object.keys(creators_default.creators);
|
|
473
578
|
},
|
|
@@ -475,25 +580,33 @@ var models = {
|
|
|
475
580
|
return providersData.providers.map((p) => p.id);
|
|
476
581
|
},
|
|
477
582
|
fromCreator(creator) {
|
|
478
|
-
return
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
583
|
+
return new ModelCollection(
|
|
584
|
+
allModels.filter(
|
|
585
|
+
(model) => model.license.startsWith(creator) || // For open source models
|
|
586
|
+
providersData.providers.find((p) => p.id === creator)?.models[model.id]
|
|
587
|
+
// For proprietary models
|
|
588
|
+
)
|
|
482
589
|
);
|
|
483
590
|
},
|
|
484
591
|
fromProvider(provider) {
|
|
485
|
-
return
|
|
592
|
+
return new ModelCollection(
|
|
593
|
+
allModels.filter((model) => model.providers.includes(provider))
|
|
594
|
+
);
|
|
486
595
|
},
|
|
487
596
|
find(id) {
|
|
488
597
|
return allModels.find((model) => model.id === id);
|
|
489
598
|
},
|
|
490
599
|
can(...capabilities) {
|
|
491
|
-
return
|
|
492
|
-
|
|
600
|
+
return new ModelCollection(
|
|
601
|
+
allModels.filter(
|
|
602
|
+
(model) => capabilities.every((capability) => model.can.includes(capability))
|
|
603
|
+
)
|
|
493
604
|
);
|
|
494
605
|
},
|
|
495
606
|
withMinContext(tokens) {
|
|
496
|
-
return
|
|
607
|
+
return new ModelCollection(
|
|
608
|
+
allModels.filter((model) => model.context.total >= tokens)
|
|
609
|
+
);
|
|
497
610
|
},
|
|
498
611
|
getPrice(modelId, provider) {
|
|
499
612
|
const providerData = providersData.providers.find((p) => p.id === provider);
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
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
|
+
|
|
1
26
|
// src/data/models/openai.json
|
|
2
27
|
var openai_default = {
|
|
3
28
|
models: [
|
|
@@ -5,8 +30,14 @@ var openai_default = {
|
|
|
5
30
|
id: "whisper-1",
|
|
6
31
|
name: "Whisper-1",
|
|
7
32
|
license: "proprietary",
|
|
8
|
-
providers: [
|
|
9
|
-
|
|
33
|
+
providers: [
|
|
34
|
+
"openai",
|
|
35
|
+
"azure"
|
|
36
|
+
],
|
|
37
|
+
can: [
|
|
38
|
+
"sound-in",
|
|
39
|
+
"text-out"
|
|
40
|
+
],
|
|
10
41
|
context: {
|
|
11
42
|
total: null,
|
|
12
43
|
maxOutput: null
|
|
@@ -16,8 +47,14 @@ var openai_default = {
|
|
|
16
47
|
id: "tts-1",
|
|
17
48
|
name: "TTS-1",
|
|
18
49
|
license: "proprietary",
|
|
19
|
-
providers: [
|
|
20
|
-
|
|
50
|
+
providers: [
|
|
51
|
+
"openai",
|
|
52
|
+
"azure"
|
|
53
|
+
],
|
|
54
|
+
can: [
|
|
55
|
+
"text-in",
|
|
56
|
+
"sound-out"
|
|
57
|
+
],
|
|
21
58
|
context: {
|
|
22
59
|
total: null,
|
|
23
60
|
maxOutput: null
|
|
@@ -27,8 +64,14 @@ var openai_default = {
|
|
|
27
64
|
id: "tts-1-hd",
|
|
28
65
|
name: "TTS-1 HD",
|
|
29
66
|
license: "proprietary",
|
|
30
|
-
providers: [
|
|
31
|
-
|
|
67
|
+
providers: [
|
|
68
|
+
"openai",
|
|
69
|
+
"azure"
|
|
70
|
+
],
|
|
71
|
+
can: [
|
|
72
|
+
"text-in",
|
|
73
|
+
"sound-out"
|
|
74
|
+
],
|
|
32
75
|
context: {
|
|
33
76
|
total: null,
|
|
34
77
|
maxOutput: null
|
|
@@ -38,8 +81,16 @@ var openai_default = {
|
|
|
38
81
|
id: "gpt-4o",
|
|
39
82
|
name: "GPT-4O",
|
|
40
83
|
license: "proprietary",
|
|
41
|
-
providers: [
|
|
42
|
-
|
|
84
|
+
providers: [
|
|
85
|
+
"openai",
|
|
86
|
+
"azure"
|
|
87
|
+
],
|
|
88
|
+
can: [
|
|
89
|
+
"chat",
|
|
90
|
+
"img-in",
|
|
91
|
+
"json-out",
|
|
92
|
+
"function-out"
|
|
93
|
+
],
|
|
43
94
|
context: {
|
|
44
95
|
total: 128e3,
|
|
45
96
|
maxOutput: 16384
|
|
@@ -49,8 +100,16 @@ var openai_default = {
|
|
|
49
100
|
id: "gpt-4o-mini",
|
|
50
101
|
name: "GPT-4O Mini",
|
|
51
102
|
license: "proprietary",
|
|
52
|
-
providers: [
|
|
53
|
-
|
|
103
|
+
providers: [
|
|
104
|
+
"openai",
|
|
105
|
+
"azure"
|
|
106
|
+
],
|
|
107
|
+
can: [
|
|
108
|
+
"chat",
|
|
109
|
+
"img-in",
|
|
110
|
+
"json-out",
|
|
111
|
+
"function-out"
|
|
112
|
+
],
|
|
54
113
|
context: {
|
|
55
114
|
total: 128e3,
|
|
56
115
|
maxOutput: 16384
|
|
@@ -60,8 +119,17 @@ var openai_default = {
|
|
|
60
119
|
id: "o1",
|
|
61
120
|
name: "OpenAI O1",
|
|
62
121
|
license: "proprietary",
|
|
63
|
-
providers: [
|
|
64
|
-
|
|
122
|
+
providers: [
|
|
123
|
+
"openai",
|
|
124
|
+
"azure"
|
|
125
|
+
],
|
|
126
|
+
can: [
|
|
127
|
+
"chat",
|
|
128
|
+
"img-in",
|
|
129
|
+
"json-out",
|
|
130
|
+
"function-out",
|
|
131
|
+
"reason"
|
|
132
|
+
],
|
|
65
133
|
context: {
|
|
66
134
|
total: 2e5,
|
|
67
135
|
maxOutput: 1e5
|
|
@@ -71,8 +139,16 @@ var openai_default = {
|
|
|
71
139
|
id: "o1-mini",
|
|
72
140
|
name: "OpenAI O1 Mini",
|
|
73
141
|
license: "proprietary",
|
|
74
|
-
providers: [
|
|
75
|
-
|
|
142
|
+
providers: [
|
|
143
|
+
"openai",
|
|
144
|
+
"azure"
|
|
145
|
+
],
|
|
146
|
+
can: [
|
|
147
|
+
"chat",
|
|
148
|
+
"json-out",
|
|
149
|
+
"function-out",
|
|
150
|
+
"reason"
|
|
151
|
+
],
|
|
76
152
|
context: {
|
|
77
153
|
total: 128e3,
|
|
78
154
|
maxOutput: 65536
|
|
@@ -82,8 +158,16 @@ var openai_default = {
|
|
|
82
158
|
id: "o3-mini",
|
|
83
159
|
name: "OpenAI O3 Mini",
|
|
84
160
|
license: "proprietary",
|
|
85
|
-
providers: [
|
|
86
|
-
|
|
161
|
+
providers: [
|
|
162
|
+
"openai",
|
|
163
|
+
"azure"
|
|
164
|
+
],
|
|
165
|
+
can: [
|
|
166
|
+
"chat",
|
|
167
|
+
"json-out",
|
|
168
|
+
"function-out",
|
|
169
|
+
"reason"
|
|
170
|
+
],
|
|
87
171
|
context: {
|
|
88
172
|
total: 2e5,
|
|
89
173
|
maxOutput: 1e5
|
|
@@ -93,8 +177,16 @@ var openai_default = {
|
|
|
93
177
|
id: "gpt-4o-audio-preview",
|
|
94
178
|
name: "GPT-4O Audio",
|
|
95
179
|
license: "proprietary",
|
|
96
|
-
providers: [
|
|
97
|
-
|
|
180
|
+
providers: [
|
|
181
|
+
"openai",
|
|
182
|
+
"azure"
|
|
183
|
+
],
|
|
184
|
+
can: [
|
|
185
|
+
"chat",
|
|
186
|
+
"sound-in",
|
|
187
|
+
"json-out",
|
|
188
|
+
"function-out"
|
|
189
|
+
],
|
|
98
190
|
context: {
|
|
99
191
|
total: 128e3,
|
|
100
192
|
maxOutput: 16384
|
|
@@ -104,8 +196,16 @@ var openai_default = {
|
|
|
104
196
|
id: "gpt-4o-realtime-preview",
|
|
105
197
|
name: "GPT-4O Realtime",
|
|
106
198
|
license: "proprietary",
|
|
107
|
-
providers: [
|
|
108
|
-
|
|
199
|
+
providers: [
|
|
200
|
+
"openai",
|
|
201
|
+
"azure"
|
|
202
|
+
],
|
|
203
|
+
can: [
|
|
204
|
+
"chat",
|
|
205
|
+
"sound-in",
|
|
206
|
+
"json-out",
|
|
207
|
+
"function-out"
|
|
208
|
+
],
|
|
109
209
|
context: {
|
|
110
210
|
total: 128e3,
|
|
111
211
|
maxOutput: 4096
|
|
@@ -115,8 +215,13 @@ var openai_default = {
|
|
|
115
215
|
id: "dall-e-3",
|
|
116
216
|
name: "DALL-E 3",
|
|
117
217
|
license: "proprietary",
|
|
118
|
-
providers: [
|
|
119
|
-
|
|
218
|
+
providers: [
|
|
219
|
+
"openai",
|
|
220
|
+
"azure"
|
|
221
|
+
],
|
|
222
|
+
can: [
|
|
223
|
+
"img-out"
|
|
224
|
+
],
|
|
120
225
|
context: {
|
|
121
226
|
maxOutput: 1,
|
|
122
227
|
sizes: [
|
|
@@ -140,7 +245,7 @@ var anthropic_default = {
|
|
|
140
245
|
id: "claude-3-opus",
|
|
141
246
|
name: "Claude 3 Opus",
|
|
142
247
|
license: "proprietary",
|
|
143
|
-
providers: ["anthropic"],
|
|
248
|
+
providers: ["anthropic", "aws", "google"],
|
|
144
249
|
can: ["chat", "img-in", "json-out", "function-out"],
|
|
145
250
|
context: {
|
|
146
251
|
total: 2e5,
|
|
@@ -151,7 +256,7 @@ var anthropic_default = {
|
|
|
151
256
|
id: "claude-3-sonnet",
|
|
152
257
|
name: "Claude 3 Sonnet",
|
|
153
258
|
license: "proprietary",
|
|
154
|
-
providers: ["anthropic"],
|
|
259
|
+
providers: ["anthropic", "aws", "google"],
|
|
155
260
|
can: ["chat", "img-in", "json-out", "function-out"],
|
|
156
261
|
context: {
|
|
157
262
|
total: 2e5,
|
|
@@ -162,7 +267,7 @@ var anthropic_default = {
|
|
|
162
267
|
id: "claude-3-haiku",
|
|
163
268
|
name: "Claude 3 Haiku",
|
|
164
269
|
license: "proprietary",
|
|
165
|
-
providers: ["anthropic"],
|
|
270
|
+
providers: ["anthropic", "aws", "google"],
|
|
166
271
|
can: ["chat", "img-in", "json-out", "function-out"],
|
|
167
272
|
context: {
|
|
168
273
|
total: 2e5,
|
|
@@ -440,7 +545,7 @@ var creators_default = {
|
|
|
440
545
|
var allModels = buildAllModels();
|
|
441
546
|
var providersData = buildProvidersData();
|
|
442
547
|
var models = {
|
|
443
|
-
all: allModels,
|
|
548
|
+
all: new ModelCollection(allModels),
|
|
444
549
|
get creators() {
|
|
445
550
|
return Object.keys(creators_default.creators);
|
|
446
551
|
},
|
|
@@ -448,25 +553,33 @@ var models = {
|
|
|
448
553
|
return providersData.providers.map((p) => p.id);
|
|
449
554
|
},
|
|
450
555
|
fromCreator(creator) {
|
|
451
|
-
return
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
+
)
|
|
455
562
|
);
|
|
456
563
|
},
|
|
457
564
|
fromProvider(provider) {
|
|
458
|
-
return
|
|
565
|
+
return new ModelCollection(
|
|
566
|
+
allModels.filter((model) => model.providers.includes(provider))
|
|
567
|
+
);
|
|
459
568
|
},
|
|
460
569
|
find(id) {
|
|
461
570
|
return allModels.find((model) => model.id === id);
|
|
462
571
|
},
|
|
463
572
|
can(...capabilities) {
|
|
464
|
-
return
|
|
465
|
-
|
|
573
|
+
return new ModelCollection(
|
|
574
|
+
allModels.filter(
|
|
575
|
+
(model) => capabilities.every((capability) => model.can.includes(capability))
|
|
576
|
+
)
|
|
466
577
|
);
|
|
467
578
|
},
|
|
468
579
|
withMinContext(tokens) {
|
|
469
|
-
return
|
|
580
|
+
return new ModelCollection(
|
|
581
|
+
allModels.filter((model) => model.context.total >= tokens)
|
|
582
|
+
);
|
|
470
583
|
},
|
|
471
584
|
getPrice(modelId, provider) {
|
|
472
585
|
const providerData = providersData.providers.find((p) => p.id === provider);
|