mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
feat: update Bedrock's Claude models context window and adjust pricing
This commit is contained in:
parent
137d3f4fd8
commit
3d440a7ce8
3 changed files with 16 additions and 37 deletions
|
|
@ -14,7 +14,7 @@ export const bedrockDefaultPromptRouterModelId: BedrockModelId = "anthropic.clau
|
|||
// feature.
|
||||
export const bedrockModels = {
|
||||
"anthropic.claude-sonnet-4-5-20250929-v1:0": {
|
||||
maxTokens: 8192,
|
||||
maxTokens: 64_000,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
|
|
@ -28,8 +28,8 @@ export const bedrockModels = {
|
|||
cachableFields: ["system", "messages", "tools"],
|
||||
},
|
||||
"anthropic.claude-sonnet-4-6": {
|
||||
maxTokens: 8192,
|
||||
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
|
||||
maxTokens: 64_000,
|
||||
contextWindow: 1_000_000, // Native 1M context window
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
supportsReasoningBudget: true,
|
||||
|
|
@ -40,16 +40,6 @@ export const bedrockModels = {
|
|||
minTokensPerCachePoint: 1024,
|
||||
maxCachePoints: 4,
|
||||
cachableFields: ["system", "messages", "tools"],
|
||||
// Tiered pricing for extended context (requires beta flag 'context-1m-2025-08-07')
|
||||
tiers: [
|
||||
{
|
||||
contextWindow: 1_000_000, // 1M tokens with beta flag
|
||||
inputPrice: 6.0, // $6 per million input tokens (>200K context)
|
||||
outputPrice: 22.5, // $22.50 per million output tokens (>200K context)
|
||||
cacheWritesPrice: 7.5, // $7.50 per million tokens (>200K context)
|
||||
cacheReadsPrice: 0.6, // $0.60 per million tokens (>200K context)
|
||||
},
|
||||
],
|
||||
},
|
||||
"amazon.nova-pro-v1:0": {
|
||||
maxTokens: 5000,
|
||||
|
|
@ -116,7 +106,7 @@ export const bedrockModels = {
|
|||
cachableFields: ["system"],
|
||||
},
|
||||
"anthropic.claude-sonnet-4-20250514-v1:0": {
|
||||
maxTokens: 8192,
|
||||
maxTokens: 64_000,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
|
|
@ -130,7 +120,7 @@ export const bedrockModels = {
|
|||
cachableFields: ["system", "messages", "tools"],
|
||||
},
|
||||
"anthropic.claude-opus-4-1-20250805-v1:0": {
|
||||
maxTokens: 8192,
|
||||
maxTokens: 64_000,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
|
|
@ -144,8 +134,8 @@ export const bedrockModels = {
|
|||
cachableFields: ["system", "messages", "tools"],
|
||||
},
|
||||
"anthropic.claude-opus-4-6-v1": {
|
||||
maxTokens: 8192,
|
||||
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
|
||||
maxTokens: 128_000,
|
||||
contextWindow: 1_000_000, // Native 1M context window
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
supportsReasoningBudget: true,
|
||||
|
|
@ -156,19 +146,9 @@ export const bedrockModels = {
|
|||
minTokensPerCachePoint: 1024,
|
||||
maxCachePoints: 4,
|
||||
cachableFields: ["system", "messages", "tools"],
|
||||
// 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)
|
||||
},
|
||||
],
|
||||
},
|
||||
"anthropic.claude-opus-4-5-20251101-v1:0": {
|
||||
maxTokens: 8192,
|
||||
maxTokens: 64_000,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
|
|
@ -182,7 +162,7 @@ export const bedrockModels = {
|
|||
cachableFields: ["system", "messages", "tools"],
|
||||
},
|
||||
"anthropic.claude-opus-4-20250514-v1:0": {
|
||||
maxTokens: 8192,
|
||||
maxTokens: 64_000,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
|
|
@ -523,8 +503,6 @@ export const BEDROCK_REGIONS = [
|
|||
export const BEDROCK_1M_CONTEXT_MODEL_IDS = [
|
||||
"anthropic.claude-sonnet-4-20250514-v1:0",
|
||||
"anthropic.claude-sonnet-4-5-20250929-v1:0",
|
||||
"anthropic.claude-sonnet-4-6",
|
||||
"anthropic.claude-opus-4-6-v1",
|
||||
] as const
|
||||
|
||||
// Amazon Bedrock models that support Global Inference profiles
|
||||
|
|
|
|||
|
|
@ -701,19 +701,20 @@ describe("AwsBedrockHandler", () => {
|
|||
expect(model.info.contextWindow).toBe(1_000_000)
|
||||
})
|
||||
|
||||
it("should apply 1M tier pricing when awsBedrock1MContext is true for Claude Sonnet 4.6", () => {
|
||||
it("should have native 1M context window for Claude Sonnet 4.6 without needing beta flag", () => {
|
||||
const handler = new AwsBedrockHandler({
|
||||
apiModelId: "anthropic.claude-sonnet-4-6",
|
||||
awsAccessKey: "test",
|
||||
awsSecretKey: "test",
|
||||
awsRegion: "us-east-1",
|
||||
awsBedrock1MContext: true,
|
||||
})
|
||||
|
||||
const model = handler.getModel()
|
||||
// Claude Sonnet 4.6 has native 1M context window, no beta flag needed
|
||||
expect(model.info.contextWindow).toBe(1_000_000)
|
||||
expect(model.info.inputPrice).toBe(6.0)
|
||||
expect(model.info.outputPrice).toBe(22.5)
|
||||
// Base pricing (not tier pricing) since 1M is native
|
||||
expect(model.info.inputPrice).toBe(3.0)
|
||||
expect(model.info.outputPrice).toBe(15.0)
|
||||
})
|
||||
|
||||
it("should use default context window when awsBedrock1MContext is false for Claude Sonnet 4", () => {
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
|
|||
// Define a mapping for model ID patterns and their configurations
|
||||
const modelConfigMap: Record<string, Partial<ModelInfo>> = {
|
||||
"claude-4": {
|
||||
maxTokens: 8192,
|
||||
maxTokens: 64_000,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
|
|
@ -309,7 +309,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
|
|||
supportsPromptCache: true,
|
||||
},
|
||||
"claude-4-opus": {
|
||||
maxTokens: 4096,
|
||||
maxTokens: 64_000,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue