Skip to content

Commit a45e9cc

Browse files
committed
feat: add Claude Opus 4.6 support across all providers (#11224)
* feat: add Claude Opus 4.6 support across all providers Add Claude Opus 4.6 (claude-opus-4-6) model definitions and 1M context support across Anthropic, Bedrock, Vertex AI, OpenRouter, and Vercel AI Gateway providers. - Anthropic: 128K max output, /5 pricing, 1M context tiers - Bedrock: anthropic.claude-opus-4-6-v1:0 with 1M context + global inference - Vertex: claude-opus-4-6 with 1M context tiers - OpenRouter: prompt caching + reasoning budget sets - Vercel AI Gateway: Opus 4.5 and 4.6 added to capability sets - UI: 1M context checkbox for Opus 4.6 on all providers - i18n: Updated 1M context descriptions across 18 locales Also adds Opus 4.5 to Vercel AI Gateway (previously missing) and OpenRouter maxTokens overrides for Opus 4.5/4.6. Closes #11223 * fix: apply tier pricing when 1M context is enabled on Bedrock When awsBedrock1MContext is enabled for tiered models like Opus 4.6, also apply the 1M tier pricing (inputPrice, outputPrice, cache prices) instead of only updating contextWindow. This ensures cost calculations and UI display use the correct >200K rates.
1 parent eae9c96 commit a45e9cc

30 files changed

Lines changed: 196 additions & 73 deletions

packages/types/src/providers/anthropic.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { ModelInfo } from "../model.js"
22

33
// https://docs.anthropic.com/en/docs/about-claude/models
4+
// https://platform.claude.com/docs/en/about-claude/pricing
45

56
export type AnthropicModelId = keyof typeof anthropicModels
67
export const anthropicDefaultModelId: AnthropicModelId = "claude-sonnet-4-5"
@@ -48,6 +49,27 @@ export const anthropicModels = {
4849
},
4950
],
5051
},
52+
"claude-opus-4-6": {
53+
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
54+
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag
55+
supportsImages: true,
56+
supportsPromptCache: true,
57+
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
58+
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
59+
cacheWritesPrice: 6.25, // $6.25 per million tokens
60+
cacheReadsPrice: 0.5, // $0.50 per million tokens
61+
supportsReasoningBudget: true,
62+
// Tiered pricing for extended context (requires beta flag)
63+
tiers: [
64+
{
65+
contextWindow: 1_000_000, // 1M tokens with beta flag
66+
inputPrice: 10.0, // $10 per million input tokens (>200K context)
67+
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
68+
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
69+
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
70+
},
71+
],
72+
},
5173
"claude-opus-4-5-20251101": {
5274
maxTokens: 32_000, // Overridden to 8k if `enableReasoningEffort` is false.
5375
contextWindow: 200_000,

packages/types/src/providers/bedrock.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,30 @@ export const bedrockModels = {
119119
maxCachePoints: 4,
120120
cachableFields: ["system", "messages", "tools"],
121121
},
122+
"anthropic.claude-opus-4-6-v1:0": {
123+
maxTokens: 8192,
124+
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
125+
supportsImages: true,
126+
supportsPromptCache: true,
127+
supportsReasoningBudget: true,
128+
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
129+
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
130+
cacheWritesPrice: 6.25, // $6.25 per million tokens
131+
cacheReadsPrice: 0.5, // $0.50 per million tokens
132+
minTokensPerCachePoint: 1024,
133+
maxCachePoints: 4,
134+
cachableFields: ["system", "messages", "tools"],
135+
// Tiered pricing for extended context (requires beta flag 'context-1m-2025-08-07')
136+
tiers: [
137+
{
138+
contextWindow: 1_000_000, // 1M tokens with beta flag
139+
inputPrice: 10.0, // $10 per million input tokens (>200K context)
140+
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
141+
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
142+
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
143+
},
144+
],
145+
},
122146
"anthropic.claude-opus-4-5-20251101-v1:0": {
123147
maxTokens: 8192,
124148
contextWindow: 200_000,
@@ -475,6 +499,7 @@ export const BEDROCK_REGIONS = [
475499
export const BEDROCK_1M_CONTEXT_MODEL_IDS = [
476500
"anthropic.claude-sonnet-4-20250514-v1:0",
477501
"anthropic.claude-sonnet-4-5-20250929-v1:0",
502+
"anthropic.claude-opus-4-6-v1:0",
478503
] as const
479504

480505
// Amazon Bedrock models that support Global Inference profiles
@@ -483,11 +508,13 @@ export const BEDROCK_1M_CONTEXT_MODEL_IDS = [
483508
// - Claude Sonnet 4.5
484509
// - Claude Haiku 4.5
485510
// - Claude Opus 4.5
511+
// - Claude Opus 4.6
486512
export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
487513
"anthropic.claude-sonnet-4-20250514-v1:0",
488514
"anthropic.claude-sonnet-4-5-20250929-v1:0",
489515
"anthropic.claude-haiku-4-5-20251001-v1:0",
490516
"anthropic.claude-opus-4-5-20251101-v1:0",
517+
"anthropic.claude-opus-4-6-v1:0",
491518
] as const
492519

493520
// Amazon Bedrock Service Tier types

packages/types/src/providers/openrouter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ export const OPEN_ROUTER_PROMPT_CACHING_MODELS = new Set([
4040
"anthropic/claude-sonnet-4.5",
4141
"anthropic/claude-opus-4",
4242
"anthropic/claude-opus-4.1",
43-
"anthropic/claude-haiku-4.5",
4443
"anthropic/claude-opus-4.5",
44+
"anthropic/claude-opus-4.6",
45+
"anthropic/claude-haiku-4.5",
4546
"google/gemini-2.5-flash-preview",
4647
"google/gemini-2.5-flash-preview:thinking",
4748
"google/gemini-2.5-flash-preview-05-20",
@@ -70,9 +71,10 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
7071
"anthropic/claude-3.7-sonnet:beta",
7172
"anthropic/claude-opus-4",
7273
"anthropic/claude-opus-4.1",
74+
"anthropic/claude-opus-4.5",
75+
"anthropic/claude-opus-4.6",
7376
"anthropic/claude-sonnet-4",
7477
"anthropic/claude-sonnet-4.5",
75-
"anthropic/claude-opus-4.5",
7678
"anthropic/claude-haiku-4.5",
7779
"google/gemini-2.5-pro-preview",
7880
"google/gemini-2.5-pro",

packages/types/src/providers/vercel-ai-gateway.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export const VERCEL_AI_GATEWAY_PROMPT_CACHING_MODELS = new Set([
1111
"anthropic/claude-3.7-sonnet",
1212
"anthropic/claude-opus-4",
1313
"anthropic/claude-opus-4.1",
14+
"anthropic/claude-opus-4.5",
15+
"anthropic/claude-opus-4.6",
1416
"anthropic/claude-sonnet-4",
1517
"openai/gpt-4.1",
1618
"openai/gpt-4.1-mini",
@@ -50,6 +52,8 @@ export const VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS = new Set([
5052
"anthropic/claude-3.7-sonnet",
5153
"anthropic/claude-opus-4",
5254
"anthropic/claude-opus-4.1",
55+
"anthropic/claude-opus-4.5",
56+
"anthropic/claude-opus-4.6",
5357
"anthropic/claude-sonnet-4",
5458
"google/gemini-1.5-flash",
5559
"google/gemini-1.5-pro",

packages/types/src/providers/vertex.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,27 @@ export const vertexModels = {
274274
cacheReadsPrice: 0.1,
275275
supportsReasoningBudget: true,
276276
},
277+
"claude-opus-4-6": {
278+
maxTokens: 8192,
279+
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
280+
supportsImages: true,
281+
supportsPromptCache: true,
282+
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
283+
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
284+
cacheWritesPrice: 6.25, // $6.25 per million tokens
285+
cacheReadsPrice: 0.5, // $0.50 per million tokens
286+
supportsReasoningBudget: true,
287+
// Tiered pricing for extended context (requires beta flag 'context-1m-2025-08-07')
288+
tiers: [
289+
{
290+
contextWindow: 1_000_000, // 1M tokens with beta flag
291+
inputPrice: 10.0, // $10 per million input tokens (>200K context)
292+
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
293+
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
294+
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
295+
},
296+
],
297+
},
277298
"claude-opus-4-5@20251101": {
278299
maxTokens: 8192,
279300
contextWindow: 200_000,
@@ -467,7 +488,11 @@ export const vertexModels = {
467488

468489
// Vertex AI models that support 1M context window beta
469490
// Uses the same beta header 'context-1m-2025-08-07' as Anthropic and Bedrock
470-
export const VERTEX_1M_CONTEXT_MODEL_IDS = ["claude-sonnet-4@20250514", "claude-sonnet-4-5@20250929"] as const
491+
export const VERTEX_1M_CONTEXT_MODEL_IDS = [
492+
"claude-sonnet-4@20250514",
493+
"claude-sonnet-4-5@20250929",
494+
"claude-opus-4-6",
495+
] as const
471496

472497
export const VERTEX_REGIONS = [
473498
{ value: "global", label: "global" },

src/api/providers/anthropic.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
6464
// Filter out non-Anthropic blocks (reasoning, thoughtSignature, etc.) before sending to the API
6565
const sanitizedMessages = filterNonAnthropicBlocks(messages)
6666

67-
// Add 1M context beta flag if enabled for Claude Sonnet 4 and 4.5
67+
// Add 1M context beta flag if enabled for supported models (Claude Sonnet 4/4.5, Opus 4.6)
6868
if (
69-
(modelId === "claude-sonnet-4-20250514" || modelId === "claude-sonnet-4-5") &&
69+
(modelId === "claude-sonnet-4-20250514" ||
70+
modelId === "claude-sonnet-4-5" ||
71+
modelId === "claude-opus-4-6") &&
7072
this.options.anthropicBeta1MContext
7173
) {
7274
betas.push("context-1m-2025-08-07")
@@ -80,6 +82,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
8082
switch (modelId) {
8183
case "claude-sonnet-4-5":
8284
case "claude-sonnet-4-20250514":
85+
case "claude-opus-4-6":
8386
case "claude-opus-4-5-20251101":
8487
case "claude-opus-4-1-20250805":
8588
case "claude-opus-4-20250514":
@@ -144,6 +147,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
144147
switch (modelId) {
145148
case "claude-sonnet-4-5":
146149
case "claude-sonnet-4-20250514":
150+
case "claude-opus-4-6":
147151
case "claude-opus-4-5-20251101":
148152
case "claude-opus-4-1-20250805":
149153
case "claude-opus-4-20250514":
@@ -330,8 +334,11 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
330334
let id = modelId && modelId in anthropicModels ? (modelId as AnthropicModelId) : anthropicDefaultModelId
331335
let info: ModelInfo = anthropicModels[id]
332336

333-
// If 1M context beta is enabled for Claude Sonnet 4 or 4.5, update the model info
334-
if ((id === "claude-sonnet-4-20250514" || id === "claude-sonnet-4-5") && this.options.anthropicBeta1MContext) {
337+
// If 1M context beta is enabled for supported models, update the model info
338+
if (
339+
(id === "claude-sonnet-4-20250514" || id === "claude-sonnet-4-5" || id === "claude-opus-4-6") &&
340+
this.options.anthropicBeta1MContext
341+
) {
335342
// Use the tier pricing for 1M context
336343
const tier = info.tiers?.[0]
337344
if (tier) {

src/api/providers/bedrock.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
408408
temperature: modelConfig.temperature ?? (this.options.modelTemperature as number),
409409
}
410410

411-
// Check if 1M context is enabled for Claude Sonnet 4
411+
// Check if 1M context is enabled for supported Claude 4 models
412412
// Use parseBaseModelId to handle cross-region inference prefixes
413413
const baseModelId = this.parseBaseModelId(modelConfig.id)
414414
const is1MContextEnabled =
@@ -1097,14 +1097,19 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
10971097
}
10981098
}
10991099

1100-
// Check if 1M context is enabled for Claude Sonnet 4 / 4.5
1100+
// Check if 1M context is enabled for supported Claude 4 models
11011101
// Use parseBaseModelId to handle cross-region inference prefixes
11021102
const baseModelId = this.parseBaseModelId(modelConfig.id)
11031103
if (BEDROCK_1M_CONTEXT_MODEL_IDS.includes(baseModelId as any) && this.options.awsBedrock1MContext) {
1104-
// Update context window to 1M tokens when 1M context beta is enabled
1104+
// Update context window and pricing to 1M tier when 1M context beta is enabled
1105+
const tier = modelConfig.info.tiers?.[0]
11051106
modelConfig.info = {
11061107
...modelConfig.info,
1107-
contextWindow: 1_000_000,
1108+
contextWindow: tier?.contextWindow ?? 1_000_000,
1109+
inputPrice: tier?.inputPrice ?? modelConfig.info.inputPrice,
1110+
outputPrice: tier?.outputPrice ?? modelConfig.info.outputPrice,
1111+
cacheWritesPrice: tier?.cacheWritesPrice ?? modelConfig.info.cacheWritesPrice,
1112+
cacheReadsPrice: tier?.cacheReadsPrice ?? modelConfig.info.cacheReadsPrice,
11081113
}
11091114
}
11101115

src/api/providers/fetchers/openrouter.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,16 @@ export const parseOpenRouterModel = ({
248248
modelInfo.maxTokens = anthropicModels["claude-opus-4-1-20250805"].maxTokens
249249
}
250250

251+
// Set claude-opus-4.5 model to use the correct configuration
252+
if (id === "anthropic/claude-opus-4.5") {
253+
modelInfo.maxTokens = anthropicModels["claude-opus-4-5-20251101"].maxTokens
254+
}
255+
256+
// Set claude-opus-4.6 model to use the correct configuration
257+
if (id === "anthropic/claude-opus-4.6") {
258+
modelInfo.maxTokens = anthropicModels["claude-opus-4-6"].maxTokens
259+
}
260+
251261
// Ensure correct reasoning handling for Claude Haiku 4.5 on OpenRouter
252262
// Use budget control and disable effort-based reasoning fallback
253263
if (id === "anthropic/claude-haiku-4.5") {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export const Anthropic = ({ apiConfiguration, setApiConfigurationField }: Anthro
2424

2525
// Check if the current model supports 1M context beta
2626
const supports1MContextBeta =
27-
selectedModel?.id === "claude-sonnet-4-20250514" || selectedModel?.id === "claude-sonnet-4-5"
27+
selectedModel?.id === "claude-sonnet-4-20250514" ||
28+
selectedModel?.id === "claude-sonnet-4-5" ||
29+
selectedModel?.id === "claude-opus-4-6"
2830

2931
const handleInputChange = useCallback(
3032
<K extends keyof ProviderSettings, E>(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const Bedrock = ({ apiConfiguration, setApiConfigurationField, selectedMo
2828
const { t } = useAppTranslation()
2929
const [awsEndpointSelected, setAwsEndpointSelected] = useState(!!apiConfiguration?.awsBedrockEndpointEnabled)
3030

31-
// Check if the selected model supports 1M context (Claude Sonnet 4 / 4.5)
31+
// Check if the selected model supports 1M context (supported Claude 4 models)
3232
const supports1MContextBeta =
3333
!!apiConfiguration?.apiModelId && BEDROCK_1M_CONTEXT_MODEL_IDS.includes(apiConfiguration.apiModelId as any)
3434

0 commit comments

Comments
 (0)