@@ -45,12 +45,16 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
4545 const cacheControl : CacheControlEphemeral = { type : "ephemeral" }
4646 let { id : modelId , betas = [ ] , maxTokens, temperature, reasoning : thinking } = this . getModel ( )
4747
48- // Add 1M context beta flag if enabled for Claude Sonnet 4
49- if ( modelId === "claude-sonnet-4-20250514" && this . options . anthropicBeta1MContext ) {
48+ // Add 1M context beta flag if enabled for Claude Sonnet 4 and 4.5
49+ if (
50+ ( modelId === "claude-sonnet-4-20250514" || modelId === "claude-4.5-sonnet" ) &&
51+ this . options . anthropicBeta1MContext
52+ ) {
5053 betas . push ( "context-1m-2025-08-07" )
5154 }
5255
5356 switch ( modelId ) {
57+ case "claude-4.5-sonnet" :
5458 case "claude-sonnet-4-20250514" :
5559 case "claude-opus-4-1-20250805" :
5660 case "claude-opus-4-20250514" :
@@ -110,6 +114,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
110114
111115 // Then check for models that support prompt caching
112116 switch ( modelId ) {
117+ case "claude-4.5-sonnet" :
113118 case "claude-sonnet-4-20250514" :
114119 case "claude-opus-4-1-20250805" :
115120 case "claude-opus-4-20250514" :
@@ -243,8 +248,8 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
243248 let id = modelId && modelId in anthropicModels ? ( modelId as AnthropicModelId ) : anthropicDefaultModelId
244249 let info : ModelInfo = anthropicModels [ id ]
245250
246- // If 1M context beta is enabled for Claude Sonnet 4, update the model info
247- if ( id === "claude-sonnet-4-20250514" && this . options . anthropicBeta1MContext ) {
251+ // If 1M context beta is enabled for Claude Sonnet 4 or 4.5 , update the model info
252+ if ( ( id === "claude-sonnet-4-20250514" || id === "claude-4.5-sonnet" ) && this . options . anthropicBeta1MContext ) {
248253 // Use the tier pricing for 1M context
249254 const tier = info . tiers ?. [ 0 ]
250255 if ( tier ) {
0 commit comments