aimodels 0.4.14 → 0.5.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 CHANGED
@@ -30,10 +30,10 @@ console.log(`Available chat models: ${chatModels.length}`);
30
30
  // 2. Find all chat models with vision capabilities from OpenAI
31
31
  const visionModelsFromOpenAI = models.canChat().canSee().fromProvider('openai');
32
32
  console.log(visionModelsFromOpenAI.map(model => model.name));
33
- // Example output: ["GPT-4o", "GPT-4 Vision", ...]
33
+ // Example output: ["GPT-5", "GPT-5.1", ...]
34
34
 
35
35
  // 3. Check if a specific model can process images
36
- const model = models.id('gpt-4o');
36
+ const model = models.id('gpt-5.1');
37
37
  if (model?.canSee()) {
38
38
  console.log(`${model.name} can process images`);
39
39
  // Enable image upload in your UI
@@ -107,8 +107,8 @@ function trimChatHistory(messages, model, reserveTokens = 500) {
107
107
 
108
108
  // Example usage
109
109
  const chatHistory = [/* array of message objects */];
110
- const gpt4 = models.id('gpt-4');
111
- const fittedMessages = trimChatHistory(chatHistory, gpt4);
110
+ const gpt5 = models.id('gpt-5.1');
111
+ const fittedMessages = trimChatHistory(chatHistory, gpt5);
112
112
  ```
113
113
 
114
114
  ### Available API Methods
@@ -135,7 +135,7 @@ models.fromCreator('meta') // Find models by creator
135
135
  models.withMinContext(32768) // Find models with at least this context size
136
136
 
137
137
  // Model lookup
138
- models.id('gpt-4o') // Find a specific model by ID
138
+ models.id('gpt-5.1') // Find a specific model by ID
139
139
  ```
140
140
 
141
141
  ## Features
package/dist/index.d.ts CHANGED
@@ -31,11 +31,25 @@ interface Organization {
31
31
  founded: number;
32
32
  }
33
33
 
34
+ interface ProviderModelsEntry {
35
+ /** ID of the creator whose models are referenced (e.g. 'openai') */
36
+ creator: string;
37
+ /**
38
+ * Either 'all' to include all models from this creator,
39
+ * or an explicit list of model IDs.
40
+ */
41
+ include: 'all' | string[];
42
+ /**
43
+ * Optional list of model IDs from this creator to exclude when include is 'all'.
44
+ */
45
+ exclude?: string[];
46
+ }
34
47
  interface ProviderSource {
35
48
  id: string;
36
49
  apiUrl: string;
37
50
  apiDocsUrl: string;
38
51
  pricing: Record<string, TokenBasedPricePerMillionTokens | ImagePrice>;
52
+ models?: ProviderModelsEntry[];
39
53
  }
40
54
  /** Provider-specific data */
41
55
  interface Provider extends Organization {
@@ -47,6 +61,8 @@ interface Provider extends Organization {
47
61
  isLocal?: number;
48
62
  /** Model pricing information */
49
63
  pricing: Record<string, TokenBasedPricePerMillionTokens | ImagePrice>;
64
+ /** Optional model mappings describing which creators' models this provider exposes */
65
+ models?: ProviderModelsEntry[];
50
66
  }
51
67
 
52
68
  /**
@@ -300,4 +316,4 @@ declare class AIModels extends ModelCollection {
300
316
  }
301
317
  declare const models: AIModels;
302
318
 
303
- export { AIModels, type AudioInputContext, type AudioOutputContext, type BaseContext, type Capability, type CharacterContext, type EmbeddingContext, type ImageContext, Model, ModelCollection, type ModelContext, type ModelSource, type Organization, type Provider, type ProviderSource, type TokenContext, models };
319
+ export { AIModels, type AudioInputContext, type AudioOutputContext, type BaseContext, type Capability, type CharacterContext, type EmbeddingContext, type ImageContext, Model, ModelCollection, type ModelContext, type ModelSource, type Organization, type Provider, type ProviderModelsEntry, type ProviderSource, type TokenContext, models };