Repository: RooCodeInc/Roo-Code (2026-04-16T18:19:25Z)

Issue:
[ENHANCEMENT] Add Vertex AI support for Claude Opus 4.7 (claude-opus-4-7)
### Problem (one or two sentences)

Vertex users cannot select or use Claude Opus 4.7 (claude-opus-4-7) in Roo Code. 


### Context (who is affected and when)

This affects users with the Vertex provider enabled when choosing models for coding, long-running agent tasks, and high-quality reasoning workloads. The gap appears during model selection and while using Claude 4.x configurations.



### Desired behavior (conceptual, not technical)

Users should be able to choose Claude Opus 4.7 in Vertex just like other supported Claude models. Behavior should feel consistent with existing Vertex Claude support, including optional 1M-context behavior where applicable.

### Constraints / preferences (optional)

_No response_

### Request checklist

- [x] I've searched existing Issues and Discussions for duplicates
- [x] This describes a specific problem with clear context and impact

### Roo Code Task Links (optional)

_No response_

### Acceptance criteria (optional)

Given a user with Vertex as provider

When they open model selection

Then claude-opus-4-7 is available and selectable

And when 1M context is enabled for this model

Then requests use 1M-context behavior consistently with existing Vertex Claude 1M handling


### Proposed approach (optional)

Add claude-opus-4-7 to Vertex model definitions and wire it like existing Opus/Sonnet 4.x entries, then add/update tests for selection and 1M-context behavior.



### Trade-offs / risks (optional)

If provider limits/pricing change after release, metadata may need quick follow-up updates.






Discussion:
I've analyzed this issue and here's my proposed implementation plan:

**Summary**: Add `claude-opus-4-7` to the Vertex AI model definitions, following the same pattern used for `claude-opus-4-6`.

**Changes required:**

1. **`packages/types/src/providers/vertex.ts`** - Add `"claude-opus-4-7"` entry to `vertexModels` with the same structure as `claude-opus-4-6` (200K context, 1M tier, prompt cache support, reasoning budget support, same pricing tier). Also add it to the `VERTEX_1M_CONTEXT_MODEL_IDS` array.

2. **`packages/types/src/providers/anthropic.ts`** - Add `"claude-opus-4-7"` entry to `anthropicModels` following the `claude-opus-4-6` pattern (128K maxTokens, 200K context, 1M tier, reasoning budget support).

3. **`src/api/providers/anthropic.ts`** - Add `"claude-opus-4-7"` to the switch/case statements that handle extended thinking and 1M context beta, alongside `claude-opus-4-6`.

4. **`src/api/providers/anthropic-vertex.ts`** - No changes needed; it dynamically reads from `vertexModels` and `VERTEX_1M_CONTEXT_MODEL_IDS`.

5. **Tests** - Add/update test cases in the relevant spec files (`anthropic-vertex.spec.ts`, `anthropic.spec.ts`) to cover model selection and 1M context behavior for `claude-opus-4-7`.

This approach mirrors exactly how `claude-opus-4-6` was added and keeps Vertex Opus 4.7 consistent with existing Vertex Claude support, including 1M-context behavior.

Please mention @roomote in a comment saying that you approve this plan, and I'll proceed with the implementation.



Patch:
diff --git a/packages/types/src/providers/vertex.ts b/packages/types/src/providers/vertex.ts
index 033c6b2e0d..858b28048e 100644
--- a/packages/types/src/providers/vertex.ts
+++ b/packages/types/src/providers/vertex.ts
@@ -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 = [


Test patch:
diff --git a/src/api/providers/__tests__/anthropic-vertex.spec.ts b/src/api/providers/__tests__/anthropic-vertex.spec.ts
index f1ada38a63..9ed0e51ad9 100644
--- a/src/api/providers/__tests__/anthropic-vertex.spec.ts
+++ b/src/api/providers/__tests__/anthropic-vertex.spec.ts
@@ -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],