Skip to content

Commit dbb5ac2

Browse files
celestial-vaultElephant Lumps
authored andcommitted
Claude 4 rest of updates (RooCodeInc#3749)
* add protos files (RooCodeInc#3736) Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local> * change package script * rest of updates for vertex / bedrock --------- Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
1 parent 1fd137b commit dbb5ac2

File tree

5 files changed

+76
-13
lines changed

5 files changed

+76
-13
lines changed

src/api/providers/bedrock.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export class AwsBedrockHandler implements ApiHandler {
4747
}
4848

4949
const budget_tokens = this.options.thinkingBudgetTokens || 0
50-
const reasoningOn = baseModelId.includes("3-7") && budget_tokens !== 0 ? true : false
50+
const reasoningOn =
51+
(baseModelId.includes("3-7") || baseModelId.includes("sonnet-4") || baseModelId.includes("opus-4")) &&
52+
budget_tokens !== 0
53+
? true
54+
: false
5155

5256
// Get model info and message indices for caching
5357
const userMsgIndices = messages.reduce((acc, msg, index) => (msg.role === "user" ? [...acc, index] : acc), [] as number[])

src/api/providers/requesty.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ export class RequestyHandler implements ApiHandler {
5151
thinkingBudget > 0
5252
? { thinking: { type: "enabled", budget_tokens: thinkingBudget } }
5353
: { thinking: { type: "disabled" } }
54-
const thinkingArgs = model.id.includes("claude-3-7-sonnet") ? thinking : {}
54+
const thinkingArgs =
55+
model.id.includes("claude-3-7-sonnet") || model.id.includes("claude-sonnet-4") || model.id.includes("claude-opus-4")
56+
? thinking
57+
: {}
5558

5659
// @ts-ignore-next-line
5760
const stream = await this.client.chat.completions.create({

src/api/providers/vertex.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ export class VertexHandler implements ApiHandler {
4141

4242
// Claude implementation
4343
let budget_tokens = this.options.thinkingBudgetTokens || 0
44-
const reasoningOn = modelId.includes("3-7") && budget_tokens !== 0 ? true : false
44+
const reasoningOn =
45+
(modelId.includes("3-7") || modelId.includes("sonnet-4") || modelId.includes("opus-4")) && budget_tokens !== 0
46+
? true
47+
: false
4548
let stream
4649

4750
switch (modelId) {
51+
case "claude-sonnet-4@20250514":
52+
case "claude-opus-4@20250514":
4853
case "claude-3-7-sonnet@20250219":
4954
case "claude-3-5-sonnet-v2@20241022":
5055
case "claude-3-5-sonnet@20240620":

src/shared/api.ts

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,28 @@ export const anthropicModels = {
218218
// AWS Bedrock
219219
// https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html
220220
export type BedrockModelId = keyof typeof bedrockModels
221-
export const bedrockDefaultModelId: BedrockModelId = "anthropic.claude-3-7-sonnet-20250219-v1:0"
221+
export const bedrockDefaultModelId: BedrockModelId = "anthropic.claude-sonnet-4-20250514-v1:0"
222222
export const bedrockModels = {
223+
"anthropic.claude-sonnet-4-20250514-v1:0": {
224+
maxTokens: 8192,
225+
contextWindow: 200_000,
226+
supportsImages: true,
227+
supportsPromptCache: true,
228+
inputPrice: 3.0,
229+
outputPrice: 15.0,
230+
cacheWritesPrice: 3.75,
231+
cacheReadsPrice: 0.3,
232+
},
233+
"anthropic.claude-opus-4-20250514-v1:0": {
234+
maxTokens: 8192,
235+
contextWindow: 200_000,
236+
supportsImages: true,
237+
supportsPromptCache: true,
238+
inputPrice: 15.0,
239+
outputPrice: 75.0,
240+
cacheWritesPrice: 18.75,
241+
cacheReadsPrice: 1.5,
242+
},
223243
"amazon.nova-premier-v1:0": {
224244
maxTokens: 10_000,
225245
contextWindow: 1_000_000,
@@ -356,8 +376,28 @@ export const openRouterDefaultModelInfo: ModelInfo = {
356376
// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude
357377
// https://cloud.google.com/vertex-ai/generative-ai/pricing#partner-models
358378
export type VertexModelId = keyof typeof vertexModels
359-
export const vertexDefaultModelId: VertexModelId = "claude-3-7-sonnet@20250219"
379+
export const vertexDefaultModelId: VertexModelId = "claude-sonnet-4@20250514"
360380
export const vertexModels = {
381+
"claude-sonnet-4@20250514": {
382+
maxTokens: 8192,
383+
contextWindow: 200_000,
384+
supportsImages: true,
385+
supportsPromptCache: true,
386+
inputPrice: 3.0,
387+
outputPrice: 15.0,
388+
cacheWritesPrice: 3.75,
389+
cacheReadsPrice: 0.3,
390+
},
391+
"claude-opus-4@20250514": {
392+
maxTokens: 8192,
393+
contextWindow: 200_000,
394+
supportsImages: true,
395+
supportsPromptCache: true,
396+
inputPrice: 15.0,
397+
outputPrice: 75.0,
398+
cacheWritesPrice: 18.75,
399+
cacheReadsPrice: 1.5,
400+
},
361401
"claude-3-7-sonnet@20250219": {
362402
maxTokens: 8192,
363403
contextWindow: 200_000,

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import {
5555
doubaoDefaultModelId,
5656
liteLlmModelInfoSaneDefaults,
5757
} from "@shared/api"
58-
import { ExtensionMessage } from "@shared/ExtensionMessage"
5958
import { useExtensionState } from "@/context/ExtensionStateContext"
6059
import { vscode } from "@/utils/vscode"
6160
import { ModelsServiceClient } from "@/services/grpc-client"
@@ -894,8 +893,14 @@ const ApiOptions = ({
894893
</div>
895894
)}
896895
{(selectedModelId === "anthropic.claude-3-7-sonnet-20250219-v1:0" ||
896+
selectedModelId === "anthropic.claude-sonnet-4-20250514-v1:0" ||
897+
selectedModelId === "anthropic.claude-opus-4-20250514-v1:0" ||
897898
(apiConfiguration?.awsBedrockCustomSelected &&
898-
apiConfiguration?.awsBedrockCustomModelBaseId === "anthropic.claude-3-7-sonnet-20250219-v1:0")) && (
899+
apiConfiguration?.awsBedrockCustomModelBaseId === "anthropic.claude-3-7-sonnet-20250219-v1:0") ||
900+
(apiConfiguration?.awsBedrockCustomSelected &&
901+
apiConfiguration?.awsBedrockCustomModelBaseId === "anthropic.claude-sonnet-4-20250514-v1:0") ||
902+
(apiConfiguration?.awsBedrockCustomSelected &&
903+
apiConfiguration?.awsBedrockCustomModelBaseId === "anthropic.claude-opus-4-20250514-v1:0")) && (
899904
<ThinkingBudgetSlider apiConfiguration={apiConfiguration} setApiConfiguration={setApiConfiguration} />
900905
)}
901906
<ModelInfoView
@@ -1648,7 +1653,7 @@ const ApiOptions = ({
16481653
value={apiConfiguration?.liteLlmModelId || ""}
16491654
style={{ width: "100%" }}
16501655
onInput={handleInputChange("liteLlmModelId")}
1651-
placeholder={"e.g. anthropic/claude-3-7-sonnet-20250219"}>
1656+
placeholder={"e.g. anthropic/claude-sonnet-4-20250514"}>
16521657
<span style={{ fontWeight: 500 }}>Model ID</span>
16531658
</VSCodeTextField>
16541659

@@ -1682,7 +1687,7 @@ const ApiOptions = ({
16821687
marginTop: "5px",
16831688
color: "var(--vscode-descriptionForeground)",
16841689
}}>
1685-
Extended thinking is available for models as Sonnet-3-7, o3-mini, Deepseek R1, etc. More info on{" "}
1690+
Extended thinking is available for models such as Sonnet-4, o3-mini, Deepseek R1, etc. More info on{" "}
16861691
<VSCodeLink
16871692
href="https://docs.litellm.ai/docs/reasoning_content"
16881693
style={{ display: "inline", fontSize: "inherit" }}>
@@ -2128,13 +2133,19 @@ const ApiOptions = ({
21282133
{selectedProvider === "nebius" && createDropdown(nebiusModels)}
21292134
</DropdownContainer>
21302135

2131-
{((selectedProvider === "anthropic" &&
2136+
{(selectedProvider === "anthropic" &&
21322137
(selectedModelId === "claude-3-7-sonnet-20250219" ||
21332138
selectedModelId === "claude-sonnet-4-20250514" ||
21342139
selectedModelId === "claude-opus-4-20250514")) ||
2135-
(selectedProvider === "vertex" && selectedModelId === "claude-3-7-sonnet@20250219")) && (
2136-
<ThinkingBudgetSlider apiConfiguration={apiConfiguration} setApiConfiguration={setApiConfiguration} />
2137-
)}
2140+
(selectedProvider === "vertex" &&
2141+
(selectedModelId === "claude-3-7-sonnet@20250219" ||
2142+
selectedModelId === "claude-sonnet-4@20250514" ||
2143+
selectedModelId === "claude-opus-4@20250514") && (
2144+
<ThinkingBudgetSlider
2145+
apiConfiguration={apiConfiguration}
2146+
setApiConfiguration={setApiConfiguration}
2147+
/>
2148+
))}
21382149

21392150
{selectedProvider === "xai" && selectedModelId.includes("3-mini") && (
21402151
<>

0 commit comments

Comments
 (0)