File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
webview-ui/src/components/ui/hooks Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,10 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
104104 : systemPrompt ,
105105 messages : supportsPromptCache ? addCacheBreakpoints ( messages ) : messages ,
106106 stream : true ,
107+ // Enable 1M context window if flag is set and model matches
108+ ...( id === ANTHROPIC_VERTEX_1M_CONTEXT_MODEL_ID && this . options . vertex1MContext
109+ ? { additionalModelRequestFields : { anthropic_beta : [ "context-1m-2025-08-07" ] } }
110+ : { } ) ,
107111 }
108112
109113 const stream = await this . client . messages . create ( params )
@@ -220,6 +224,9 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
220224 } ,
221225 ] ,
222226 stream : false ,
227+ ...( id === ANTHROPIC_VERTEX_1M_CONTEXT_MODEL_ID && this . options . vertex1MContext
228+ ? { additionalModelRequestFields : { anthropic_beta : [ "context-1m-2025-08-07" ] } }
229+ : { } ) ,
223230 }
224231
225232 const response = await this . client . messages . create ( params )
Original file line number Diff line number Diff line change @@ -214,8 +214,16 @@ function getSelectedModel({
214214 }
215215 case "vertex" : {
216216 const id = apiConfiguration . apiModelId ?? vertexDefaultModelId
217- const info = vertexModels [ id as keyof typeof vertexModels ]
218- return { id, info }
217+ const baseInfo = vertexModels [ id as keyof typeof vertexModels ]
218+ // Apply 1M context for Claude Sonnet 4 when enabled
219+ if ( id === "claude-sonnet-4@20250514" && apiConfiguration . vertex1MContext && baseInfo ) {
220+ const info : ModelInfo = {
221+ ...baseInfo ,
222+ contextWindow : 1_000_000 ,
223+ }
224+ return { id, info }
225+ }
226+ return { id, info : baseInfo }
219227 }
220228 case "gemini" : {
221229 const id = apiConfiguration . apiModelId ?? geminiDefaultModelId
You can’t perform that action at this time.
0 commit comments