-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathllmModels.ts
More file actions
177 lines (159 loc) · 6.49 KB
/
Copy pathllmModels.ts
File metadata and controls
177 lines (159 loc) · 6.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
export type LLMProvider =
| 'openai'
| 'anthropic'
| 'deepseek'
| 'llama.cpp'
| 'minimax'
| 'z.ai'
| 'kimi'
| 'openrouter';
export type ModelCategory = 'flagship' | 'general' | 'coding' | 'lightweight' | 'thinking';
export interface ModelInfo {
id: string;
name: string;
category?: ModelCategory;
}
export interface LLMConfig {
provider: LLMProvider;
apiKey: string;
baseUrl: string;
model: string;
customHeaders?: string;
}
export interface ProviderModelConfig {
displayName: string;
baseUrl: string;
defaultModel: string;
models: ModelInfo[];
}
export const LLM_PROVIDER_CONFIGS: Record<LLMProvider, ProviderModelConfig> = {
openai: {
displayName: 'OpenAI',
baseUrl: 'https://api.openai.com/v1',
defaultModel: 'gpt-5.4',
models: [
{ id: 'gpt-5.4', name: 'GPT-5.4', category: 'flagship' },
{ id: 'gpt-5.4-pro', name: 'GPT-5.4 Pro', category: 'flagship' },
{ id: 'gpt-5.4-thinking', name: 'GPT-5.4 Thinking', category: 'thinking' },
{ id: 'gpt-5.3', name: 'GPT-5.3', category: 'general' },
{ id: 'gpt-5.3-instant', name: 'GPT-5.3 Instant', category: 'general' },
{ id: 'gpt-5.3-codex', name: 'GPT-5.3 Codex', category: 'coding' },
{ id: 'gpt-5.3-codex-spark', name: 'GPT-5.3 Codex Spark', category: 'coding' },
{ id: 'gpt-5-mini', name: 'GPT-5 mini', category: 'lightweight' },
{ id: 'gpt-5-nano', name: 'GPT-5 nano', category: 'lightweight' },
{ id: 'gpt-4.1', name: 'GPT-4.1', category: 'general' },
{ id: 'gpt-4.1-mini', name: 'GPT-4.1 mini', category: 'lightweight' },
{ id: 'gpt-4.1-nano', name: 'GPT-4.1 nano', category: 'lightweight' },
{ id: 'gpt-4o', name: 'GPT-4o', category: 'general' },
{ id: 'gpt-4o-mini', name: 'GPT-4o mini', category: 'lightweight' },
{ id: 'gpt-4-turbo', name: 'GPT-4 Turbo', category: 'general' },
],
},
anthropic: {
displayName: 'Anthropic',
baseUrl: 'https://api.anthropic.com/v1',
defaultModel: 'claude-sonnet-4-6',
models: [
{ id: 'claude-opus-4-6', name: 'Claude Opus 4.6', category: 'flagship' },
{ id: 'claude-opus-4-5', name: 'Claude Opus 4.5', category: 'flagship' },
{ id: 'claude-sonnet-4-6', name: 'Claude Sonnet 4.6', category: 'general' },
{ id: 'claude-sonnet-4-5', name: 'Claude Sonnet 4.5', category: 'general' },
{ id: 'claude-haiku-4-5', name: 'Claude Haiku 4.5', category: 'lightweight' },
],
},
deepseek: {
displayName: 'DeepSeek',
baseUrl: 'https://api.deepseek.com/v1',
defaultModel: 'deepseek-chat',
models: [
{ id: 'deepseek-chat', name: 'DeepSeek Chat', category: 'general' },
{ id: 'deepseek-reasoner', name: 'DeepSeek Reasoner', category: 'thinking' },
],
},
'llama.cpp': {
displayName: 'llama.cpp',
baseUrl: 'http://localhost:8080',
defaultModel: 'local-model',
models: [],
},
minimax: {
displayName: 'MiniMax',
baseUrl: 'https://api.minimax.io/anthropic/v1',
defaultModel: 'MiniMax-M3',
models: [
{ id: 'MiniMax-M3', name: 'MiniMax M3', category: 'flagship' },
{ id: 'MiniMax-M2.7', name: 'MiniMax M2.7', category: 'flagship' },
{ id: 'MiniMax-M2.7-highspeed', name: 'MiniMax M2.7 Highspeed', category: 'general' },
],
},
'z.ai': {
displayName: 'Z.ai',
baseUrl: 'https://api.z.ai/api/coding/paas/v4',
defaultModel: 'glm-5',
models: [
{ id: 'glm-5', name: 'GLM-5', category: 'flagship' },
{ id: 'glm-5-code', name: 'GLM-5 Code', category: 'coding' },
{ id: 'glm-4.7', name: 'GLM-4.7', category: 'general' },
{ id: 'glm-4.6', name: 'GLM-4.6', category: 'general' },
{ id: 'glm-4.5', name: 'GLM-4.5', category: 'general' },
{ id: 'glm-4.5-x', name: 'GLM-4.5-X', category: 'general' },
{ id: 'glm-4.5-air', name: 'GLM-4.5 Air', category: 'lightweight' },
{ id: 'glm-4.5-airx', name: 'GLM-4.5 AirX', category: 'lightweight' },
{ id: 'glm-4.7-flash', name: 'GLM-4.7 Flash', category: 'lightweight' },
{ id: 'glm-4.7-flashx', name: 'GLM-4.7 FlashX', category: 'lightweight' },
{ id: 'glm-4.5-flash', name: 'GLM-4.5 Flash', category: 'lightweight' },
{ id: 'glm-4-32b-0414-128k', name: 'GLM-4 32B (128K)', category: 'general' },
],
},
kimi: {
displayName: 'Kimi',
baseUrl: 'https://api.moonshot.cn/v1',
defaultModel: 'kimi-k2-5',
models: [
{ id: 'kimi-k2-5', name: 'Kimi K2.5', category: 'flagship' },
{ id: 'kimi-k2', name: 'Kimi K2', category: 'flagship' },
{ id: 'kimi-k2-thinking', name: 'Kimi K2 Thinking', category: 'thinking' },
{ id: 'kimi-k2-turbo', name: 'Kimi K2 Turbo', category: 'general' },
],
},
openrouter: {
displayName: 'OpenRouter',
baseUrl: 'https://openrouter.ai/api/v1',
defaultModel: 'minimax/MiniMax-M3',
models: [
{ id: 'minimax/MiniMax-M3', name: 'MiniMax M3', category: 'flagship' },
{ id: 'minimax/MiniMax-M2.7', name: 'MiniMax M2.7', category: 'flagship' },
{ id: 'minimax/MiniMax-M2.7-highspeed', name: 'MiniMax M2.7 Highspeed', category: 'general' },
{ id: 'anthropic/claude-sonnet-4-6', name: 'Claude Sonnet 4.6', category: 'general' },
{ id: 'openai/gpt-5.4', name: 'GPT-5.4', category: 'flagship' },
{ id: 'deepseek/deepseek-chat', name: 'DeepSeek Chat', category: 'general' },
{ id: 'google/gemini-2.5-pro', name: 'Gemini 2.5 Pro', category: 'flagship' },
],
},
};
export const PROVIDER_MODELS: Record<LLMProvider, string[]> = Object.fromEntries(
Object.entries(LLM_PROVIDER_CONFIGS).map(([provider, config]) => [
provider,
config.models.map((m) => m.id),
]),
) as Record<LLMProvider, string[]>;
export function getDefaultProviderConfig(provider: LLMProvider): Omit<LLMConfig, 'apiKey'> {
const config = LLM_PROVIDER_CONFIGS[provider];
return {
provider,
baseUrl: config.baseUrl,
model: config.defaultModel,
};
}
export function getModelInfo(provider: LLMProvider, modelId: string): ModelInfo | undefined {
return LLM_PROVIDER_CONFIGS[provider]?.models.find((m) => m.id === modelId);
}
export function getModelsByCategory(provider: LLMProvider, category: ModelCategory): ModelInfo[] {
return LLM_PROVIDER_CONFIGS[provider]?.models.filter((m) => m.category === category) ?? [];
}
export function isPresetModel(provider: LLMProvider, modelId: string): boolean {
return LLM_PROVIDER_CONFIGS[provider]?.models.some((m) => m.id === modelId) ?? false;
}
export function getProviderDisplayName(provider: LLMProvider): string {
return LLM_PROVIDER_CONFIGS[provider]?.displayName ?? provider;
}