Skip to content

Commit 3e202eb

Browse files
authored
feat(vertex): add Claude Opus 4.7 support (#12135)
1 parent cb83656 commit 3e202eb

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

packages/types/src/providers/vertex.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,27 @@ export const vertexModels = {
374374
},
375375
],
376376
},
377+
"claude-opus-4-7": {
378+
maxTokens: 8192,
379+
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
380+
supportsImages: true,
381+
supportsPromptCache: true,
382+
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
383+
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
384+
cacheWritesPrice: 6.25, // $6.25 per million tokens
385+
cacheReadsPrice: 0.5, // $0.50 per million tokens
386+
supportsReasoningBudget: true,
387+
// Tiered pricing for extended context (requires beta flag 'context-1m-2025-08-07')
388+
tiers: [
389+
{
390+
contextWindow: 1_000_000, // 1M tokens with beta flag
391+
inputPrice: 10.0, // $10 per million input tokens (>200K context)
392+
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
393+
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
394+
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
395+
},
396+
],
397+
},
377398
"claude-opus-4-5@20251101": {
378399
maxTokens: 8192,
379400
contextWindow: 200_000,
@@ -572,6 +593,7 @@ export const VERTEX_1M_CONTEXT_MODEL_IDS = [
572593
"claude-sonnet-4-5@20250929",
573594
"claude-sonnet-4-6",
574595
"claude-opus-4-6",
596+
"claude-opus-4-7",
575597
] as const
576598

577599
export const VERTEX_REGIONS = [

src/api/providers/__tests__/anthropic-vertex.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,21 @@ describe("VertexHandler", () => {
914914
expect(model.betas).toContain("context-1m-2025-08-07")
915915
})
916916

917+
it("should enable 1M context for Claude Opus 4.7 when beta flag is set", () => {
918+
const handler = new AnthropicVertexHandler({
919+
apiModelId: "claude-opus-4-7",
920+
vertexProjectId: "test-project",
921+
vertexRegion: "us-central1",
922+
vertex1MContext: true,
923+
})
924+
925+
const model = handler.getModel()
926+
expect(model.info.contextWindow).toBe(1_000_000)
927+
expect(model.info.inputPrice).toBe(10.0)
928+
expect(model.info.outputPrice).toBe(37.5)
929+
expect(model.betas).toContain("context-1m-2025-08-07")
930+
})
931+
917932
it("should not enable 1M context when flag is disabled", () => {
918933
const handler = new AnthropicVertexHandler({
919934
apiModelId: VERTEX_1M_CONTEXT_MODEL_IDS[0],

0 commit comments

Comments
 (0)