language-models 0.0.1
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/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-test.log +18 -0
- package/README.md +79 -0
- package/data/models.json +18805 -0
- package/dist/aliases.d.ts +5 -0
- package/dist/aliases.d.ts.map +1 -0
- package/dist/aliases.js +41 -0
- package/dist/aliases.js.map +1 -0
- package/dist/data/models.json +18805 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +97 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +109 -0
- package/dist/models.js.map +1 -0
- package/package.json +34 -0
- package/scripts/fetch-models.ts +115 -0
- package/src/aliases.test.ts +319 -0
- package/src/aliases.ts +49 -0
- package/src/index.test.ts +400 -0
- package/src/index.ts +21 -0
- package/src/models.test.ts +392 -0
- package/src/models.ts +174 -0
- package/tsconfig.json +9 -0
- package/vitest.config.ts +11 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
> language-models@0.0.1 test /Users/nathanclevenger/projects/mdx.org.ai/primitives/packages/language-models
|
|
3
|
+
> vitest
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
DEV v2.1.9 /Users/nathanclevenger/projects/mdx.org.ai/primitives/packages/language-models
|
|
7
|
+
|
|
8
|
+
✓ src/aliases.test.ts (48 tests) 8ms
|
|
9
|
+
✓ src/models.test.ts (41 tests) 11ms
|
|
10
|
+
✓ src/index.test.ts (39 tests) 14ms
|
|
11
|
+
|
|
12
|
+
Test Files 3 passed (3)
|
|
13
|
+
Tests 128 passed (128)
|
|
14
|
+
Start at 10:31:48
|
|
15
|
+
Duration 354ms (transform 130ms, setup 0ms, collect 167ms, tests 33ms, environment 0ms, prepare 183ms)
|
|
16
|
+
|
|
17
|
+
PASS Waiting for file changes...
|
|
18
|
+
press h to show help, press q to quit
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# language-models
|
|
2
|
+
|
|
3
|
+
Model listing and resolution for LLM providers. Fetches models from OpenRouter and resolves aliases to full model IDs.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { resolve, list, search } from 'language-models'
|
|
9
|
+
|
|
10
|
+
// Resolve aliases to full model IDs
|
|
11
|
+
resolve('opus') // 'anthropic/claude-opus-4.5'
|
|
12
|
+
resolve('gpt-4o') // 'openai/gpt-4o'
|
|
13
|
+
resolve('llama-70b') // 'meta-llama/llama-3.3-70b-instruct'
|
|
14
|
+
resolve('mistral') // 'mistralai/mistral-large-2411'
|
|
15
|
+
|
|
16
|
+
// List all available models
|
|
17
|
+
const models = list()
|
|
18
|
+
|
|
19
|
+
// Search models
|
|
20
|
+
const claudeModels = search('claude')
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
### `resolve(input: string): string`
|
|
26
|
+
|
|
27
|
+
Resolve an alias or partial name to a full model ID.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
resolve('opus') // 'anthropic/claude-opus-4.5'
|
|
31
|
+
resolve('sonnet') // 'anthropic/claude-sonnet-4.5'
|
|
32
|
+
resolve('gpt') // 'openai/gpt-4o'
|
|
33
|
+
resolve('llama') // 'meta-llama/llama-4-maverick'
|
|
34
|
+
resolve('anthropic/claude-opus-4.5') // 'anthropic/claude-opus-4.5' (pass-through)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `list(): ModelInfo[]`
|
|
38
|
+
|
|
39
|
+
List all available models from OpenRouter.
|
|
40
|
+
|
|
41
|
+
### `get(id: string): ModelInfo | undefined`
|
|
42
|
+
|
|
43
|
+
Get a model by exact ID.
|
|
44
|
+
|
|
45
|
+
### `search(query: string): ModelInfo[]`
|
|
46
|
+
|
|
47
|
+
Search models by ID or name.
|
|
48
|
+
|
|
49
|
+
## Available Aliases
|
|
50
|
+
|
|
51
|
+
| Alias | Model ID |
|
|
52
|
+
|-------|----------|
|
|
53
|
+
| `opus` | anthropic/claude-opus-4.5 |
|
|
54
|
+
| `sonnet` | anthropic/claude-sonnet-4.5 |
|
|
55
|
+
| `haiku` | anthropic/claude-haiku-4.5 |
|
|
56
|
+
| `claude` | anthropic/claude-sonnet-4.5 |
|
|
57
|
+
| `gpt`, `gpt-4o`, `4o` | openai/gpt-4o |
|
|
58
|
+
| `o1`, `o3`, `o3-mini` | openai/o1, openai/o3, openai/o3-mini |
|
|
59
|
+
| `gemini`, `flash` | google/gemini-2.5-flash |
|
|
60
|
+
| `gemini-pro` | google/gemini-2.5-pro |
|
|
61
|
+
| `llama`, `llama-4` | meta-llama/llama-4-maverick |
|
|
62
|
+
| `llama-70b` | meta-llama/llama-3.3-70b-instruct |
|
|
63
|
+
| `mistral` | mistralai/mistral-large-2411 |
|
|
64
|
+
| `codestral` | mistralai/codestral-2501 |
|
|
65
|
+
| `deepseek` | deepseek/deepseek-chat |
|
|
66
|
+
| `r1` | deepseek/deepseek-r1 |
|
|
67
|
+
| `qwen` | qwen/qwen3-235b-a22b |
|
|
68
|
+
| `grok` | x-ai/grok-3 |
|
|
69
|
+
| `sonar` | perplexity/sonar-pro |
|
|
70
|
+
|
|
71
|
+
## Updating Models
|
|
72
|
+
|
|
73
|
+
Fetch the latest models from OpenRouter:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pnpm fetch-models
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
This updates `data/models.json` with all available models.
|