Skip to content

Commit fc7104d

Browse files
committed
fix: update cache pricing for 1M context tier
- Cache write price: .50/MTok for >200K context (was .75) - Cache read price: /bin/sh.60/MTok for >200K context (was /bin/sh.30) - Updated both AnthropicHandler and useSelectedModel to apply tier cache pricing
1 parent 10546ae commit fc7104d

File tree

23 files changed

+71
-6
lines changed

23 files changed

+71
-6
lines changed

packages/types/src/providers/anthropic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export const anthropicModels = {
2323
contextWindow: 1_000_000, // 1M tokens with beta flag
2424
inputPrice: 6.0, // $6 per million input tokens (>200K context)
2525
outputPrice: 22.5, // $22.50 per million output tokens (>200K context)
26-
cacheWritesPrice: 3.75, // Same cache pricing
27-
cacheReadsPrice: 0.3,
26+
cacheWritesPrice: 7.5, // $7.50 per million tokens (>200K context)
27+
cacheReadsPrice: 0.6, // $0.60 per million tokens (>200K context)
2828
},
2929
],
3030
},

src/api/providers/anthropic.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
253253
contextWindow: tier.contextWindow,
254254
inputPrice: tier.inputPrice,
255255
outputPrice: tier.outputPrice,
256+
cacheWritesPrice: tier.cacheWritesPrice,
257+
cacheReadsPrice: tier.cacheReadsPrice,
256258
}
257259
}
258260
}

webview-ui/src/components/settings/ModelInfoView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export const ModelInfoView = ({
4343
/>,
4444
typeof modelInfo?.contextWindow === "number" && modelInfo.contextWindow > 0 && (
4545
<>
46-
<span className="font-medium">Context Window:</span> {modelInfo.contextWindow?.toLocaleString()} tokens
46+
<span className="font-medium">{t("settings:modelInfo.contextWindow")}</span>{" "}
47+
{modelInfo.contextWindow?.toLocaleString()} tokens
4748
</>
4849
),
4950
typeof modelInfo?.maxTokens === "number" && modelInfo.maxTokens > 0 && (

webview-ui/src/components/settings/providers/Anthropic.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ export const Anthropic = ({ apiConfiguration, setApiConfigurationField }: Anthro
9191
onChange={(checked: boolean) => {
9292
setApiConfigurationField("anthropicBeta1MContext", checked)
9393
}}>
94-
Enable 1M context window (Beta)
94+
{t("settings:providers.anthropic1MContextBetaLabel")}
9595
</Checkbox>
9696
<div className="text-sm text-vscode-descriptionForeground mt-1 ml-6">
97-
Extends context window to 1 million tokens for Claude Sonnet 4
97+
{t("settings:providers.anthropic1MContextBetaDescription")}
9898
</div>
9999
</div>
100100
)}

webview-ui/src/components/ui/hooks/useSelectedModel.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,13 @@ function getSelectedModel({
302302
) {
303303
// Type assertion since we know claude-sonnet-4-20250514 has tiers
304304
const modelWithTiers = baseInfo as typeof baseInfo & {
305-
tiers?: Array<{ contextWindow: number; inputPrice?: number; outputPrice?: number }>
305+
tiers?: Array<{
306+
contextWindow: number
307+
inputPrice?: number
308+
outputPrice?: number
309+
cacheWritesPrice?: number
310+
cacheReadsPrice?: number
311+
}>
306312
}
307313
const tier = modelWithTiers.tiers?.[0]
308314
if (tier) {
@@ -312,6 +318,8 @@ function getSelectedModel({
312318
contextWindow: tier.contextWindow,
313319
inputPrice: tier.inputPrice ?? baseInfo.inputPrice,
314320
outputPrice: tier.outputPrice ?? baseInfo.outputPrice,
321+
cacheWritesPrice: tier.cacheWritesPrice ?? baseInfo.cacheWritesPrice,
322+
cacheReadsPrice: tier.cacheReadsPrice ?? baseInfo.cacheReadsPrice,
315323
}
316324
return { id, info }
317325
}

webview-ui/src/i18n/locales/ca/settings.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/de/settings.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/en/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@
258258
"anthropicApiKey": "Anthropic API Key",
259259
"getAnthropicApiKey": "Get Anthropic API Key",
260260
"anthropicUseAuthToken": "Pass Anthropic API Key as Authorization header instead of X-Api-Key",
261+
"anthropic1MContextBetaLabel": "Enable 1M context window (Beta)",
262+
"anthropic1MContextBetaDescription": "Extends context window to 1 million tokens for Claude Sonnet 4",
261263
"cerebrasApiKey": "Cerebras API Key",
262264
"getCerebrasApiKey": "Get Cerebras API Key",
263265
"chutesApiKey": "Chutes API Key",
@@ -726,6 +728,7 @@
726728
"noComputerUse": "Does not support computer use",
727729
"supportsPromptCache": "Supports prompt caching",
728730
"noPromptCache": "Does not support prompt caching",
731+
"contextWindow": "Context Window:",
729732
"maxOutput": "Max output",
730733
"inputPrice": "Input price",
731734
"outputPrice": "Output price",

webview-ui/src/i18n/locales/es/settings.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/fr/settings.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)