llm-models 1.0.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/LICENSE +21 -0
- package/README.md +119 -0
- package/build/cli.d.ts +1 -0
- package/build/clients/models-dev.d.ts +2 -0
- package/build/clients/openrouter.d.ts +2 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +6356 -0
- package/build/schemas/models-dev.d.ts +966 -0
- package/build/schemas/openrouter.d.ts +570 -0
- package/build/types.d.ts +8 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Maxime Golfier
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# llm-models
|
|
2
|
+
|
|
3
|
+
Fetch latest LLM models from [OpenRouter](https://openrouter.ai) and [models.dev](https://models.dev) APIs.
|
|
4
|
+
|
|
5
|
+
Validates API responses with [Zod](https://zod.dev) schemas to detect breaking changes.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
### Homebrew
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
brew install maxgfr/tap/llm-models
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### npm
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g llm-models
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Binary
|
|
22
|
+
|
|
23
|
+
Download the latest binary from [GitHub Releases](https://github.com/maxgfr/llm-models/releases).
|
|
24
|
+
|
|
25
|
+
| Platform | Binary |
|
|
26
|
+
|----------|--------|
|
|
27
|
+
| macOS ARM64 | `llm-models-macos-arm64` |
|
|
28
|
+
| macOS Intel | `llm-models-macos-x64` |
|
|
29
|
+
| Linux x86_64 | `llm-models-linux-x64` |
|
|
30
|
+
| Linux ARM64 | `llm-models-linux-arm64` |
|
|
31
|
+
| Windows x64 | `llm-models-win-x64.exe` |
|
|
32
|
+
|
|
33
|
+
## CLI Usage
|
|
34
|
+
|
|
35
|
+
### OpenRouter
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# List all models
|
|
39
|
+
llm-models openrouter
|
|
40
|
+
|
|
41
|
+
# Filter by provider
|
|
42
|
+
llm-models openrouter --provider google
|
|
43
|
+
|
|
44
|
+
# Search by name or ID
|
|
45
|
+
llm-models openrouter --search "claude"
|
|
46
|
+
|
|
47
|
+
# Show model count
|
|
48
|
+
llm-models openrouter --count
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### models.dev
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# List all providers and models
|
|
55
|
+
llm-models models-dev
|
|
56
|
+
|
|
57
|
+
# Filter by provider
|
|
58
|
+
llm-models models-dev --provider openai
|
|
59
|
+
|
|
60
|
+
# Search models
|
|
61
|
+
llm-models models-dev --search "gpt-4"
|
|
62
|
+
|
|
63
|
+
# Show count
|
|
64
|
+
llm-models models-dev --count
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Options
|
|
68
|
+
|
|
69
|
+
| Option | Description |
|
|
70
|
+
|--------|-------------|
|
|
71
|
+
| `-p, --provider <id>` | Filter by provider prefix/ID |
|
|
72
|
+
| `-s, --search <term>` | Search models by name or ID |
|
|
73
|
+
| `-c, --count` | Show count only |
|
|
74
|
+
| `-V, --version` | Show version |
|
|
75
|
+
| `-h, --help` | Show help |
|
|
76
|
+
|
|
77
|
+
## Library Usage
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { fetchOpenRouterModels, fetchModelsDevModels } from "llm-models";
|
|
81
|
+
|
|
82
|
+
// Fetch from OpenRouter
|
|
83
|
+
const openrouter = await fetchOpenRouterModels();
|
|
84
|
+
console.log(openrouter.data.length, "models");
|
|
85
|
+
|
|
86
|
+
// Fetch from models.dev
|
|
87
|
+
const modelsDev = await fetchModelsDevModels();
|
|
88
|
+
console.log(Object.keys(modelsDev).length, "providers");
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Zod Schemas
|
|
92
|
+
|
|
93
|
+
All schemas are exported for custom validation:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { OpenRouterResponseSchema, ModelsDevResponseSchema } from "llm-models";
|
|
97
|
+
|
|
98
|
+
const result = OpenRouterResponseSchema.safeParse(myData);
|
|
99
|
+
if (!result.success) {
|
|
100
|
+
console.error(result.error.issues);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Types
|
|
105
|
+
|
|
106
|
+
All types are inferred from Zod schemas:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import type { OpenRouterModel, ModelsDevModel, ModelsDevProvider } from "llm-models";
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Data Sources
|
|
113
|
+
|
|
114
|
+
- **OpenRouter**: https://openrouter.ai/api/v1/models
|
|
115
|
+
- **models.dev**: https://models.dev/api.json
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|
package/build/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runCommand(): void;
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export { fetchOpenRouterModels } from "./clients/openrouter";
|
|
3
|
+
export { fetchModelsDevModels } from "./clients/models-dev";
|
|
4
|
+
export { OpenRouterModelSchema, OpenRouterResponseSchema, OpenRouterArchitectureSchema, OpenRouterPricingSchema, OpenRouterTopProviderSchema, OpenRouterDefaultParametersSchema, OpenRouterLinksSchema, } from "./schemas/openrouter";
|
|
5
|
+
export { ModelsDevModelSchema, ModelsDevProviderSchema, ModelsDevResponseSchema, ModelsDevCostSchema, ModelsDevLimitSchema, ModelsDevModalitiesSchema, } from "./schemas/models-dev";
|
|
6
|
+
export type { OpenRouterModel, OpenRouterResponse, ModelsDevModel, ModelsDevProvider, ModelsDevResponse, } from "./types";
|