Skip to content

Claude Sonnet 4 and Opus 4 Support for VertexAI Provider #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Claude Sonnet 4 and Claude Opus 4 support for VertexAI provider
Co-authored-by: king-11 <52061363+king-11@users.noreply.github.com>
  • Loading branch information
Copilot and king-11 committed Jul 14, 2025
commit 21884fcb3099ad6fb52de135b549daa27556a892
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ OpenCode supports a variety of AI models from different providers:

- Gemini 2.5
- Gemini 2.5 Flash
- Claude Sonnet 4
- Claude Opus 4

## Usage

Expand Down
2 changes: 1 addition & 1 deletion internal/llm/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ func init() {
maps.Copy(SupportedModels, AzureModels)
maps.Copy(SupportedModels, OpenRouterModels)
maps.Copy(SupportedModels, XAIModels)
maps.Copy(SupportedModels, VertexAIGeminiModels)
maps.Copy(SupportedModels, VertexAIModels)
maps.Copy(SupportedModels, CopilotModels)
}
36 changes: 34 additions & 2 deletions internal/llm/models/vertexai.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ package models
const (
ProviderVertexAI ModelProvider = "vertexai"

// Models
// Gemini Models
VertexAIGemini25Flash ModelID = "vertexai.gemini-2.5-flash"
VertexAIGemini25 ModelID = "vertexai.gemini-2.5"

// Claude Models
VertexAIClaude4Sonnet ModelID = "vertexai.claude-sonnet-4"
VertexAIClaude4Opus ModelID = "vertexai.claude-opus-4"
)

var VertexAIGeminiModels = map[ModelID]Model{
var VertexAIModels = map[ModelID]Model{
VertexAIGemini25Flash: {
ID: VertexAIGemini25Flash,
Name: "VertexAI: Gemini 2.5 Flash",
Expand All @@ -35,4 +39,32 @@ var VertexAIGeminiModels = map[ModelID]Model{
DefaultMaxTokens: GeminiModels[Gemini25].DefaultMaxTokens,
SupportsAttachments: true,
},
VertexAIClaude4Sonnet: {
ID: VertexAIClaude4Sonnet,
Name: "VertexAI: Claude Sonnet 4",
Provider: ProviderVertexAI,
APIModel: "claude-sonnet-4",
CostPer1MIn: AnthropicModels[Claude4Sonnet].CostPer1MIn,
CostPer1MInCached: AnthropicModels[Claude4Sonnet].CostPer1MInCached,
CostPer1MOut: AnthropicModels[Claude4Sonnet].CostPer1MOut,
CostPer1MOutCached: AnthropicModels[Claude4Sonnet].CostPer1MOutCached,
ContextWindow: AnthropicModels[Claude4Sonnet].ContextWindow,
DefaultMaxTokens: AnthropicModels[Claude4Sonnet].DefaultMaxTokens,
CanReason: AnthropicModels[Claude4Sonnet].CanReason,
SupportsAttachments: AnthropicModels[Claude4Sonnet].SupportsAttachments,
},
VertexAIClaude4Opus: {
ID: VertexAIClaude4Opus,
Name: "VertexAI: Claude Opus 4",
Provider: ProviderVertexAI,
APIModel: "claude-opus-4",
CostPer1MIn: AnthropicModels[Claude4Opus].CostPer1MIn,
CostPer1MInCached: AnthropicModels[Claude4Opus].CostPer1MInCached,
CostPer1MOut: AnthropicModels[Claude4Opus].CostPer1MOut,
CostPer1MOutCached: AnthropicModels[Claude4Opus].CostPer1MOutCached,
ContextWindow: AnthropicModels[Claude4Opus].ContextWindow,
DefaultMaxTokens: AnthropicModels[Claude4Opus].DefaultMaxTokens,
CanReason: AnthropicModels[Claude4Opus].CanReason,
SupportsAttachments: AnthropicModels[Claude4Opus].SupportsAttachments,
},
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy