diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 2f3cf4ed54..448b1a748a 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -2220,18 +2220,17 @@ export class ClineProvider implements vscode.WebviewViewProvider { if (response.data) { const rawModels: Record = response.data - for (const [modelId, model] of Object.entries(rawModels)) { models[modelId] = { - maxTokens: model.maxTokens ? parseInt(model.maxTokens) : undefined, - contextWindow: model.contextWindow ? parseInt(model.contextWindow) : 0, - supportsImages: model.supportsImages ?? false, - supportsPromptCache: model.supportsPromptCaching ?? false, - supportsComputerUse: model.supportsComputerUse ?? false, - inputPrice: model.inputTokenPrice ? parseFloat(model.inputTokenPrice) : undefined, - outputPrice: model.outputTokenPrice ? parseFloat(model.outputTokenPrice) : undefined, - cacheWritesPrice: model.cacheWritePrice ? parseFloat(model.cacheWritePrice) : undefined, - cacheReadsPrice: model.cacheReadPrice ? parseFloat(model.cacheReadPrice) : undefined, + maxTokens: model?.maxTokens ? parseInt(model.maxTokens) : undefined, + contextWindow: model?.contextWindow ? parseInt(model.contextWindow) : 0, + supportsImages: model?.supportsImages ?? false, + supportsPromptCache: model?.supportsPromptCaching ?? false, + supportsComputerUse: model?.supportsComputerUse ?? false, + inputPrice: model?.inputTokenPrice ? parseFloat(model.inputTokenPrice) : undefined, + outputPrice: model?.outputTokenPrice ? parseFloat(model.outputTokenPrice) : undefined, + cacheWritesPrice: model?.cacheWritePrice ? parseFloat(model.cacheWritePrice) : undefined, + cacheReadsPrice: model?.cacheReadPrice ? parseFloat(model.cacheReadPrice) : undefined, } } }