File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -99,8 +99,11 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
9999 ; ( params as any ) . thinking = thinking
100100 }
101101
102- // Enable 1M context beta when using [1m] variants
103- const use1m = this . options . apiModelId ?. endsWith ( "[1m]" ) === true
102+ // Enable 1M context beta when using [1m] variants or when explicitly enabled via settings for Sonnet 4/4.5
103+ const use1m =
104+ this . options . apiModelId ?. endsWith ( "[1m]" ) === true ||
105+ ( ( id === "claude-sonnet-4@20250514" || id === "claude-sonnet-4-5@20250929" ) &&
106+ this . options . anthropicBeta1MContext === true )
104107
105108 let stream
106109 if ( use1m ) {
@@ -219,8 +222,11 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
219222 ; ( params as any ) . thinking = thinking
220223 }
221224
222- // Enable 1M context beta when using [1m] variants
223- const use1m = this . options . apiModelId ?. endsWith ( "[1m]" ) === true
225+ // Enable 1M context beta when using [1m] variants or when explicitly enabled via settings for Sonnet 4/4.5
226+ const use1m =
227+ this . options . apiModelId ?. endsWith ( "[1m]" ) === true ||
228+ ( ( id === "claude-sonnet-4@20250514" || id === "claude-sonnet-4-5@20250929" ) &&
229+ this . options . anthropicBeta1MContext === true )
224230
225231 const response = use1m
226232 ? await this . client . messages . create ( params , { headers : { "anthropic-beta" : "context-1m-2025-08-07" } } )
You can’t perform that action at this time.
0 commit comments