@@ -227,6 +227,19 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
227227 id = "claude-3-7-sonnet-20250219"
228228 }
229229
230+ // PATCH for issue with update
231+ const fallbackModelInfo : ModelInfo = {
232+ maxTokens : 8192 ,
233+ contextWindow : 200_000 ,
234+ supportsImages : true ,
235+ supportsComputerUse : true ,
236+ supportsPromptCache : true ,
237+ inputPrice : 3.0 ,
238+ outputPrice : 15.0 ,
239+ cacheWritesPrice : 3.75 ,
240+ cacheReadsPrice : 0.3 ,
241+ }
242+
230243 // Prioritize serverside model info
231244 if ( this . options . apiModelId && this . options . pearaiAgentModels ) {
232245 let modelInfo = null
@@ -236,7 +249,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
236249 modelInfo = this . options . pearaiAgentModels . models [ this . options . apiModelId || "pearai-model" ]
237250 }
238251 if ( modelInfo ) {
239- return {
252+ let result = {
240253 id : this . options . apiModelId ,
241254 info : modelInfo ,
242255 virtualId,
@@ -246,15 +259,36 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
246259 defaultMaxTokens : ANTHROPIC_DEFAULT_MAX_TOKENS ,
247260 } ) ,
248261 }
262+ if ( result . info . contextWindow === undefined ) {
263+ result . info = {
264+ maxTokens : 8192 ,
265+ contextWindow : 200_000 ,
266+ supportsImages : true ,
267+ supportsComputerUse : true ,
268+ supportsPromptCache : true ,
269+ inputPrice : 3.0 ,
270+ outputPrice : 15.0 ,
271+ cacheWritesPrice : 3.75 ,
272+ cacheReadsPrice : 0.3 ,
273+ }
274+ }
275+ if ( result . info . contextWindow === undefined ) {
276+ result . info = fallbackModelInfo
277+ }
278+ return result
249279 }
250280 }
251281
252- return {
282+ const result = {
253283 id,
254284 info,
255285 virtualId, // Include the original ID to use for header selection
256286 ...getModelParams ( { options : this . options , model : info , defaultMaxTokens : ANTHROPIC_DEFAULT_MAX_TOKENS } ) ,
257287 }
288+ if ( result . info . contextWindow === undefined ) {
289+ result . info = fallbackModelInfo
290+ }
291+ return result
258292 }
259293
260294 async completePrompt ( prompt : string ) {
0 commit comments