source dump of claude code
at main 118 lines 4.3 kB view raw
1import type { ModelName } from './model.js' 2import type { APIProvider } from './providers.js' 3 4export type ModelConfig = Record<APIProvider, ModelName> 5 6// @[MODEL LAUNCH]: Add a new CLAUDE_*_CONFIG constant here. Double check the correct model strings 7// here since the pattern may change. 8 9export const CLAUDE_3_7_SONNET_CONFIG = { 10 firstParty: 'claude-3-7-sonnet-20250219', 11 bedrock: 'us.anthropic.claude-3-7-sonnet-20250219-v1:0', 12 vertex: 'claude-3-7-sonnet@20250219', 13 foundry: 'claude-3-7-sonnet', 14} as const satisfies ModelConfig 15 16export const CLAUDE_3_5_V2_SONNET_CONFIG = { 17 firstParty: 'claude-3-5-sonnet-20241022', 18 bedrock: 'anthropic.claude-3-5-sonnet-20241022-v2:0', 19 vertex: 'claude-3-5-sonnet-v2@20241022', 20 foundry: 'claude-3-5-sonnet', 21} as const satisfies ModelConfig 22 23export const CLAUDE_3_5_HAIKU_CONFIG = { 24 firstParty: 'claude-3-5-haiku-20241022', 25 bedrock: 'us.anthropic.claude-3-5-haiku-20241022-v1:0', 26 vertex: 'claude-3-5-haiku@20241022', 27 foundry: 'claude-3-5-haiku', 28} as const satisfies ModelConfig 29 30export const CLAUDE_HAIKU_4_5_CONFIG = { 31 firstParty: 'claude-haiku-4-5-20251001', 32 bedrock: 'us.anthropic.claude-haiku-4-5-20251001-v1:0', 33 vertex: 'claude-haiku-4-5@20251001', 34 foundry: 'claude-haiku-4-5', 35} as const satisfies ModelConfig 36 37export const CLAUDE_SONNET_4_CONFIG = { 38 firstParty: 'claude-sonnet-4-20250514', 39 bedrock: 'us.anthropic.claude-sonnet-4-20250514-v1:0', 40 vertex: 'claude-sonnet-4@20250514', 41 foundry: 'claude-sonnet-4', 42} as const satisfies ModelConfig 43 44export const CLAUDE_SONNET_4_5_CONFIG = { 45 firstParty: 'claude-sonnet-4-5-20250929', 46 bedrock: 'us.anthropic.claude-sonnet-4-5-20250929-v1:0', 47 vertex: 'claude-sonnet-4-5@20250929', 48 foundry: 'claude-sonnet-4-5', 49} as const satisfies ModelConfig 50 51export const CLAUDE_OPUS_4_CONFIG = { 52 firstParty: 'claude-opus-4-20250514', 53 bedrock: 'us.anthropic.claude-opus-4-20250514-v1:0', 54 vertex: 'claude-opus-4@20250514', 55 foundry: 'claude-opus-4', 56} as const satisfies ModelConfig 57 58export const CLAUDE_OPUS_4_1_CONFIG = { 59 firstParty: 'claude-opus-4-1-20250805', 60 bedrock: 'us.anthropic.claude-opus-4-1-20250805-v1:0', 61 vertex: 'claude-opus-4-1@20250805', 62 foundry: 'claude-opus-4-1', 63} as const satisfies ModelConfig 64 65export const CLAUDE_OPUS_4_5_CONFIG = { 66 firstParty: 'claude-opus-4-5-20251101', 67 bedrock: 'us.anthropic.claude-opus-4-5-20251101-v1:0', 68 vertex: 'claude-opus-4-5@20251101', 69 foundry: 'claude-opus-4-5', 70} as const satisfies ModelConfig 71 72export const CLAUDE_OPUS_4_6_CONFIG = { 73 firstParty: 'claude-opus-4-6', 74 bedrock: 'us.anthropic.claude-opus-4-6-v1', 75 vertex: 'claude-opus-4-6', 76 foundry: 'claude-opus-4-6', 77} as const satisfies ModelConfig 78 79export const CLAUDE_SONNET_4_6_CONFIG = { 80 firstParty: 'claude-sonnet-4-6', 81 bedrock: 'us.anthropic.claude-sonnet-4-6', 82 vertex: 'claude-sonnet-4-6', 83 foundry: 'claude-sonnet-4-6', 84} as const satisfies ModelConfig 85 86// @[MODEL LAUNCH]: Register the new config here. 87export const ALL_MODEL_CONFIGS = { 88 haiku35: CLAUDE_3_5_HAIKU_CONFIG, 89 haiku45: CLAUDE_HAIKU_4_5_CONFIG, 90 sonnet35: CLAUDE_3_5_V2_SONNET_CONFIG, 91 sonnet37: CLAUDE_3_7_SONNET_CONFIG, 92 sonnet40: CLAUDE_SONNET_4_CONFIG, 93 sonnet45: CLAUDE_SONNET_4_5_CONFIG, 94 sonnet46: CLAUDE_SONNET_4_6_CONFIG, 95 opus40: CLAUDE_OPUS_4_CONFIG, 96 opus41: CLAUDE_OPUS_4_1_CONFIG, 97 opus45: CLAUDE_OPUS_4_5_CONFIG, 98 opus46: CLAUDE_OPUS_4_6_CONFIG, 99} as const satisfies Record<string, ModelConfig> 100 101export type ModelKey = keyof typeof ALL_MODEL_CONFIGS 102 103/** Union of all canonical first-party model IDs, e.g. 'claude-opus-4-6' | 'claude-sonnet-4-5-20250929' | … */ 104export type CanonicalModelId = 105 (typeof ALL_MODEL_CONFIGS)[ModelKey]['firstParty'] 106 107/** Runtime list of canonical model IDs — used by comprehensiveness tests. */ 108export const CANONICAL_MODEL_IDS = Object.values(ALL_MODEL_CONFIGS).map( 109 c => c.firstParty, 110) as [CanonicalModelId, ...CanonicalModelId[]] 111 112/** Map canonical ID → internal short key. Used to apply settings-based modelOverrides. */ 113export const CANONICAL_ID_TO_KEY: Record<CanonicalModelId, ModelKey> = 114 Object.fromEntries( 115 (Object.entries(ALL_MODEL_CONFIGS) as [ModelKey, ModelConfig][]).map( 116 ([key, cfg]) => [cfg.firstParty, key], 117 ), 118 ) as Record<CanonicalModelId, ModelKey>