@cappasoft/openrouter-models 1.0.0 → 1.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.
Files changed (2) hide show
  1. package/README.md +49 -3
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # @cappasoft/openrouter-models
1
+ # 🔌 @cappasoft/openrouter-models
2
2
 
3
- Headless client for fetching and grouping OpenRouter models.
3
+ [![npm version](https://img.shields.io/npm/v/@cappasoft/openrouter-models.svg?style=flat-square)](https://www.npmjs.com/package/@cappasoft/openrouter-models)
4
+
5
+ Headless TypeScript client for fetching and grouping [OpenRouter](https://openrouter.ai) models.
4
6
 
5
7
  ## Installation
6
8
 
@@ -17,8 +19,52 @@ const client = createOpenRouterModelsClient({
17
19
  apiKey: 'sk-or-v1-...',
18
20
  })
19
21
 
22
+ // Fetch all models grouped by category
20
23
  const { models, categories } = await client.listModels()
21
- console.log(models.length, categories.map((c) => c.name))
24
+
25
+ console.log(`Found ${models.length} models`)
26
+ console.log(`Categories: ${categories.map(c => c.name).join(', ')}`)
27
+ ```
28
+
29
+ ## API
30
+
31
+ ### `createOpenRouterModelsClient(options)`
32
+
33
+ Creates a client instance.
34
+
35
+ ```ts
36
+ const client = createOpenRouterModelsClient({
37
+ apiKey: string, // Your OpenRouter API key
38
+ baseUrl?: string, // API base URL (optional)
39
+ })
40
+ ```
41
+
42
+ ### `client.listModels()`
43
+
44
+ Fetches all models and groups them by provider.
45
+
46
+ ```ts
47
+ const { models, categories } = await client.listModels()
48
+ ```
49
+
50
+ ### Types
51
+
52
+ ```ts
53
+ interface OpenRouterModel {
54
+ id: string
55
+ name: string
56
+ description?: string
57
+ context_length: number
58
+ pricing: { prompt: string; completion: string }
59
+ // ... more fields
60
+ }
61
+
62
+ interface ModelCategory {
63
+ name: string
64
+ models: OpenRouterModel[]
65
+ }
22
66
  ```
23
67
 
68
+ ## License
24
69
 
70
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cappasoft/openrouter-models",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Headless client for fetching and managing OpenRouter models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -36,4 +36,4 @@
36
36
  "tsup": "^8.3.5",
37
37
  "typescript": "^5.8.3"
38
38
  }
39
- }
39
+ }