@@ -47,14 +47,20 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
4747
4848 // Add 1M context beta flag if enabled for Claude Sonnet 4 and 4.5
4949 if (
50- ( modelId === "claude-sonnet-4-20250514" || modelId === "claude-sonnet-4-5" ) &&
50+ ( modelId === "claude-sonnet-4-20250514" ||
51+ modelId === "claude-sonnet-4-5" ||
52+ modelId === "claude-sonnet-4-5-20250929" ) &&
5153 this . options . anthropicBeta1MContext
5254 ) {
5355 betas . push ( "context-1m-2025-08-07" )
5456 }
5557
58+ // Map the alias to the full snapshot name for API calls
59+ const apiModelId = modelId === "claude-sonnet-4-5" ? "claude-sonnet-4-5-20250929" : modelId
60+
5661 switch ( modelId ) {
5762 case "claude-sonnet-4-5" :
63+ case "claude-sonnet-4-5-20250929" :
5864 case "claude-sonnet-4-20250514" :
5965 case "claude-opus-4-1-20250805" :
6066 case "claude-opus-4-20250514" :
@@ -83,7 +89,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
8389
8490 stream = await this . client . messages . create (
8591 {
86- model : modelId ,
92+ model : apiModelId ,
8793 max_tokens : maxTokens ?? ANTHROPIC_DEFAULT_MAX_TOKENS ,
8894 temperature,
8995 thinking,
@@ -115,6 +121,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
115121 // Then check for models that support prompt caching
116122 switch ( modelId ) {
117123 case "claude-sonnet-4-5" :
124+ case "claude-sonnet-4-5-20250929" :
118125 case "claude-sonnet-4-20250514" :
119126 case "claude-opus-4-1-20250805" :
120127 case "claude-opus-4-20250514" :
@@ -134,7 +141,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
134141 }
135142 default : {
136143 stream = ( await this . client . messages . create ( {
137- model : modelId ,
144+ model : apiModelId ,
138145 max_tokens : maxTokens ?? ANTHROPIC_DEFAULT_MAX_TOKENS ,
139146 temperature,
140147 system : [ { text : systemPrompt , type : "text" } ] ,
@@ -249,7 +256,10 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
249256 let info : ModelInfo = anthropicModels [ id ]
250257
251258 // 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-sonnet-4-5" ) && this . options . anthropicBeta1MContext ) {
259+ if (
260+ ( id === "claude-sonnet-4-20250514" || id === "claude-sonnet-4-5" || id === "claude-sonnet-4-5-20250929" ) &&
261+ this . options . anthropicBeta1MContext
262+ ) {
253263 // Use the tier pricing for 1M context
254264 const tier = info . tiers ?. [ 0 ]
255265 if ( tier ) {
@@ -286,8 +296,11 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
286296 async completePrompt ( prompt : string ) {
287297 let { id : model , temperature } = this . getModel ( )
288298
299+ // Map the alias to the full snapshot name for API calls
300+ const apiModel = model === "claude-sonnet-4-5" ? "claude-sonnet-4-5-20250929" : model
301+
289302 const message = await this . client . messages . create ( {
290- model,
303+ model : apiModel ,
291304 max_tokens : ANTHROPIC_DEFAULT_MAX_TOKENS ,
292305 thinking : undefined ,
293306 temperature,
@@ -310,8 +323,11 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
310323 // Use the current model
311324 const { id : model } = this . getModel ( )
312325
326+ // Map the alias to the full snapshot name for API calls
327+ const apiModel = model === "claude-sonnet-4-5" ? "claude-sonnet-4-5-20250929" : model
328+
313329 const response = await this . client . messages . countTokens ( {
314- model,
330+ model : apiModel ,
315331 messages : [ { role : "user" , content : content } ] ,
316332 } )
317333
0 commit comments