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.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- interface ModelPrice {
1
+ interface TokenBasedPricePerMillionTokens {
2
2
  /** Price per million input tokens */
3
3
  input: number;
4
4
  /** Price per million output tokens */
@@ -6,6 +6,16 @@ interface ModelPrice {
6
6
  /** Price type */
7
7
  type: 'token';
8
8
  }
9
+ interface ImagePrice {
10
+ /** Price per image */
11
+ price: number;
12
+ /** Image size */
13
+ size: string;
14
+ /** Price type */
15
+ type: 'image';
16
+ /** Price unit */
17
+ unit: 'per_image';
18
+ }
9
19
 
10
20
  /**
11
21
  * Defines all possible model capabilities
@@ -27,10 +37,17 @@ declare class ModelCollection extends Array<Model> {
27
37
  id(modelId: string): Model | undefined;
28
38
  /** Get models available from a specific provider */
29
39
  fromProvider(provider: string): ModelCollection;
40
+ /** Get models available from a specific creator */
41
+ fromCreator(creator: string): ModelCollection;
30
42
  /** Filter models by minimum context window size */
31
43
  withMinContext(tokens: number): ModelCollection;
32
44
  }
33
- interface TokenModelContext {
45
+ interface BaseContext {
46
+ /** The type discriminator */
47
+ type: string;
48
+ }
49
+ interface TokenContext extends BaseContext {
50
+ type: "token";
34
51
  /** Maximum input tokens the model can accept */
35
52
  total: number | null;
36
53
  /** Maximum tokens the model can generate in response */
@@ -42,15 +59,56 @@ interface TokenModelContext {
42
59
  */
43
60
  outputIsFixed?: 1;
44
61
  }
45
- interface ImageModelContext {
62
+ interface CharacterContext extends BaseContext {
63
+ type: "character";
64
+ /** Maximum input characters the model can accept */
65
+ total: number | null;
66
+ /** Maximum characters the model can generate in response */
67
+ maxOutput: number | null;
68
+ }
69
+ interface ImageContext extends BaseContext {
70
+ type: "image";
46
71
  /** Maximum outputs per request */
47
72
  maxOutput: number;
48
- /** Available image sizes */
73
+ /** Available image sizes (e.g. "1024x1024") */
49
74
  sizes: string[];
50
- /** Available quality settings */
75
+ /** Available quality settings (e.g. "standard", "hd") */
51
76
  qualities: string[];
52
77
  }
53
- type ModelContext = TokenModelContext | ImageModelContext;
78
+ interface AudioInputContext extends BaseContext {
79
+ type: "audio-in";
80
+ /** Maximum duration in seconds, null if unlimited */
81
+ maxDuration?: number | null;
82
+ /** Supported input formats */
83
+ formats?: string[];
84
+ /** Maximum file size in bytes */
85
+ maxSize?: number | null;
86
+ }
87
+ interface AudioOutputContext extends BaseContext {
88
+ type: "audio-out";
89
+ /** Maximum text length that can be converted to speech */
90
+ maxInput?: number | null;
91
+ /** Supported output formats */
92
+ formats?: string[];
93
+ /** Available voices */
94
+ voices?: string[];
95
+ /** Available quality settings */
96
+ qualities?: string[];
97
+ }
98
+ interface EmbeddingContext extends BaseContext {
99
+ type: "embedding";
100
+ /** Maximum input size */
101
+ total: number;
102
+ /** Unit of measurement for input */
103
+ unit: "tokens" | "characters";
104
+ /** Size of output embedding vectors */
105
+ dimensions: number;
106
+ /** Type of embeddings produced */
107
+ embeddingType?: "text" | "image" | "audio" | "multimodal";
108
+ /** Normalization of output vectors */
109
+ normalized?: boolean;
110
+ }
111
+ type ModelContext = TokenContext | CharacterContext | ImageContext | AudioInputContext | AudioOutputContext | EmbeddingContext;
54
112
  interface Model {
55
113
  /** Unique identifier */
56
114
  id: string;
@@ -70,6 +128,27 @@ interface Model {
70
128
  aliases?: string[];
71
129
  /** Context window information */
72
130
  context: ModelContext;
131
+ /** Base model ID this model extends */
132
+ extends?: string;
133
+ /** Properties that override the base model */
134
+ overrides?: Partial<Omit<Model, 'id' | 'extends' | 'overrides'>>;
135
+ }
136
+
137
+ interface Provider {
138
+ /** Provider identifier */
139
+ id: string;
140
+ /** Display name */
141
+ name: string;
142
+ /** Website URL */
143
+ websiteUrl: string;
144
+ /** API endpoint */
145
+ apiUrl: string;
146
+ /** Default model */
147
+ defaultModel?: string;
148
+ /** Whether this is a local provider */
149
+ isLocal?: number;
150
+ /** Model pricing */
151
+ models: Record<string, TokenBasedPricePerMillionTokens | ImagePrice>;
73
152
  }
74
153
 
75
154
  var creators = {
@@ -94,12 +173,16 @@ var creators$1 = {
94
173
  creators: creators
95
174
  };
96
175
 
97
- declare class ModelsCollection extends ModelCollection {
176
+ declare class AIModels extends ModelCollection {
177
+ constructor(models?: Model[]);
98
178
  get creators(): string[];
99
179
  get providers(): string[];
100
- fromCreator(creator: string): ModelCollection;
101
- getPrice(modelId: string, provider: string): ModelPrice | undefined;
180
+ getPrice(modelId: string, provider: string): TokenBasedPricePerMillionTokens | undefined;
181
+ /** Get provider information by ID */
182
+ getProvider(providerId: string): Provider | undefined;
183
+ /** Get all providers that can serve a specific model */
184
+ getProvidersForModel(modelId: string): Provider[];
102
185
  }
103
- declare const models: ModelsCollection;
186
+ declare const models: AIModels;
104
187
 
105
- export { type Capability, type Model, ModelCollection, type ModelContext, type ModelPrice, creators$1 as creators, models };
188
+ export { AIModels, type Capability, type Model, ModelCollection, type ModelContext, type Provider, type TokenBasedPricePerMillionTokens, creators$1 as creators, models };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- interface ModelPrice {
1
+ interface TokenBasedPricePerMillionTokens {
2
2
  /** Price per million input tokens */
3
3
  input: number;
4
4
  /** Price per million output tokens */
@@ -6,6 +6,16 @@ interface ModelPrice {
6
6
  /** Price type */
7
7
  type: 'token';
8
8
  }
9
+ interface ImagePrice {
10
+ /** Price per image */
11
+ price: number;
12
+ /** Image size */
13
+ size: string;
14
+ /** Price type */
15
+ type: 'image';
16
+ /** Price unit */
17
+ unit: 'per_image';
18
+ }
9
19
 
10
20
  /**
11
21
  * Defines all possible model capabilities
@@ -27,10 +37,17 @@ declare class ModelCollection extends Array<Model> {
27
37
  id(modelId: string): Model | undefined;
28
38
  /** Get models available from a specific provider */
29
39
  fromProvider(provider: string): ModelCollection;
40
+ /** Get models available from a specific creator */
41
+ fromCreator(creator: string): ModelCollection;
30
42
  /** Filter models by minimum context window size */
31
43
  withMinContext(tokens: number): ModelCollection;
32
44
  }
33
- interface TokenModelContext {
45
+ interface BaseContext {
46
+ /** The type discriminator */
47
+ type: string;
48
+ }
49
+ interface TokenContext extends BaseContext {
50
+ type: "token";
34
51
  /** Maximum input tokens the model can accept */
35
52
  total: number | null;
36
53
  /** Maximum tokens the model can generate in response */
@@ -42,15 +59,56 @@ interface TokenModelContext {
42
59
  */
43
60
  outputIsFixed?: 1;
44
61
  }
45
- interface ImageModelContext {
62
+ interface CharacterContext extends BaseContext {
63
+ type: "character";
64
+ /** Maximum input characters the model can accept */
65
+ total: number | null;
66
+ /** Maximum characters the model can generate in response */
67
+ maxOutput: number | null;
68
+ }
69
+ interface ImageContext extends BaseContext {
70
+ type: "image";
46
71
  /** Maximum outputs per request */
47
72
  maxOutput: number;
48
- /** Available image sizes */
73
+ /** Available image sizes (e.g. "1024x1024") */
49
74
  sizes: string[];
50
- /** Available quality settings */
75
+ /** Available quality settings (e.g. "standard", "hd") */
51
76
  qualities: string[];
52
77
  }
53
- type ModelContext = TokenModelContext | ImageModelContext;
78
+ interface AudioInputContext extends BaseContext {
79
+ type: "audio-in";
80
+ /** Maximum duration in seconds, null if unlimited */
81
+ maxDuration?: number | null;
82
+ /** Supported input formats */
83
+ formats?: string[];
84
+ /** Maximum file size in bytes */
85
+ maxSize?: number | null;
86
+ }
87
+ interface AudioOutputContext extends BaseContext {
88
+ type: "audio-out";
89
+ /** Maximum text length that can be converted to speech */
90
+ maxInput?: number | null;
91
+ /** Supported output formats */
92
+ formats?: string[];
93
+ /** Available voices */
94
+ voices?: string[];
95
+ /** Available quality settings */
96
+ qualities?: string[];
97
+ }
98
+ interface EmbeddingContext extends BaseContext {
99
+ type: "embedding";
100
+ /** Maximum input size */
101
+ total: number;
102
+ /** Unit of measurement for input */
103
+ unit: "tokens" | "characters";
104
+ /** Size of output embedding vectors */
105
+ dimensions: number;
106
+ /** Type of embeddings produced */
107
+ embeddingType?: "text" | "image" | "audio" | "multimodal";
108
+ /** Normalization of output vectors */
109
+ normalized?: boolean;
110
+ }
111
+ type ModelContext = TokenContext | CharacterContext | ImageContext | AudioInputContext | AudioOutputContext | EmbeddingContext;
54
112
  interface Model {
55
113
  /** Unique identifier */
56
114
  id: string;
@@ -70,6 +128,27 @@ interface Model {
70
128
  aliases?: string[];
71
129
  /** Context window information */
72
130
  context: ModelContext;
131
+ /** Base model ID this model extends */
132
+ extends?: string;
133
+ /** Properties that override the base model */
134
+ overrides?: Partial<Omit<Model, 'id' | 'extends' | 'overrides'>>;
135
+ }
136
+
137
+ interface Provider {
138
+ /** Provider identifier */
139
+ id: string;
140
+ /** Display name */
141
+ name: string;
142
+ /** Website URL */
143
+ websiteUrl: string;
144
+ /** API endpoint */
145
+ apiUrl: string;
146
+ /** Default model */
147
+ defaultModel?: string;
148
+ /** Whether this is a local provider */
149
+ isLocal?: number;
150
+ /** Model pricing */
151
+ models: Record<string, TokenBasedPricePerMillionTokens | ImagePrice>;
73
152
  }
74
153
 
75
154
  var creators = {
@@ -94,12 +173,16 @@ var creators$1 = {
94
173
  creators: creators
95
174
  };
96
175
 
97
- declare class ModelsCollection extends ModelCollection {
176
+ declare class AIModels extends ModelCollection {
177
+ constructor(models?: Model[]);
98
178
  get creators(): string[];
99
179
  get providers(): string[];
100
- fromCreator(creator: string): ModelCollection;
101
- getPrice(modelId: string, provider: string): ModelPrice | undefined;
180
+ getPrice(modelId: string, provider: string): TokenBasedPricePerMillionTokens | undefined;
181
+ /** Get provider information by ID */
182
+ getProvider(providerId: string): Provider | undefined;
183
+ /** Get all providers that can serve a specific model */
184
+ getProvidersForModel(modelId: string): Provider[];
102
185
  }
103
- declare const models: ModelsCollection;
186
+ declare const models: AIModels;
104
187
 
105
- export { type Capability, type Model, ModelCollection, type ModelContext, type ModelPrice, creators$1 as creators, models };
188
+ export { AIModels, type Capability, type Model, ModelCollection, type ModelContext, type Provider, type TokenBasedPricePerMillionTokens, creators$1 as creators, models };