-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add AWS Bedrock service tier support #9875
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
base: main
Are you sure you want to change the base?
Conversation
- Add awsBedrockServiceTier field to provider settings schema - Add tier-specific pricing for Claude models (FLEX ~20% discount, PRIORITY ~20% premium) - Update Bedrock provider to include service_tier in API requests - Add service tier selector UI in Bedrock settings - Apply tier-specific pricing in cost calculations Implements #9874
Review completed. Found 1 inline comment and 1 additional issue to address: Issues to Resolve
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| // Add service tier if specified and model supports it | ||
| if (this.options.awsBedrockServiceTier && modelConfig.info.tiers && modelConfig.info.tiers.length > 0) { | ||
| if (!additionalModelRequestFields) { | ||
| additionalModelRequestFields = {} as BedrockAdditionalModelFields | ||
| } | ||
| // Convert from lowercase to uppercase for API | ||
| const tierMap: Record<string, "STANDARD" | "FLEX" | "PRIORITY"> = { | ||
| default: "STANDARD", | ||
| flex: "FLEX", | ||
| priority: "PRIORITY", | ||
| } | ||
| const mappedTier = tierMap[this.options.awsBedrockServiceTier as string] | ||
| if (mappedTier) { | ||
| additionalModelRequestFields.service_tier = mappedTier | ||
| logger.info("Service tier specified for Bedrock request", { | ||
| ctx: "bedrock", | ||
| modelId: modelConfig.id, | ||
| serviceTier: mappedTier, | ||
| }) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "default" tier should not send service_tier parameter to AWS. When the user selects "default", the service_tier field should be omitted from the API request entirely, allowing AWS Bedrock to use its implicit default behavior. Currently, the code maps "default" to "STANDARD" and includes it in the request, which is inconsistent with AWS best practices and the pricing logic (which correctly skips tier adjustments when tier is "default"). The condition at line 438 should check tier !== "default" before setting the parameter, or the tierMap should not include a "default" entry.
Fix it with Roo Code or mention @roomote and request a fix.
This PR attempts to address Issue #9874 by adding support for AWS Bedrock service tiers (STANDARD, FLEX, PRIORITY).
Summary
Implements service tier selection for AWS Bedrock models, allowing users to optimize for cost (FLEX tier with ~20% discount) or performance (PRIORITY tier with ~20% premium pricing and better latency).
Changes
awsBedrockServiceTierfield to provider settings schemaservice_tierparameter in API requestsTesting
Screenshots
The service tier selector appears in the Bedrock settings when a model that supports tiers is selected.
Feedback and guidance are welcome!
Closes #9874