Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 7747f6a

Browse files
committed
feat: add Claude Opus 4.7 support across all providers
Add claude-opus-4-7 model definitions and references to: - Anthropic direct API types and handler (1M context, prompt caching, extended thinking) - OpenRouter model sets and fetcher maxTokens override - Vercel AI Gateway prompt caching and vision+tools sets - WebView 1M context beta tier pricing check
1 parent f4b829b commit 7747f6a

6 files changed

Lines changed: 39 additions & 4 deletions

File tree

packages/types/src/providers/anthropic.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,27 @@ export const anthropicModels = {
9191
},
9292
],
9393
},
94+
"claude-opus-4-7": {
95+
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
96+
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag
97+
supportsImages: true,
98+
supportsPromptCache: true,
99+
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
100+
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
101+
cacheWritesPrice: 6.25, // $6.25 per million tokens
102+
cacheReadsPrice: 0.5, // $0.50 per million tokens
103+
supportsReasoningBudget: true,
104+
// Tiered pricing for extended context (requires beta flag)
105+
tiers: [
106+
{
107+
contextWindow: 1_000_000, // 1M tokens with beta flag
108+
inputPrice: 10.0, // $10 per million input tokens (>200K context)
109+
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
110+
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
111+
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
112+
},
113+
],
114+
},
94115
"claude-opus-4-5-20251101": {
95116
maxTokens: 32_000, // Overridden to 8k if `enableReasoningEffort` is false.
96117
contextWindow: 200_000,

packages/types/src/providers/openrouter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const OPEN_ROUTER_PROMPT_CACHING_MODELS = new Set([
4343
"anthropic/claude-opus-4.1",
4444
"anthropic/claude-opus-4.5",
4545
"anthropic/claude-opus-4.6",
46+
"anthropic/claude-opus-4.7",
4647
"anthropic/claude-haiku-4.5",
4748
"google/gemini-2.5-flash-preview",
4849
"google/gemini-2.5-flash-preview:thinking",
@@ -74,6 +75,7 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
7475
"anthropic/claude-opus-4.1",
7576
"anthropic/claude-opus-4.5",
7677
"anthropic/claude-opus-4.6",
78+
"anthropic/claude-opus-4.7",
7779
"anthropic/claude-sonnet-4",
7880
"anthropic/claude-sonnet-4.5",
7981
"anthropic/claude-sonnet-4.6",

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const VERCEL_AI_GATEWAY_PROMPT_CACHING_MODELS = new Set([
1313
"anthropic/claude-opus-4.1",
1414
"anthropic/claude-opus-4.5",
1515
"anthropic/claude-opus-4.6",
16+
"anthropic/claude-opus-4.7",
1617
"anthropic/claude-sonnet-4",
1718
"anthropic/claude-sonnet-4.6",
1819
"openai/gpt-4.1",
@@ -55,6 +56,7 @@ export const VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS = new Set([
5556
"anthropic/claude-opus-4.1",
5657
"anthropic/claude-opus-4.5",
5758
"anthropic/claude-opus-4.6",
59+
"anthropic/claude-opus-4.7",
5860
"anthropic/claude-sonnet-4",
5961
"anthropic/claude-sonnet-4.6",
6062
"google/gemini-1.5-flash",

src/api/providers/anthropic.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
6262
// Filter out non-Anthropic blocks (reasoning, thoughtSignature, etc.) before sending to the API
6363
const sanitizedMessages = filterNonAnthropicBlocks(messages)
6464

65-
// Add 1M context beta flag if enabled for supported models (Claude Sonnet 4/4.5/4.6, Opus 4.6)
65+
// Add 1M context beta flag if enabled for supported models (Claude Sonnet 4/4.5/4.6, Opus 4.6/4.7)
6666
if (
6767
(modelId === "claude-sonnet-4-20250514" ||
6868
modelId === "claude-sonnet-4-5" ||
6969
modelId === "claude-sonnet-4-6" ||
70-
modelId === "claude-opus-4-6") &&
70+
modelId === "claude-opus-4-6" ||
71+
modelId === "claude-opus-4-7") &&
7172
this.options.anthropicBeta1MContext
7273
) {
7374
betas.push("context-1m-2025-08-07")
@@ -82,6 +83,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
8283
case "claude-sonnet-4-6":
8384
case "claude-sonnet-4-5":
8485
case "claude-sonnet-4-20250514":
86+
case "claude-opus-4-7":
8587
case "claude-opus-4-6":
8688
case "claude-opus-4-5-20251101":
8789
case "claude-opus-4-1-20250805":
@@ -147,6 +149,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
147149
case "claude-sonnet-4-6":
148150
case "claude-sonnet-4-5":
149151
case "claude-sonnet-4-20250514":
152+
case "claude-opus-4-7":
150153
case "claude-opus-4-6":
151154
case "claude-opus-4-5-20251101":
152155
case "claude-opus-4-1-20250805":
@@ -316,7 +319,8 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
316319
(id === "claude-sonnet-4-20250514" ||
317320
id === "claude-sonnet-4-5" ||
318321
id === "claude-sonnet-4-6" ||
319-
id === "claude-opus-4-6") &&
322+
id === "claude-opus-4-6" ||
323+
id === "claude-opus-4-7") &&
320324
this.options.anthropicBeta1MContext
321325
) {
322326
// Use the tier pricing for 1M context

src/api/providers/fetchers/openrouter.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ export const parseOpenRouterModel = ({
263263
modelInfo.maxTokens = anthropicModels["claude-opus-4-6"].maxTokens
264264
}
265265

266+
// Set claude-opus-4.7 model to use the correct configuration
267+
if (id === "anthropic/claude-opus-4.7") {
268+
modelInfo.maxTokens = anthropicModels["claude-opus-4-7"].maxTokens
269+
}
270+
266271
// Ensure correct reasoning handling for Claude Haiku 4.5 on OpenRouter
267272
// Use budget control and disable effort-based reasoning fallback
268273
if (id === "anthropic/claude-haiku-4.5") {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ function getSelectedModel({
349349
(id === "claude-sonnet-4-20250514" ||
350350
id === "claude-sonnet-4-5" ||
351351
id === "claude-sonnet-4-6" ||
352-
id === "claude-opus-4-6") &&
352+
id === "claude-opus-4-6" ||
353+
id === "claude-opus-4-7") &&
353354
apiConfiguration.anthropicBeta1MContext &&
354355
baseInfo
355356
) {

0 commit comments

Comments
 (0)