Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a17b15f
feat(aws-bedrock): region routing with global default
steebchen May 20, 2026
30ee955
feat(aws-bedrock): add specific AWS regions for data residency
steebchen May 20, 2026
3309422
fix(playground): use model.id not upstream modelName in region URL
steebchen May 20, 2026
2d53bb7
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 20, 2026
c9a3c40
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 21, 2026
53069a5
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 24, 2026
86d0382
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 24, 2026
63f7431
feat(gateway): pin AWS Bedrock to global when no region requested
steebchen May 26, 2026
aa26802
fix(billing): use lastIndexOf when stripping :region suffix
steebchen May 26, 2026
3f11668
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 26, 2026
e5288a9
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 27, 2026
78e5082
fix(playground): drop modelName-based selector fallbacks
steebchen May 27, 2026
31af618
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 27, 2026
e3671d1
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 28, 2026
2fbb1a0
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 28, 2026
5a36462
Merge remote-tracking branch 'origin/main' into aws-bedrock-region-ro…
steebchen May 31, 2026
7f3d9ce
fix(aws-bedrock): address PR review on region routing
steebchen May 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/api/src/routes/keys-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const providerKeySchema = z.object({
options: z
.object({
aws_bedrock_region_prefix: z.enum(["us.", "global.", "eu."]).optional(),
aws_bedrock_region: z.enum(["global", "us", "eu", "apac"]).optional(),
azure_resource: z.string().optional(),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
azure_api_version: z.string().optional(),
azure_deployment_type: z.enum(["openai", "ai-foundry"]).optional(),
Expand Down Expand Up @@ -69,6 +70,7 @@ const createProviderKeySchema = z.object({
options: z
.object({
aws_bedrock_region_prefix: z.enum(["us.", "global.", "eu."]).optional(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow APAC in Bedrock prefix override schema

After adding APAC regional routing (modelPrefixMap.apac = "apac."), the API schema still rejects aws_bedrock_region_prefix: "apac." because the enum only allows "us." | "global." | "eu.". That blocks clients from using the explicit prefix-override path for APAC and makes the override behavior inconsistent with the newly supported region set. Include "apac." in the Bedrock prefix enum (and matching types) to avoid 400s for valid APAC overrides.

Useful? React with 👍 / 👎.

aws_bedrock_region: z.enum(["global", "us", "eu", "apac"]).optional(),
azure_resource: z.string().optional(),
azure_api_version: z.string().optional(),
azure_deployment_type: z.enum(["openai", "ai-foundry"]).optional(),
Expand Down
8 changes: 8 additions & 0 deletions apps/code/src/lib/api/v1.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6300,6 +6300,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6341,6 +6343,8 @@ export interface paths {
options?: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6376,6 +6380,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6539,6 +6545,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down
8 changes: 8 additions & 0 deletions apps/playground/src/lib/api/v1.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6300,6 +6300,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6341,6 +6343,8 @@ export interface paths {
options?: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6376,6 +6380,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6539,6 +6545,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ export function CreateProviderKeyDialog({
const [baseUrl, setBaseUrl] = useState("");
const [customName, setCustomName] = useState("");
const [token, setToken] = useState("");
const [awsBedrockRegionPrefix, setAwsBedrockRegionPrefix] = useState<
"us." | "global." | "eu."
>("global.");
const [azureResource, setAzureResource] = useState("");
const [azureApiVersion, setAzureApiVersion] = useState("2024-10-21");
const [azureDeploymentType, setAzureDeploymentType] = useState<
Expand Down Expand Up @@ -148,11 +145,6 @@ export function CreateProviderKeyDialog({
if (selectedProvider === "custom" && customName) {
payload.name = customName;
}
if (selectedProvider === "aws-bedrock") {
payload.options = {
aws_bedrock_region_prefix: awsBedrockRegionPrefix,
};
}
// Include region in options for providers that support it
if (selectedProviderDef?.regionConfig && effectiveRegion) {
payload.options = {
Expand Down Expand Up @@ -224,7 +216,6 @@ export function CreateProviderKeyDialog({
setBaseUrl("");
setCustomName("");
setToken("");
setAwsBedrockRegionPrefix("global.");
setAzureResource("");
setAzureApiVersion("2024-10-21");
setAzureDeploymentType("ai-foundry");
Expand Down Expand Up @@ -323,32 +314,6 @@ export function CreateProviderKeyDialog({
</div>
)}

{selectedProvider === "aws-bedrock" && (
<div className="space-y-2">
<Label htmlFor="region-prefix">Region Prefix</Label>
<Select
value={awsBedrockRegionPrefix}
onValueChange={(value) =>
setAwsBedrockRegionPrefix(value as "us." | "global." | "eu.")
}
>
<SelectTrigger id="region-prefix">
<SelectValue placeholder="Select region prefix" />
</SelectTrigger>
<SelectContent>
<SelectItem value="us.">us. (US regions)</SelectItem>
<SelectItem value="global.">
global. (Global regions)
</SelectItem>
<SelectItem value="eu.">eu. (EU regions)</SelectItem>
</SelectContent>
</Select>
<p className="text-sm text-muted-foreground">
Region prefix for AWS Bedrock model endpoints
</p>
</div>
)}

{selectedProvider === "azure" && (
<>
<div className="space-y-2">
Expand Down
3 changes: 2 additions & 1 deletion apps/ui/src/components/provider-keys/provider-keys-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ interface ProviderKeysListProps {

function formatOptionLabel(key: string, value: string): string {
const labels: Record<string, string> = {
aws_bedrock_region_prefix: "Region",
aws_bedrock_region_prefix: "Cross-Region Prefix",
aws_bedrock_region: "Region",
azure_resource: "Resource",
azure_api_version: "API Version",
azure_deployment_type: "Deployment",
Expand Down
8 changes: 8 additions & 0 deletions apps/ui/src/lib/api/v1.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6300,6 +6300,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6341,6 +6343,8 @@ export interface paths {
options?: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6376,6 +6380,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6539,6 +6545,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down
8 changes: 8 additions & 0 deletions ee/admin/src/lib/api/v1.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6300,6 +6300,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6341,6 +6343,8 @@ export interface paths {
options?: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6376,6 +6380,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down Expand Up @@ -6539,6 +6545,8 @@ export interface paths {
options: {
/** @enum {string} */
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
/** @enum {string} */
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
azure_resource?: string;
azure_api_version?: string;
/** @enum {string} */
Expand Down
108 changes: 108 additions & 0 deletions packages/actions/src/get-provider-endpoint.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,112 @@ describe("getProviderEndpoint", () => {
);
});
});

describe("aws-bedrock regions", () => {
it("defaults to us-east-1 endpoint with global. prefix when no region is set", () => {
const endpoint = getProviderEndpoint(
"aws-bedrock",
undefined,
"anthropic.claude-haiku-4-5-20251001-v1:0",
undefined,
false,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
true, // skipEnvVars
);

expect(endpoint).toBe(
"https://bedrock-runtime.us-east-1.amazonaws.com/model/global.anthropic.claude-haiku-4-5-20251001-v1:0/converse",
);
});

it("routes to eu-central-1 with eu. prefix when region is 'eu'", () => {
const endpoint = getProviderEndpoint(
"aws-bedrock",
undefined,
"anthropic.claude-haiku-4-5-20251001-v1:0",
undefined,
false,
undefined,
undefined,
undefined,
undefined,
undefined,
"eu",
true,
);

expect(endpoint).toBe(
"https://bedrock-runtime.eu-central-1.amazonaws.com/model/eu.anthropic.claude-haiku-4-5-20251001-v1:0/converse",
);
});

it("routes to ap-northeast-1 with apac. prefix when region is 'apac'", () => {
const endpoint = getProviderEndpoint(
"aws-bedrock",
undefined,
"anthropic.claude-haiku-4-5-20251001-v1:0",
undefined,
true,
undefined,
undefined,
undefined,
undefined,
undefined,
"apac",
true,
);

expect(endpoint).toBe(
"https://bedrock-runtime.ap-northeast-1.amazonaws.com/model/apac.anthropic.claude-haiku-4-5-20251001-v1:0/converse-stream",
);
});

it("uses us-east-1 endpoint with us. prefix when region is 'us'", () => {
const endpoint = getProviderEndpoint(
"aws-bedrock",
undefined,
"anthropic.claude-haiku-4-5-20251001-v1:0",
undefined,
false,
undefined,
undefined,
undefined,
undefined,
undefined,
"us",
true,
);

expect(endpoint).toBe(
"https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1:0/converse",
);
});

it("lets aws_bedrock_region_prefix provider-key option override the region-derived prefix", () => {
const endpoint = getProviderEndpoint(
"aws-bedrock",
undefined,
"anthropic.claude-haiku-4-5-20251001-v1:0",
undefined,
false,
undefined,
undefined,
{ aws_bedrock_region_prefix: "global." },
undefined,
undefined,
"eu",
true,
);

// Endpoint URL still follows the region, but the prefix is overridden
expect(endpoint).toBe(
"https://bedrock-runtime.eu-central-1.amazonaws.com/model/global.anthropic.claude-haiku-4-5-20251001-v1:0/converse",
);
});
});
});
12 changes: 11 additions & 1 deletion packages/actions/src/get-provider-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,13 @@ export function getProviderEndpoint(
break;
case "aws-bedrock":
url =
regionBaseUrl ??
envValueOrDefault(
"aws-bedrock",
"baseUrl",
"https://bedrock-runtime.us-east-1.amazonaws.com",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve explicit Bedrock base URL when region is set

The new regionBaseUrl ?? envValueOrDefault(...) order causes any regional Bedrock request to ignore an explicitly configured Bedrock base URL (for example LLM_AWS_BEDROCK_BASE_URL in credits/hybrid mode). Before this change, that explicit URL always won; now a :eu/:apac request is forced to the hardcoded AWS endpoint, which can bypass required proxies/private endpoints and break otherwise working deployments. Keep explicit base URL config precedence above derived regional endpoints.

Useful? React with 👍 / 👎.

) ?? "https://bedrock-runtime.us-east-1.amazonaws.com";
) ??
"https://bedrock-runtime.us-east-1.amazonaws.com";
break;
case "azure": {
const resource =
Expand Down Expand Up @@ -421,8 +423,16 @@ export function getProviderEndpoint(
}
return `${url}/api/paas/v4/chat/completions`;
case "aws-bedrock": {
const awsRegionPrefix = region
? (
providers.find((p) => p.id === "aws-bedrock") as
| ProviderDefinition
| undefined
)?.regionConfig?.modelPrefixMap?.[region]
: undefined;
const prefix =
providerKeyOptions?.aws_bedrock_region_prefix ??
awsRegionPrefix ??
getProviderEnvValue("aws-bedrock", "region", configIndex, "global.") ??
"global.";

Expand Down
1 change: 1 addition & 0 deletions packages/db/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ export const masterKey = pgTable(

export interface ProviderKeyOptions {
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
aws_bedrock_region?: "global" | "us" | "eu" | "apac";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add apac. to aws_bedrock_region_prefix union for consistency.

With aws_bedrock_region now supporting "apac", the explicit override type should also allow "apac."; otherwise APAC cannot be explicitly selected via prefix override even though routing supports it.

Suggested patch
 export interface ProviderKeyOptions {
-	aws_bedrock_region_prefix?: "us." | "global." | "eu.";
+	aws_bedrock_region_prefix?: "us." | "global." | "eu." | "apac.";
 	aws_bedrock_region?: "global" | "us" | "eu" | "apac";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
aws_bedrock_region_prefix?: "us." | "global." | "eu.";
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
aws_bedrock_region_prefix?: "us." | "global." | "eu." | "apac.";
aws_bedrock_region?: "global" | "us" | "eu" | "apac";
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/db/src/schema.ts` around lines 577 - 578, The
aws_bedrock_region_prefix union (aws_bedrock_region_prefix) is missing the
"apac." variant while aws_bedrock_region supports "apac"; update the
aws_bedrock_region_prefix type to include "apac." so the explicit prefix
override can select APAC (i.e., add "apac." to the union alongside "us.",
"global.", and "eu."). Ensure the change is applied where
aws_bedrock_region_prefix is declared to keep the two types consistent.

azure_resource?: string;
azure_api_version?: string;
azure_deployment_type?: "openai" | "ai-foundry";
Expand Down
1 change: 1 addition & 0 deletions packages/models/src/models/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ export const anthropicModels = [
tools: true,
jsonOutput: true,
jsonOutputSchema: true,
regions: [{ id: "global" }, { id: "us" }, { id: "eu" }, { id: "apac" }],
},
{
providerId: "vertex-anthropic",
Expand Down
Loading
Loading