Skip to content

Commit 3bec87b

Browse files
committed
fix(vertex): default to under-200k pricing; gate 1M beta header by [1m] or setting; keep Computer Use enabled on [1m]; normalize [1m] suffix for SDK
1 parent 7ed34a1 commit 3bec87b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/api/providers/anthropic-vertex.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,11 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
9999
;(params as any).thinking = thinking
100100
}
101101

102-
// Enable 1M context beta when using [1m] variants
103-
const use1m = this.options.apiModelId?.endsWith("[1m]") === true
102+
// Enable 1M context beta when using [1m] variants or when explicitly enabled via settings for Sonnet 4/4.5
103+
const use1m =
104+
this.options.apiModelId?.endsWith("[1m]") === true ||
105+
((id === "claude-sonnet-4@20250514" || id === "claude-sonnet-4-5@20250929") &&
106+
this.options.anthropicBeta1MContext === true)
104107

105108
let stream
106109
if (use1m) {
@@ -219,8 +222,11 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
219222
;(params as any).thinking = thinking
220223
}
221224

222-
// Enable 1M context beta when using [1m] variants
223-
const use1m = this.options.apiModelId?.endsWith("[1m]") === true
225+
// Enable 1M context beta when using [1m] variants or when explicitly enabled via settings for Sonnet 4/4.5
226+
const use1m =
227+
this.options.apiModelId?.endsWith("[1m]") === true ||
228+
((id === "claude-sonnet-4@20250514" || id === "claude-sonnet-4-5@20250929") &&
229+
this.options.anthropicBeta1MContext === true)
224230

225231
const response = use1m
226232
? await this.client.messages.create(params, { headers: { "anthropic-beta": "context-1m-2025-08-07" } })

0 commit comments

Comments
 (0)