Skip to content
1 change: 1 addition & 0 deletions packages/types/src/provider-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ const bedrockSchema = apiModelIdProviderModelSchema.extend({
awsSessionToken: z.string().optional(),
awsRegion: z.string().optional(),
awsUseCrossRegionInference: z.boolean().optional(),
awsUseGlobalInference: z.boolean().optional(), // Enable Global Inference profile routing when supported
awsUsePromptCache: z.boolean().optional(),
awsProfile: z.string().optional(),
awsUseProfile: z.boolean().optional(),
Expand Down
11 changes: 11 additions & 0 deletions packages/types/src/providers/bedrock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,14 @@ export const BEDROCK_1M_CONTEXT_MODEL_IDS = [
"anthropic.claude-sonnet-4-20250514-v1:0",
"anthropic.claude-sonnet-4-5-20250929-v1:0",
] as const

// Amazon Bedrock models that support Global Inference profiles
// As of Oct 2025, AWS supports Global Inference for:
// - Claude Sonnet 4
// - Claude Sonnet 4.5
// - Claude Haiku 4.5
export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
"anthropic.claude-sonnet-4-20250514-v1:0",
"anthropic.claude-sonnet-4-5-20250929-v1:0",
"anthropic.claude-haiku-4-5-20251001-v1:0",
] as const
18 changes: 16 additions & 2 deletions src/api/providers/bedrock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
BEDROCK_DEFAULT_CONTEXT,
AWS_INFERENCE_PROFILE_MAPPING,
BEDROCK_1M_CONTEXT_MODEL_IDS,
BEDROCK_GLOBAL_INFERENCE_MODEL_IDS,
} from "@roo-code/types"

import { ApiStream } from "../transform/stream"
Expand Down Expand Up @@ -887,6 +888,11 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
}
}

// Also strip Global Inference profile prefix if present
if (modelId.startsWith("global.")) {
return modelId.substring("global.".length)
}

// Return the model ID as-is for all other cases
return modelId
}
Expand Down Expand Up @@ -964,8 +970,16 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
//a model was selected from the drop down
modelConfig = this.getModelById(this.options.apiModelId as string)

// Add cross-region inference prefix if enabled
if (this.options.awsUseCrossRegionInference && this.options.awsRegion) {
// Apply Global Inference prefix if enabled and supported (takes precedence over cross-region)
const baseIdForGlobal = this.parseBaseModelId(modelConfig.id)
if (
this.options.awsUseGlobalInference &&
BEDROCK_GLOBAL_INFERENCE_MODEL_IDS.includes(baseIdForGlobal as any)
) {
modelConfig.id = `global.${baseIdForGlobal}`
}
// Otherwise, add cross-region inference prefix if enabled
else if (this.options.awsUseCrossRegionInference && this.options.awsRegion) {
const prefix = AwsBedrockHandler.getPrefixForRegion(this.options.awsRegion)
if (prefix) {
modelConfig.id = `${prefix}${modelConfig.id}`
Expand Down
24 changes: 23 additions & 1 deletion webview-ui/src/components/settings/providers/Bedrock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { useCallback, useState, useEffect } from "react"
import { Checkbox } from "vscrui"
import { VSCodeTextField } from "@vscode/webview-ui-toolkit/react"

import { type ProviderSettings, type ModelInfo, BEDROCK_REGIONS, BEDROCK_1M_CONTEXT_MODEL_IDS } from "@roo-code/types"
import {
type ProviderSettings,
type ModelInfo,
BEDROCK_REGIONS,
BEDROCK_1M_CONTEXT_MODEL_IDS,
BEDROCK_GLOBAL_INFERENCE_MODEL_IDS,
} from "@roo-code/types"

import { useAppTranslation } from "@src/i18n/TranslationContext"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, StandardTooltip } from "@src/components/ui"
Expand All @@ -23,6 +29,11 @@ export const Bedrock = ({ apiConfiguration, setApiConfigurationField, selectedMo
const supports1MContextBeta =
!!apiConfiguration?.apiModelId && BEDROCK_1M_CONTEXT_MODEL_IDS.includes(apiConfiguration.apiModelId as any)

// Check if the selected model supports Global Inference profile routing
const supportsGlobalInference =
!!apiConfiguration?.apiModelId &&
BEDROCK_GLOBAL_INFERENCE_MODEL_IDS.includes(apiConfiguration.apiModelId as any)

// Update the endpoint enabled state when the configuration changes
useEffect(() => {
setAwsEndpointSelected(!!apiConfiguration?.awsBedrockEndpointEnabled)
Expand Down Expand Up @@ -138,6 +149,17 @@ export const Bedrock = ({ apiConfiguration, setApiConfigurationField, selectedMo
</SelectContent>
</Select>
</div>
{supportsGlobalInference && (
<Checkbox
checked={apiConfiguration?.awsUseGlobalInference || false}
onChange={(checked: boolean) => {
// Enabling Global Inference should disable cross-region inference
setApiConfigurationField("awsUseGlobalInference", checked)
if (checked) setApiConfigurationField("awsUseCrossRegionInference", false)
}}>
{t("settings:providers.awsGlobalInference")}
</Checkbox>
)}
<Checkbox
checked={apiConfiguration?.awsUseCrossRegionInference || false}
onChange={handleInputChange("awsUseCrossRegionInference", noTransform)}>
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@
"awsSessionToken": "AWS Session Token",
"awsRegion": "AWS Region",
"awsCrossRegion": "Use cross-region inference",
"awsGlobalInference": "Use Global inference (auto-select optimal AWS Region)",
"awsBedrockVpc": {
"useCustomVpcEndpoint": "Use custom VPC endpoint",
"vpcEndpointUrlPlaceholder": "Enter VPC Endpoint URL (optional)",
Expand Down
Loading