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

Commit 4a160bc

Browse files
committed
feat: add Claude Opus 4.7 support for Bedrock, Anthropic, Vertex, and OpenRouter providers
1 parent cb83656 commit 4a160bc

5 files changed

Lines changed: 79 additions & 1 deletion

File tree

packages/types/src/providers/anthropic.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@ export const anthropicModels = {
7070
},
7171
],
7272
},
73+
"claude-opus-4-7": {
74+
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
75+
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag
76+
supportsImages: true,
77+
supportsPromptCache: true,
78+
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
79+
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
80+
cacheWritesPrice: 6.25, // $6.25 per million tokens
81+
cacheReadsPrice: 0.5, // $0.50 per million tokens
82+
supportsReasoningBudget: true,
83+
// Tiered pricing for extended context (requires beta flag)
84+
tiers: [
85+
{
86+
contextWindow: 1_000_000, // 1M tokens with beta flag
87+
inputPrice: 10.0, // $10 per million input tokens (>200K context)
88+
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
89+
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
90+
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
91+
},
92+
],
93+
},
7394
"claude-opus-4-6": {
7495
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
7596
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag

packages/types/src/providers/bedrock.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,30 @@ export const bedrockModels = {
143143
maxCachePoints: 4,
144144
cachableFields: ["system", "messages", "tools"],
145145
},
146+
"anthropic.claude-opus-4-7": {
147+
maxTokens: 8192,
148+
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
149+
supportsImages: true,
150+
supportsPromptCache: true,
151+
supportsReasoningBudget: true,
152+
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
153+
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
154+
cacheWritesPrice: 6.25, // $6.25 per million tokens
155+
cacheReadsPrice: 0.5, // $0.50 per million tokens
156+
minTokensPerCachePoint: 1024,
157+
maxCachePoints: 4,
158+
cachableFields: ["system", "messages", "tools"],
159+
// Tiered pricing for extended context (requires beta flag 'context-1m-2025-08-07')
160+
tiers: [
161+
{
162+
contextWindow: 1_000_000, // 1M tokens with beta flag
163+
inputPrice: 10.0, // $10 per million input tokens (>200K context)
164+
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
165+
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
166+
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
167+
},
168+
],
169+
},
146170
"anthropic.claude-opus-4-6-v1": {
147171
maxTokens: 8192,
148172
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
@@ -524,6 +548,7 @@ export const BEDROCK_1M_CONTEXT_MODEL_IDS = [
524548
"anthropic.claude-sonnet-4-20250514-v1:0",
525549
"anthropic.claude-sonnet-4-5-20250929-v1:0",
526550
"anthropic.claude-sonnet-4-6",
551+
"anthropic.claude-opus-4-7",
527552
"anthropic.claude-opus-4-6-v1",
528553
] as const
529554

@@ -541,6 +566,7 @@ export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
541566
"anthropic.claude-sonnet-4-6",
542567
"anthropic.claude-haiku-4-5-20251001-v1:0",
543568
"anthropic.claude-opus-4-5-20251101-v1:0",
569+
"anthropic.claude-opus-4-7",
544570
"anthropic.claude-opus-4-6-v1",
545571
] as const
546572

packages/types/src/providers/vertex.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,27 @@ export const vertexModels = {
353353
cacheReadsPrice: 0.1,
354354
supportsReasoningBudget: true,
355355
},
356+
"claude-opus-4-7": {
357+
maxTokens: 8192,
358+
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
359+
supportsImages: true,
360+
supportsPromptCache: true,
361+
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
362+
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
363+
cacheWritesPrice: 6.25, // $6.25 per million tokens
364+
cacheReadsPrice: 0.5, // $0.50 per million tokens
365+
supportsReasoningBudget: true,
366+
// Tiered pricing for extended context (requires beta flag 'context-1m-2025-08-07')
367+
tiers: [
368+
{
369+
contextWindow: 1_000_000, // 1M tokens with beta flag
370+
inputPrice: 10.0, // $10 per million input tokens (>200K context)
371+
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
372+
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
373+
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
374+
},
375+
],
376+
},
356377
"claude-opus-4-6": {
357378
maxTokens: 8192,
358379
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
@@ -571,6 +592,7 @@ export const VERTEX_1M_CONTEXT_MODEL_IDS = [
571592
"claude-sonnet-4@20250514",
572593
"claude-sonnet-4-5@20250929",
573594
"claude-sonnet-4-6",
595+
"claude-opus-4-7",
574596
"claude-opus-4-6",
575597
] as const
576598

src/api/providers/anthropic.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ 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 supported models (Claude Sonnet 4/4.5/4.6, Opus 4.6)
67+
// Add 1M context beta flag if enabled for supported models (Claude Sonnet 4/4.5/4.6, Opus 4.6/4.7)
6868
if (
6969
(modelId === "claude-sonnet-4-20250514" ||
7070
modelId === "claude-sonnet-4-5" ||
7171
modelId === "claude-sonnet-4-6" ||
72+
modelId === "claude-opus-4-7" ||
7273
modelId === "claude-opus-4-6") &&
7374
this.options.anthropicBeta1MContext
7475
) {
@@ -84,6 +85,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
8485
case "claude-sonnet-4-6":
8586
case "claude-sonnet-4-5":
8687
case "claude-sonnet-4-20250514":
88+
case "claude-opus-4-7":
8789
case "claude-opus-4-6":
8890
case "claude-opus-4-5-20251101":
8991
case "claude-opus-4-1-20250805":
@@ -150,6 +152,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
150152
case "claude-sonnet-4-6":
151153
case "claude-sonnet-4-5":
152154
case "claude-sonnet-4-20250514":
155+
case "claude-opus-4-7":
153156
case "claude-opus-4-6":
154157
case "claude-opus-4-5-20251101":
155158
case "claude-opus-4-1-20250805":
@@ -342,6 +345,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
342345
(id === "claude-sonnet-4-20250514" ||
343346
id === "claude-sonnet-4-5" ||
344347
id === "claude-sonnet-4-6" ||
348+
id === "claude-opus-4-7" ||
345349
id === "claude-opus-4-6") &&
346350
this.options.anthropicBeta1MContext
347351
) {

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") {

0 commit comments

Comments
 (0)