-
Notifications
You must be signed in to change notification settings - Fork 578
Expand file tree
/
Copy pathclaudeModels.ts
More file actions
117 lines (110 loc) · 3.2 KB
/
claudeModels.ts
File metadata and controls
117 lines (110 loc) · 3.2 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
export type ClaudeModelId =
| 'claude-opus-4-5-20251101'
| 'claude-sonnet-4-5-20250929'
| 'claude-haiku-4-5-20251001';
export interface ClaudeModelDefinition {
id: ClaudeModelId;
/** Human friendly display name */
name: string;
/** Optional longer description */
description?: string;
/** Whether the model can accept images */
supportsImages?: boolean;
/** Acceptable alias strings that should resolve to this model id */
aliases: string[];
}
export const CLAUDE_MODEL_DEFINITIONS: ClaudeModelDefinition[] = [
{
id: 'claude-opus-4-5-20251101',
name: 'Claude Opus 4.5',
description: 'Newest Opus release with the strongest reasoning skills',
supportsImages: true,
aliases: [
'claude-opus-4-5-20251101',
'claude-opus-4-5',
'claude-opus-4.5',
'claude-opus-4',
'claude-opus',
'opus-4-5-20251101',
'opus-4-5',
'opus-4.5',
'opus-4',
'opus',
'claude-3-opus',
'claude-3-opus-20240229',
'claude-3-opus-latest',
],
},
{
id: 'claude-sonnet-4-5-20250929',
name: 'Claude Sonnet 4.5',
description: 'Balanced Sonnet tier with a large context window',
supportsImages: true,
aliases: [
'claude-sonnet-4-5-20250929',
'claude-sonnet-4-5',
'claude-sonnet-4.5',
'claude-sonnet-4',
'claude-sonnet',
'sonnet-4-5-20250929',
'sonnet-4-5',
'sonnet-4.5',
'sonnet-4',
'sonnet',
'claude-3.5-sonnet',
'claude-3-5-sonnet',
'claude-3-5-sonnet-20241022',
'claude-3-5-sonnet-latest',
],
},
{
id: 'claude-haiku-4-5-20251001',
name: 'Claude Haiku 4.5',
description: 'Fastest Haiku tier for lightweight tasks',
supportsImages: true,
aliases: [
'claude-haiku-4-5-20251001',
'claude-haiku-4-5',
'claude-haiku-4.5',
'claude-haiku-4',
'claude-haiku',
'haiku-4-5-20251001',
'haiku-4-5',
'haiku-4.5',
'haiku-4',
'haiku',
'claude-3-haiku',
'claude-3-haiku-20240307',
'claude-3-haiku-latest',
'claude-haiku-3.5',
],
},
];
export const CLAUDE_DEFAULT_MODEL: ClaudeModelId = 'claude-sonnet-4-5-20250929';
const CLAUDE_MODEL_ALIAS_MAP: Record<string, ClaudeModelId> = CLAUDE_MODEL_DEFINITIONS.reduce(
(map, definition) => {
definition.aliases.forEach(alias => {
const key = alias.trim().toLowerCase().replace(/[\s_]+/g, '-');
map[key] = definition.id;
});
map[definition.id.toLowerCase()] = definition.id;
return map;
},
{} as Record<string, ClaudeModelId>
);
export function normalizeClaudeModelId(model?: string | null): ClaudeModelId {
if (!model) return CLAUDE_DEFAULT_MODEL;
const normalized = model.trim().toLowerCase().replace(/[\s_]+/g, '-');
return CLAUDE_MODEL_ALIAS_MAP[normalized] ?? CLAUDE_DEFAULT_MODEL;
}
export function getClaudeModelDefinition(id: string): ClaudeModelDefinition | undefined {
return (
CLAUDE_MODEL_DEFINITIONS.find(def => def.id === id) ??
CLAUDE_MODEL_DEFINITIONS.find(def =>
def.aliases.some(alias => alias.toLowerCase() === id.toLowerCase())
)
);
}
export function getClaudeModelDisplayName(id: string): string {
return getClaudeModelDefinition(id)?.name ?? id;
}