feat(vertex): add Claude Opus 4.7 support (#12135)

This commit is contained in:
Chiranjeevisantosh Madugundi 2026-04-20 10:42:10 -07:00 committed by GitHub
parent cb83656718
commit 3e202ebf5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 0 deletions

View file

@ -374,6 +374,27 @@ export const vertexModels = {
},
],
},
"claude-opus-4-7": {
maxTokens: 8192,
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
supportsImages: true,
supportsPromptCache: true,
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
cacheWritesPrice: 6.25, // $6.25 per million tokens
cacheReadsPrice: 0.5, // $0.50 per million tokens
supportsReasoningBudget: true,
// Tiered pricing for extended context (requires beta flag 'context-1m-2025-08-07')
tiers: [
{
contextWindow: 1_000_000, // 1M tokens with beta flag
inputPrice: 10.0, // $10 per million input tokens (>200K context)
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
},
],
},
"claude-opus-4-5@20251101": {
maxTokens: 8192,
contextWindow: 200_000,
@ -572,6 +593,7 @@ export const VERTEX_1M_CONTEXT_MODEL_IDS = [
"claude-sonnet-4-5@20250929",
"claude-sonnet-4-6",
"claude-opus-4-6",
"claude-opus-4-7",
] as const
export const VERTEX_REGIONS = [

View file

@ -914,6 +914,21 @@ describe("VertexHandler", () => {
expect(model.betas).toContain("context-1m-2025-08-07")
})
it("should enable 1M context for Claude Opus 4.7 when beta flag is set", () => {
const handler = new AnthropicVertexHandler({
apiModelId: "claude-opus-4-7",
vertexProjectId: "test-project",
vertexRegion: "us-central1",
vertex1MContext: true,
})
const model = handler.getModel()
expect(model.info.contextWindow).toBe(1_000_000)
expect(model.info.inputPrice).toBe(10.0)
expect(model.info.outputPrice).toBe(37.5)
expect(model.betas).toContain("context-1m-2025-08-07")
})
it("should not enable 1M context when flag is disabled", () => {
const handler = new AnthropicVertexHandler({
apiModelId: VERTEX_1M_CONTEXT_MODEL_IDS[0],