language-models 0.1.0 → 0.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.
- package/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-test.log +18 -0
- package/README.md +56 -142
- package/data/models.json +18805 -0
- package/dist/aliases.d.ts +5 -1
- package/dist/aliases.d.ts.map +1 -0
- package/dist/aliases.js +40 -4
- package/dist/aliases.js.map +1 -0
- package/dist/data/models.json +18805 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +94 -167
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +109 -69803
- package/dist/models.js.map +1 -0
- package/package.json +25 -23
- package/scripts/fetch-models.ts +115 -0
- package/src/aliases.test.ts +319 -0
- package/src/aliases.ts +48 -4
- package/src/index.test.ts +400 -0
- package/src/index.ts +20 -9
- package/src/models.test.ts +392 -0
- package/src/models.ts +174 -0
- package/tsconfig.json +5 -15
- package/vitest.config.ts +4 -14
- package/.editorconfig +0 -10
- package/.gitattributes +0 -4
- package/.releaserc.js +0 -129
- package/LICENSE +0 -21
- package/dist/parser.d.ts +0 -86
- package/dist/parser.js +0 -390
- package/dist/providers.d.ts +0 -1
- package/dist/providers.js +0 -76
- package/dist/types.d.ts +0 -127
- package/dist/types.js +0 -1
- package/eslint.config.js +0 -3
- package/generate/build-models.ts +0 -150
- package/generate/overwrites.ts +0 -12
- package/publish.js +0 -32
- package/roadmap.md +0 -54
- package/src/models.d.ts +0 -170
- package/src/models.js +0 -70434
- package/src/parser.ts +0 -485
- package/src/providers.ts +0 -79
- package/src/types.ts +0 -135
- package/tests/parser.test.ts +0 -11
- package/tests/regex.test.ts +0 -42
- package/tests/selector.test.ts +0 -53
- package/tests/setup.ts +0 -0
package/dist/providers.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import camelCase from 'camelcase';
|
|
2
|
-
const allProviders = [
|
|
3
|
-
'OpenAI',
|
|
4
|
-
'Anthropic',
|
|
5
|
-
'Google',
|
|
6
|
-
'Google AI Studio',
|
|
7
|
-
'Amazon Bedrock',
|
|
8
|
-
'Groq',
|
|
9
|
-
'SambaNova',
|
|
10
|
-
'Cohere',
|
|
11
|
-
'Mistral',
|
|
12
|
-
'Together',
|
|
13
|
-
'Together 2',
|
|
14
|
-
'Fireworks',
|
|
15
|
-
'DeepInfra',
|
|
16
|
-
'Lepton',
|
|
17
|
-
'Novita',
|
|
18
|
-
'Avian',
|
|
19
|
-
'Lambda',
|
|
20
|
-
'Azure',
|
|
21
|
-
'Modal',
|
|
22
|
-
'AnyScale',
|
|
23
|
-
'Replicate',
|
|
24
|
-
'Perplexity',
|
|
25
|
-
'Recursal',
|
|
26
|
-
'OctoAI',
|
|
27
|
-
'DeepSeek',
|
|
28
|
-
'Infermatic',
|
|
29
|
-
'AI21',
|
|
30
|
-
'Featherless',
|
|
31
|
-
'Inflection',
|
|
32
|
-
'xAI',
|
|
33
|
-
'Cloudflare',
|
|
34
|
-
'SF Compute',
|
|
35
|
-
'Minimax',
|
|
36
|
-
'Nineteen',
|
|
37
|
-
'Liquid',
|
|
38
|
-
'Stealth',
|
|
39
|
-
'NCompass',
|
|
40
|
-
'InferenceNet',
|
|
41
|
-
'Friendli',
|
|
42
|
-
'AionLabs',
|
|
43
|
-
'Alibaba',
|
|
44
|
-
'Nebius',
|
|
45
|
-
'Chutes',
|
|
46
|
-
'Kluster',
|
|
47
|
-
'Crusoe',
|
|
48
|
-
'Targon',
|
|
49
|
-
'Ubicloud',
|
|
50
|
-
'Parasail',
|
|
51
|
-
'Phala',
|
|
52
|
-
'Cent-ML',
|
|
53
|
-
'Venice',
|
|
54
|
-
'OpenInference',
|
|
55
|
-
'Atoma',
|
|
56
|
-
'01.AI',
|
|
57
|
-
'HuggingFace',
|
|
58
|
-
'Mancer',
|
|
59
|
-
'Mancer 2',
|
|
60
|
-
'Hyperbolic',
|
|
61
|
-
'Hyperbolic 2',
|
|
62
|
-
'Lynn 2',
|
|
63
|
-
'Lynn',
|
|
64
|
-
'Reflection',
|
|
65
|
-
];
|
|
66
|
-
export const getProviderName = (provider) => {
|
|
67
|
-
// Reverse a camelCase string into the provider's name
|
|
68
|
-
switch (provider) {
|
|
69
|
-
case 'vertex':
|
|
70
|
-
return 'Google';
|
|
71
|
-
case 'google':
|
|
72
|
-
return 'Google AI Studio';
|
|
73
|
-
default:
|
|
74
|
-
return allProviders.find((p) => camelCase(p) === provider);
|
|
75
|
-
}
|
|
76
|
-
};
|
package/dist/types.d.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
export type Endpoint = {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
contextLength: number;
|
|
5
|
-
model: Model;
|
|
6
|
-
modelVariantSlug: string;
|
|
7
|
-
modelVariantPermaslug: string;
|
|
8
|
-
providerName: string;
|
|
9
|
-
providerInfo: ProviderInfo;
|
|
10
|
-
providerDisplayName: string;
|
|
11
|
-
providerModelId: string;
|
|
12
|
-
providerGroup: string;
|
|
13
|
-
isCloaked: boolean;
|
|
14
|
-
quantization: null;
|
|
15
|
-
variant: string;
|
|
16
|
-
isSelfHosted: boolean;
|
|
17
|
-
canAbort: boolean;
|
|
18
|
-
maxPromptTokens: null;
|
|
19
|
-
maxCompletionTokens: number;
|
|
20
|
-
maxPromptImages: null;
|
|
21
|
-
maxTokensPerImage: null;
|
|
22
|
-
supportedParameters: string[];
|
|
23
|
-
isByok: boolean;
|
|
24
|
-
moderationRequired: boolean;
|
|
25
|
-
dataPolicy: DataPolicy;
|
|
26
|
-
pricing: Pricing;
|
|
27
|
-
isHidden: boolean;
|
|
28
|
-
isDeranked: boolean;
|
|
29
|
-
isDisabled: boolean;
|
|
30
|
-
supportsToolParameters: boolean;
|
|
31
|
-
supportsReasoning: boolean;
|
|
32
|
-
supportsMultipart: boolean;
|
|
33
|
-
limitRpm: number;
|
|
34
|
-
limitRpd: null;
|
|
35
|
-
hasCompletions: boolean;
|
|
36
|
-
hasChatCompletions: boolean;
|
|
37
|
-
features: Features;
|
|
38
|
-
providerRegion: null;
|
|
39
|
-
};
|
|
40
|
-
export type Model = {
|
|
41
|
-
slug: string;
|
|
42
|
-
hfSlug?: string | null;
|
|
43
|
-
updatedAt: string;
|
|
44
|
-
createdAt: string;
|
|
45
|
-
hfUpdatedAt: null;
|
|
46
|
-
name: string;
|
|
47
|
-
shortName: string;
|
|
48
|
-
author: string;
|
|
49
|
-
description: string;
|
|
50
|
-
modelVersionGroupId: string;
|
|
51
|
-
contextLength: number;
|
|
52
|
-
inputModalities: string[];
|
|
53
|
-
outputModalities: string[];
|
|
54
|
-
hasTextOutput: boolean;
|
|
55
|
-
group: string;
|
|
56
|
-
instructType: null;
|
|
57
|
-
defaultSystem: null;
|
|
58
|
-
defaultStops: any[];
|
|
59
|
-
hidden: boolean;
|
|
60
|
-
router: null;
|
|
61
|
-
warningMessage: null;
|
|
62
|
-
permaslug: string;
|
|
63
|
-
reasoningConfig: null;
|
|
64
|
-
endpoint?: Endpoint | Provider;
|
|
65
|
-
sorting?: Sorting;
|
|
66
|
-
providers?: Provider[];
|
|
67
|
-
provider?: Provider;
|
|
68
|
-
};
|
|
69
|
-
export type DataPolicy = {
|
|
70
|
-
termsOfServiceUrl: string;
|
|
71
|
-
privacyPolicyUrl: string;
|
|
72
|
-
training: boolean;
|
|
73
|
-
};
|
|
74
|
-
export type Features = {};
|
|
75
|
-
export type Pricing = {
|
|
76
|
-
prompt: string;
|
|
77
|
-
completion: string;
|
|
78
|
-
image: string;
|
|
79
|
-
request: string;
|
|
80
|
-
inputCacheRead: string;
|
|
81
|
-
inputCacheWrite: string;
|
|
82
|
-
webSearch: string;
|
|
83
|
-
internalReasoning: string;
|
|
84
|
-
};
|
|
85
|
-
export type ProviderInfo = {
|
|
86
|
-
name: string;
|
|
87
|
-
displayName: string;
|
|
88
|
-
baseUrl: string;
|
|
89
|
-
dataPolicy: DataPolicy;
|
|
90
|
-
headquarters: string;
|
|
91
|
-
hasChatCompletions: boolean;
|
|
92
|
-
hasCompletions: boolean;
|
|
93
|
-
isAbortable: boolean;
|
|
94
|
-
moderationRequired: boolean;
|
|
95
|
-
group: string;
|
|
96
|
-
editors: any[];
|
|
97
|
-
owners: any[];
|
|
98
|
-
isMultipartSupported: boolean;
|
|
99
|
-
statusPageUrl: null;
|
|
100
|
-
byokEnabled: boolean;
|
|
101
|
-
isPrimaryProvider: boolean;
|
|
102
|
-
icon: Icon;
|
|
103
|
-
};
|
|
104
|
-
export type Icon = {
|
|
105
|
-
url: string;
|
|
106
|
-
};
|
|
107
|
-
export type Provider = {
|
|
108
|
-
name: string;
|
|
109
|
-
slug: string;
|
|
110
|
-
quantization: string | null;
|
|
111
|
-
context: number;
|
|
112
|
-
maxCompletionTokens: number;
|
|
113
|
-
pricing: Pricing;
|
|
114
|
-
supportedParameters: string[];
|
|
115
|
-
inputCost: number;
|
|
116
|
-
outputCost: number;
|
|
117
|
-
throughput: number;
|
|
118
|
-
latency: number;
|
|
119
|
-
};
|
|
120
|
-
export type Sorting = {
|
|
121
|
-
topWeekly: number;
|
|
122
|
-
newest: number;
|
|
123
|
-
throughputHighToLow: number;
|
|
124
|
-
latencyLowToHigh: number;
|
|
125
|
-
pricingLowToHigh: number;
|
|
126
|
-
pricingHighToLow: number;
|
|
127
|
-
};
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/eslint.config.js
DELETED
package/generate/build-models.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import camelCase from 'camelcase'
|
|
2
|
-
import { flatten, unflatten } from 'flat'
|
|
3
|
-
|
|
4
|
-
const overwrites = {}
|
|
5
|
-
|
|
6
|
-
const sortingValues = ['top-weekly', 'newest', 'throughput-high-to-low', 'latency-low-to-high', 'pricing-low-to-high', 'pricing-high-to-low']
|
|
7
|
-
|
|
8
|
-
function camelCaseDeep<T>(input: T): T {
|
|
9
|
-
if (Array.isArray(input)) {
|
|
10
|
-
return input.map(camelCaseDeep) as any
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (input !== null && typeof input === 'object') {
|
|
14
|
-
return Object.entries(input).reduce(
|
|
15
|
-
(acc, [key, value]) => {
|
|
16
|
-
acc[camelCase(key)] = camelCaseDeep(value)
|
|
17
|
-
return acc
|
|
18
|
-
},
|
|
19
|
-
{} as Record<string, any>,
|
|
20
|
-
) as any
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return input
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async function fetchProviders(slug: string) {
|
|
27
|
-
const url = `https://openrouter.ai/api/frontend/stats/endpoint?permaslug=${slug}`
|
|
28
|
-
|
|
29
|
-
const response = (await fetch(url).then((res) => res.json())) as { data: any }
|
|
30
|
-
|
|
31
|
-
return camelCaseDeep(response.data || [])
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async function main() {
|
|
35
|
-
try {
|
|
36
|
-
const URL = 'https://openrouter.ai/api/frontend/models/find?order=top-weekly'
|
|
37
|
-
|
|
38
|
-
console.log('Fetching models data from OpenRouter...')
|
|
39
|
-
|
|
40
|
-
const data = (
|
|
41
|
-
await Promise.all(
|
|
42
|
-
sortingValues.map(async (sortingValue) => {
|
|
43
|
-
const URL = `https://openrouter.ai/api/frontend/models/find?order=${sortingValue}`
|
|
44
|
-
console.log(`Fetching ${URL}...`)
|
|
45
|
-
const response = (await fetch(URL).then((res) => res.json())) as { data: any }
|
|
46
|
-
return [sortingValue, camelCaseDeep(response.data)]
|
|
47
|
-
}),
|
|
48
|
-
)
|
|
49
|
-
).reduce(
|
|
50
|
-
(acc, [sortingValue, models]) => {
|
|
51
|
-
acc[sortingValue] = models
|
|
52
|
-
return acc
|
|
53
|
-
},
|
|
54
|
-
{} as Record<string, any>,
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
const models = data['top-weekly']
|
|
58
|
-
|
|
59
|
-
const modelsData = models.models.map((model) => {
|
|
60
|
-
if (model.slug in overwrites) {
|
|
61
|
-
console.log(`Overwriting model ${model.slug} with custom data`, overwrites[model.slug])
|
|
62
|
-
const tempModel: Record<string, unknown> = flatten(model)
|
|
63
|
-
const tempOverwrites: Record<string, unknown> = flatten(overwrites[model.slug])
|
|
64
|
-
const mergedModel = { ...tempModel, ...tempOverwrites }
|
|
65
|
-
return unflatten(mergedModel)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Find the model in the other sorting values
|
|
69
|
-
// Then add a sorting object that has the index of the model in the other sorting values
|
|
70
|
-
|
|
71
|
-
const modelIndexes = sortingValues
|
|
72
|
-
.map((sortingValue) => {
|
|
73
|
-
const models = data[sortingValue]
|
|
74
|
-
const index = models.models.findIndex((m) => m.slug === model.slug)
|
|
75
|
-
return {
|
|
76
|
-
[camelCase(sortingValue)]: index,
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
.reduce((acc, curr) => {
|
|
80
|
-
return { ...acc, ...curr }
|
|
81
|
-
}, {})
|
|
82
|
-
|
|
83
|
-
const mergedModel = { ...model, sorting: modelIndexes }
|
|
84
|
-
|
|
85
|
-
return mergedModel
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
const finalModels = []
|
|
89
|
-
|
|
90
|
-
const providerAliases = {
|
|
91
|
-
'Google AI Studio': 'google',
|
|
92
|
-
'Google Vertex': 'vertex',
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
let completed = 0
|
|
96
|
-
|
|
97
|
-
for (const model of modelsData) {
|
|
98
|
-
console.log(`[PROVIDERS] Fetching provider metadata for ${model.permaslug}...`)
|
|
99
|
-
|
|
100
|
-
const providers = await fetchProviders(model.permaslug)
|
|
101
|
-
model.providers = providers.map((provider) => {
|
|
102
|
-
const providerName = providerAliases[provider.providerDisplayName] || provider.providerDisplayName
|
|
103
|
-
|
|
104
|
-
const priceToDollars = (price: string) => {
|
|
105
|
-
// To get the dollar price, we need to multiply the price by a million.
|
|
106
|
-
const priceNumber = parseFloat(price)
|
|
107
|
-
return Number(
|
|
108
|
-
(priceNumber * 1000000)
|
|
109
|
-
.toFixed(2)
|
|
110
|
-
// Remove trailing zeros
|
|
111
|
-
.replace(/\.?0+$/, ''),
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
name: provider.providerDisplayName,
|
|
117
|
-
slug: camelCase(providerName),
|
|
118
|
-
quantization: provider.quantization,
|
|
119
|
-
context: provider.contextLength,
|
|
120
|
-
maxCompletionTokens: provider.maxCompletionTokens,
|
|
121
|
-
providerModelId: provider.providerModelId,
|
|
122
|
-
pricing: provider.pricing,
|
|
123
|
-
// Disable claude's reasoning parameter as it's only supported via the :thinking tag.
|
|
124
|
-
supportedParameters: model.slug === 'anthropic/claude-3.7-sonnet' ? ['max_tokens', 'temperature', 'stop', 'tools', 'tool_choice'] : provider.supportedParameters,
|
|
125
|
-
inputCost: priceToDollars(provider.pricing.prompt),
|
|
126
|
-
outputCost: priceToDollars(provider.pricing.completion),
|
|
127
|
-
throughput: provider.stats?.[0]?.p50Throughput,
|
|
128
|
-
latency: provider.stats?.[0]?.p50Latency,
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
completed++
|
|
133
|
-
console.log(`[PROVIDERS] ${completed}/${modelsData.length} models completed`)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Write to models.json in src directory
|
|
137
|
-
const { resolve } = await import('node:path')
|
|
138
|
-
const { writeFileSync } = await import('node:fs')
|
|
139
|
-
|
|
140
|
-
const outputPath = resolve('./src/models.js')
|
|
141
|
-
writeFileSync(outputPath, `export default ${JSON.stringify({ models: modelsData }, null, 2)}`)
|
|
142
|
-
|
|
143
|
-
console.log(`Models data written to ${outputPath}`)
|
|
144
|
-
} catch (error) {
|
|
145
|
-
console.error('Error fetching or writing models data:', error)
|
|
146
|
-
process.exit(1)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
main()
|
package/generate/overwrites.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file contains overwrites for the AI models.
|
|
3
|
-
* OpenRouter's data is not always 100% accurate, so we can overwrite certain
|
|
4
|
-
* models with our own data.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const overwrites = {
|
|
8
|
-
'anthropic/claude-3.7-sonnet': {
|
|
9
|
-
// Explicitly remove reasoning from this model as it's not actually supported.
|
|
10
|
-
'endpoint.supportedParameters': ['max_tokens', 'temperature', 'stop', 'tools', 'tool_choice'],
|
|
11
|
-
},
|
|
12
|
-
}
|
package/publish.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { execSync } from 'child_process';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
console.log('Attempting direct NPM publish...');
|
|
9
|
-
|
|
10
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
-
const __dirname = path.dirname(__filename);
|
|
12
|
-
const pkgPath = path.join(process.cwd(), 'package.json');
|
|
13
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
14
|
-
|
|
15
|
-
if (!pkg.version.startsWith('0.')) {
|
|
16
|
-
console.log(`Fixing package.json version: ${pkg.version} -> 0.1.0`);
|
|
17
|
-
pkg.version = '0.1.0';
|
|
18
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
execSync('npm publish --access public --tag next', {
|
|
22
|
-
stdio: 'inherit',
|
|
23
|
-
env: {
|
|
24
|
-
...process.env,
|
|
25
|
-
NPM_CONFIG_REGISTRY: 'https://registry.npmjs.org/',
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
console.log('Direct NPM publish successful');
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error('Error during direct NPM publish:', error.message);
|
|
32
|
-
}
|
package/roadmap.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# `ai-models` Roadmap
|
|
2
|
-
|
|
3
|
-
This roadmap outlines the planned features and considerations for the `ai-models` package, which provides utilities for working with AI SDKs, functions, workflows, observability, and evaluations.
|
|
4
|
-
|
|
5
|
-
## Model Identification & Syntax
|
|
6
|
-
|
|
7
|
-
- [ ] Support for provider/creator/model naming convention
|
|
8
|
-
- [ ] Determine whether to use the @ sign in naming syntax
|
|
9
|
-
- [ ] Support for creator/model syntax without provider specification
|
|
10
|
-
- [ ] Alignment with OpenRouter's syntax where possible
|
|
11
|
-
- [ ] Design naming convention: `@{provider}/{creator}/{model}:{config,capabilities,tools,priorities}`
|
|
12
|
-
- [ ] Alternative syntax support: `{creator}/{model}:{config,capabilities,tools,priorities}`
|
|
13
|
-
|
|
14
|
-
## Routing & Model Selection
|
|
15
|
-
|
|
16
|
-
- [ ] Implement our own version of openrouter/auto and openrouter/auto:online
|
|
17
|
-
- [ ] Tie routing logic to message content and/or priorities (performance, latency, throughput, cost)
|
|
18
|
-
- [ ] Support dynamic model fallback pattern
|
|
19
|
-
- [ ] Enable runtime tweaking of provider/model/settings/tools via query parameters
|
|
20
|
-
|
|
21
|
-
## Capabilities & Features
|
|
22
|
-
|
|
23
|
-
- [ ] Handle reasoning capabilities (follow OpenRouter's :reasoning flag)
|
|
24
|
-
- [ ] Support for code execution tools
|
|
25
|
-
- [ ] Design composite type tools for transforming outputs between models
|
|
26
|
-
- [ ] Implement online search capability routing (to models like gemini, perplexity, 4o-search)
|
|
27
|
-
- [ ] Support for general-purpose tools (similar to agentic.so)
|
|
28
|
-
- [ ] Develop secure code execution tool for JavaScript (as alternative to Python-based tools)
|
|
29
|
-
|
|
30
|
-
## Structured Output & Response Formats
|
|
31
|
-
|
|
32
|
-
- [ ] Support various methods for structured outputs:
|
|
33
|
-
- [ ] Native structured_output support
|
|
34
|
-
- [ ] Tool use with schema enforcement
|
|
35
|
-
- [ ] Response_format with JSON guarantees
|
|
36
|
-
- [ ] System prompt fallback method
|
|
37
|
-
- [ ] Handle compatibility between different output methods
|
|
38
|
-
|
|
39
|
-
## Use Cases Implementation
|
|
40
|
-
|
|
41
|
-
- [ ] Evaluation framework with dynamic model/settings/tools configuration
|
|
42
|
-
- [ ] Experimentation support (LLM-as-Judge comparisons between models)
|
|
43
|
-
- [ ] "Best model" specification without cost/price requirements
|
|
44
|
-
- [ ] Specific capability routing (e.g., reasoning-only models)
|
|
45
|
-
- [ ] Caching opt-in/out functionality
|
|
46
|
-
- [ ] Logging controls for sensitive PII situations
|
|
47
|
-
- [ ] Seed parameter support
|
|
48
|
-
|
|
49
|
-
## Phased Implementation
|
|
50
|
-
|
|
51
|
-
- [ ] Phase 1: Core model identification and routing
|
|
52
|
-
- [ ] Phase 2: Structured output and basic capabilities
|
|
53
|
-
- [ ] Phase 3: Advanced features and tools integration
|
|
54
|
-
- [ ] Phase 4: Comprehensive evaluation and experimentation framework
|
package/src/models.d.ts
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
// --- Reusable Base Interfaces ---
|
|
2
|
-
|
|
3
|
-
interface Icon {
|
|
4
|
-
url: string
|
|
5
|
-
invertRequired?: boolean
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface DataPolicy {
|
|
9
|
-
termsOfServiceUrl?: string // Optional based on examples
|
|
10
|
-
privacyPolicyUrl?: string // Optional based on examples
|
|
11
|
-
training: boolean
|
|
12
|
-
loggingRetentionDays?: number // Optional based on examples
|
|
13
|
-
requiresUserIds?: boolean // Optional based on examples
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Base pricing structure, allowing for optional cache fields
|
|
17
|
-
interface Pricing {
|
|
18
|
-
prompt: string
|
|
19
|
-
completion: string
|
|
20
|
-
image: string
|
|
21
|
-
request: string
|
|
22
|
-
webSearch: string
|
|
23
|
-
internalReasoning: string
|
|
24
|
-
discount: number
|
|
25
|
-
inputCacheRead?: string // Optional based on examples
|
|
26
|
-
inputCacheWrite?: string // Optional based on examples
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface ReasoningConfig {
|
|
30
|
-
startToken: string
|
|
31
|
-
endToken: string
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface Sorting {
|
|
35
|
-
topWeekly: number
|
|
36
|
-
newest: number
|
|
37
|
-
throughputHighToLow: number
|
|
38
|
-
latencyLowToHigh: number
|
|
39
|
-
pricingLowToHigh: number
|
|
40
|
-
pricingHighToLow: number
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface ProviderInfo {
|
|
44
|
-
name: string
|
|
45
|
-
displayName: string
|
|
46
|
-
baseUrl: string
|
|
47
|
-
dataPolicy: DataPolicy
|
|
48
|
-
headquarters?: string // Optional based on examples
|
|
49
|
-
hasChatCompletions: boolean
|
|
50
|
-
hasCompletions: boolean
|
|
51
|
-
isAbortable: boolean
|
|
52
|
-
moderationRequired: boolean
|
|
53
|
-
group: string
|
|
54
|
-
editors: never[] // Assuming these are always empty based on examples
|
|
55
|
-
owners: never[] // Assuming these are always empty based on examples
|
|
56
|
-
isMultipartSupported: boolean
|
|
57
|
-
statusPageUrl: string | null
|
|
58
|
-
byokEnabled: boolean
|
|
59
|
-
isPrimaryProvider: boolean
|
|
60
|
-
icon: Icon
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Represents an entry in the 'providers' array within a Model
|
|
64
|
-
interface ModelProvider {
|
|
65
|
-
name: string
|
|
66
|
-
slug: string
|
|
67
|
-
quantization: string | null
|
|
68
|
-
context: number
|
|
69
|
-
maxCompletionTokens: number | null // Can be null in examples
|
|
70
|
-
pricing: Pricing // Use the common Pricing type
|
|
71
|
-
supportedParameters: string[]
|
|
72
|
-
inputCost: number
|
|
73
|
-
outputCost: number
|
|
74
|
-
throughput?: number // Optional based on examples
|
|
75
|
-
latency?: number // Optional based on examples
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Represents the nested 'features.supportedParameters' object
|
|
79
|
-
interface SupportedParametersFeatures {
|
|
80
|
-
responseFormat?: boolean
|
|
81
|
-
structuredOutputs?: boolean
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Base Model structure (common fields without nested endpoint/providers)
|
|
85
|
-
// This helps avoid circular type definitions initially
|
|
86
|
-
interface ModelBase {
|
|
87
|
-
slug: string
|
|
88
|
-
hfSlug: string | null
|
|
89
|
-
updatedAt: string
|
|
90
|
-
createdAt: string
|
|
91
|
-
hfUpdatedAt: string | null // Assuming string like others, though only null seen
|
|
92
|
-
name: string
|
|
93
|
-
shortName: string
|
|
94
|
-
author: string
|
|
95
|
-
description: string
|
|
96
|
-
modelVersionGroupId: string | null
|
|
97
|
-
contextLength: number
|
|
98
|
-
inputModalities: string[]
|
|
99
|
-
outputModalities: string[]
|
|
100
|
-
hasTextOutput: boolean
|
|
101
|
-
group: string
|
|
102
|
-
instructType: string | null
|
|
103
|
-
defaultSystem: string | null // Assuming string, though only null seen
|
|
104
|
-
defaultStops: string[] // Use string[] as it can contain values
|
|
105
|
-
hidden: boolean
|
|
106
|
-
router: string | null // Assuming string, though only null seen
|
|
107
|
-
warningMessage: string | null
|
|
108
|
-
permaslug: string
|
|
109
|
-
reasoningConfig: ReasoningConfig | null
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Define Endpoint structure, referencing ModelBase for its 'model' property
|
|
113
|
-
interface Endpoint {
|
|
114
|
-
id: string
|
|
115
|
-
name: string
|
|
116
|
-
contextLength: number
|
|
117
|
-
model: ModelBase // Reference the base model structure
|
|
118
|
-
modelVariantSlug: string
|
|
119
|
-
modelVariantPermaslug: string
|
|
120
|
-
providerName: string
|
|
121
|
-
providerInfo: ProviderInfo
|
|
122
|
-
providerDisplayName: string
|
|
123
|
-
providerModelId: string
|
|
124
|
-
providerGroup: string
|
|
125
|
-
isCloaked: boolean
|
|
126
|
-
quantization: string | null
|
|
127
|
-
variant: string
|
|
128
|
-
isSelfHosted: boolean
|
|
129
|
-
canAbort: boolean
|
|
130
|
-
maxPromptTokens: number | null
|
|
131
|
-
maxCompletionTokens: number | null // Endpoint might have different limits
|
|
132
|
-
maxPromptImages: number | null
|
|
133
|
-
maxTokensPerImage: number | null
|
|
134
|
-
supportedParameters: string[]
|
|
135
|
-
isByok: boolean
|
|
136
|
-
moderationRequired: boolean
|
|
137
|
-
dataPolicy: DataPolicy // Data policy specific to the endpoint variant
|
|
138
|
-
pricing: Pricing // Pricing specific to the endpoint variant
|
|
139
|
-
isHidden: boolean
|
|
140
|
-
isDeranked: boolean
|
|
141
|
-
isDisabled: boolean
|
|
142
|
-
supportsToolParameters: boolean
|
|
143
|
-
supportsReasoning: boolean
|
|
144
|
-
supportsMultipart: boolean
|
|
145
|
-
limitRpm: number | null
|
|
146
|
-
limitRpd: number | null
|
|
147
|
-
hasCompletions: boolean
|
|
148
|
-
hasChatCompletions: boolean
|
|
149
|
-
features: {
|
|
150
|
-
supportedParameters?: SupportedParametersFeatures
|
|
151
|
-
}
|
|
152
|
-
providerRegion: string | null // Assuming string, though only null seen
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// --- Final Composed Model Interface ---
|
|
156
|
-
|
|
157
|
-
// Extend ModelBase and add the nested structures
|
|
158
|
-
interface Model extends ModelBase {
|
|
159
|
-
endpoint: Endpoint | null // Endpoint can be null
|
|
160
|
-
sorting: Sorting
|
|
161
|
-
providers: ModelProvider[] // Array can be empty
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// --- The Default Export ---
|
|
165
|
-
|
|
166
|
-
declare const _default: {
|
|
167
|
-
models: Model[]
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export default _default
|