diff --git a/cli/testdata/coder_server_--help.golden b/cli/testdata/coder_server_--help.golden index ca671cbc68..0124c4f328 100644 --- a/cli/testdata/coder_server_--help.golden +++ b/cli/testdata/coder_server_--help.golden @@ -109,11 +109,18 @@ AI BRIDGE OPTIONS: The access key secret to use with the access key to authenticate against the AWS Bedrock API. + --aibridge-bedrock-base-url string, $CODER_AIBRIDGE_BEDROCK_BASE_URL + The base URL to use for the AWS Bedrock API. Use this setting to + specify an exact URL to use. Takes precedence over + CODER_AIBRIDGE_BEDROCK_REGION. + --aibridge-bedrock-model string, $CODER_AIBRIDGE_BEDROCK_MODEL (default: global.anthropic.claude-sonnet-4-5-20250929-v1:0) The model to use when making requests to the AWS Bedrock API. --aibridge-bedrock-region string, $CODER_AIBRIDGE_BEDROCK_REGION - The AWS Bedrock API region. + The AWS Bedrock API region to use. Constructs a base URL to use for + the AWS Bedrock API in the form of + 'https://bedrock-runtime..amazonaws.com'. --aibridge-bedrock-small-fastmodel string, $CODER_AIBRIDGE_BEDROCK_SMALL_FAST_MODEL (default: global.anthropic.claude-haiku-4-5-20251001-v1:0) The small fast model to use when making requests to the AWS Bedrock diff --git a/cli/testdata/server-config.yaml.golden b/cli/testdata/server-config.yaml.golden index 663dfcb7b1..25ff00741d 100644 --- a/cli/testdata/server-config.yaml.golden +++ b/cli/testdata/server-config.yaml.golden @@ -746,7 +746,12 @@ aibridge: # The base URL of the Anthropic API. # (default: https://api.anthropic.com/, type: string) anthropic_base_url: https://api.anthropic.com/ - # The AWS Bedrock API region. + # The base URL to use for the AWS Bedrock API. Use this setting to specify an + # exact URL to use. Takes precedence over CODER_AIBRIDGE_BEDROCK_REGION. + # (default: , type: string) + bedrock_base_url: "" + # The AWS Bedrock API region to use. Constructs a base URL to use for the AWS + # Bedrock API in the form of 'https://bedrock-runtime..amazonaws.com'. # (default: , type: string) bedrock_region: "" # The model to use when making requests to the AWS Bedrock API. diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 348042ee9e..1701d91d2f 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -12018,6 +12018,9 @@ const docTemplate = `{ "access_key_secret": { "type": "string" }, + "base_url": { + "type": "string" + }, "model": { "type": "string" }, diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 2f60ec2a91..75bcaab60e 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -10670,6 +10670,9 @@ "access_key_secret": { "type": "string" }, + "base_url": { + "type": "string" + }, "model": { "type": "string" }, diff --git a/codersdk/deployment.go b/codersdk/deployment.go index 662e6a281b..90915b13b3 100644 --- a/codersdk/deployment.go +++ b/codersdk/deployment.go @@ -3394,14 +3394,26 @@ Write out the current server config as YAML to stdout.`, Annotations: serpent.Annotations{}.Mark(annotationSecretKey, "true"), }, { - Name: "AI Bridge Bedrock Region", - Description: "The AWS Bedrock API region.", - Flag: "aibridge-bedrock-region", - Env: "CODER_AIBRIDGE_BEDROCK_REGION", - Value: &c.AI.BridgeConfig.Bedrock.Region, - Default: "", - Group: &deploymentGroupAIBridge, - YAML: "bedrock_region", + Name: "AI Bridge Bedrock Base URL", + Description: "The base URL to use for the AWS Bedrock API. Use this setting to specify an exact URL to use. Takes precedence " + + "over CODER_AIBRIDGE_BEDROCK_REGION.", + Flag: "aibridge-bedrock-base-url", + Env: "CODER_AIBRIDGE_BEDROCK_BASE_URL", + Value: &c.AI.BridgeConfig.Bedrock.BaseURL, + Default: "", + Group: &deploymentGroupAIBridge, + YAML: "bedrock_base_url", + }, + { + Name: "AI Bridge Bedrock Region", + Description: "The AWS Bedrock API region to use. Constructs a base URL to use for the AWS Bedrock API in the form of " + + "'https://bedrock-runtime..amazonaws.com'.", + Flag: "aibridge-bedrock-region", + Env: "CODER_AIBRIDGE_BEDROCK_REGION", + Value: &c.AI.BridgeConfig.Bedrock.Region, + Default: "", + Group: &deploymentGroupAIBridge, + YAML: "bedrock_region", }, { Name: "AI Bridge Bedrock Access Key", @@ -3727,6 +3739,7 @@ type AIBridgeAnthropicConfig struct { } type AIBridgeBedrockConfig struct { + BaseURL serpent.String `json:"base_url" typescript:",notnull"` Region serpent.String `json:"region" typescript:",notnull"` AccessKey serpent.String `json:"access_key" typescript:",notnull"` AccessKeySecret serpent.String `json:"access_key_secret" typescript:",notnull"` diff --git a/docs/ai-coder/ai-bridge/setup.md b/docs/ai-coder/ai-bridge/setup.md index 347137e944..b2e5f28404 100644 --- a/docs/ai-coder/ai-bridge/setup.md +++ b/docs/ai-coder/ai-bridge/setup.md @@ -58,6 +58,11 @@ Set the following when routing [Amazon Bedrock](https://coder.com/docs/reference - `CODER_AIBRIDGE_BEDROCK_MODEL` or `--aibridge-bedrock-model` - `CODER_AIBRIDGE_BEDROCK_SMALL_FAST_MODEL` or `--aibridge-bedrock-small-fast-model` +> [!NOTE] +> `CODER_AIBRIDGE_BEDROCK_BASE_URL` or `--aibridge-bedrock-base-url` may be used instead of `CODER_AIBRIDGE_BEDROCK_REGION`/`--aibridge-bedrock-region` +if you would like to specify a URL which does not follow the form of `https://bedrock-runtime..amazonaws.com` - for example if using a +proxy between AI Bridge and AWS Bedrock. + #### Obtaining Bedrock credentials 1. **Choose a region** where you want to use Bedrock. diff --git a/docs/reference/api/general.md b/docs/reference/api/general.md index 2d19c496c0..5300a38444 100644 --- a/docs/reference/api/general.md +++ b/docs/reference/api/general.md @@ -181,6 +181,7 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \ "bedrock": { "access_key": "string", "access_key_secret": "string", + "base_url": "string", "model": "string", "region": "string", "small_fast_model": "string" diff --git a/docs/reference/api/schemas.md b/docs/reference/api/schemas.md index fa8d818006..32f0282115 100644 --- a/docs/reference/api/schemas.md +++ b/docs/reference/api/schemas.md @@ -357,6 +357,7 @@ { "access_key": "string", "access_key_secret": "string", + "base_url": "string", "model": "string", "region": "string", "small_fast_model": "string" @@ -369,6 +370,7 @@ |---------------------|--------|----------|--------------|-------------| | `access_key` | string | false | | | | `access_key_secret` | string | false | | | +| `base_url` | string | false | | | | `model` | string | false | | | | `region` | string | false | | | | `small_fast_model` | string | false | | | @@ -384,6 +386,7 @@ "bedrock": { "access_key": "string", "access_key_secret": "string", + "base_url": "string", "model": "string", "region": "string", "small_fast_model": "string" @@ -749,6 +752,7 @@ "bedrock": { "access_key": "string", "access_key_secret": "string", + "base_url": "string", "model": "string", "region": "string", "small_fast_model": "string" @@ -2672,6 +2676,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o "bedrock": { "access_key": "string", "access_key_secret": "string", + "base_url": "string", "model": "string", "region": "string", "small_fast_model": "string" @@ -3224,6 +3229,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o "bedrock": { "access_key": "string", "access_key_secret": "string", + "base_url": "string", "model": "string", "region": "string", "small_fast_model": "string" diff --git a/docs/reference/cli/server.md b/docs/reference/cli/server.md index 981c363fca..b5d5bcb381 100644 --- a/docs/reference/cli/server.md +++ b/docs/reference/cli/server.md @@ -1742,6 +1742,16 @@ The base URL of the Anthropic API. The key to authenticate against the Anthropic API. +### --aibridge-bedrock-base-url + +| | | +|-------------|-----------------------------------------------| +| Type | string | +| Environment | $CODER_AIBRIDGE_BEDROCK_BASE_URL | +| YAML | aibridge.bedrock_base_url | + +The base URL to use for the AWS Bedrock API. Use this setting to specify an exact URL to use. Takes precedence over CODER_AIBRIDGE_BEDROCK_REGION. + ### --aibridge-bedrock-region | | | @@ -1750,7 +1760,7 @@ The key to authenticate against the Anthropic API. | Environment | $CODER_AIBRIDGE_BEDROCK_REGION | | YAML | aibridge.bedrock_region | -The AWS Bedrock API region. +The AWS Bedrock API region to use. Constructs a base URL to use for the AWS Bedrock API in the form of 'https://bedrock-runtime..amazonaws.com'. ### --aibridge-bedrock-access-key diff --git a/enterprise/cli/aibridged.go b/enterprise/cli/aibridged.go index 9fdcd52c33..e9bfce7cd0 100644 --- a/enterprise/cli/aibridged.go +++ b/enterprise/cli/aibridged.go @@ -68,11 +68,12 @@ func newAIBridgeDaemon(coderAPI *coderd.API) (*aibridged.Server, error) { } func getBedrockConfig(cfg codersdk.AIBridgeBedrockConfig) *aibridge.AWSBedrockConfig { - if cfg.Region.String() == "" && cfg.AccessKey.String() == "" && cfg.AccessKeySecret.String() == "" { + if cfg.Region.String() == "" && cfg.BaseURL.String() == "" && cfg.AccessKey.String() == "" && cfg.AccessKeySecret.String() == "" { return nil } return &aibridge.AWSBedrockConfig{ + BaseURL: cfg.BaseURL.String(), Region: cfg.Region.String(), AccessKey: cfg.AccessKey.String(), AccessKeySecret: cfg.AccessKeySecret.String(), diff --git a/enterprise/cli/testdata/coder_server_--help.golden b/enterprise/cli/testdata/coder_server_--help.golden index 92100f09e4..8dc28ffc7b 100644 --- a/enterprise/cli/testdata/coder_server_--help.golden +++ b/enterprise/cli/testdata/coder_server_--help.golden @@ -110,11 +110,18 @@ AI BRIDGE OPTIONS: The access key secret to use with the access key to authenticate against the AWS Bedrock API. + --aibridge-bedrock-base-url string, $CODER_AIBRIDGE_BEDROCK_BASE_URL + The base URL to use for the AWS Bedrock API. Use this setting to + specify an exact URL to use. Takes precedence over + CODER_AIBRIDGE_BEDROCK_REGION. + --aibridge-bedrock-model string, $CODER_AIBRIDGE_BEDROCK_MODEL (default: global.anthropic.claude-sonnet-4-5-20250929-v1:0) The model to use when making requests to the AWS Bedrock API. --aibridge-bedrock-region string, $CODER_AIBRIDGE_BEDROCK_REGION - The AWS Bedrock API region. + The AWS Bedrock API region to use. Constructs a base URL to use for + the AWS Bedrock API in the form of + 'https://bedrock-runtime..amazonaws.com'. --aibridge-bedrock-small-fastmodel string, $CODER_AIBRIDGE_BEDROCK_SMALL_FAST_MODEL (default: global.anthropic.claude-haiku-4-5-20251001-v1:0) The small fast model to use when making requests to the AWS Bedrock diff --git a/go.mod b/go.mod index d572fa7b88..beb91d7af0 100644 --- a/go.mod +++ b/go.mod @@ -473,7 +473,7 @@ require ( github.com/anthropics/anthropic-sdk-go v1.19.0 github.com/brianvoe/gofakeit/v7 v7.14.0 github.com/coder/agentapi-sdk-go v0.0.0-20250505131810-560d1d88d225 - github.com/coder/aibridge v0.3.1-0.20260120123323-c997d7bed20e + github.com/coder/aibridge v0.3.1-0.20260121122740-e164b504fc52 github.com/coder/aisdk-go v0.0.9 github.com/coder/boundary v0.0.1-alpha github.com/coder/preview v1.0.4 diff --git a/go.sum b/go.sum index 3a1499c760..88d32b6873 100644 --- a/go.sum +++ b/go.sum @@ -927,8 +927,8 @@ github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f h1:Y8xYupdHxryycyPlc9Y github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f/go.mod h1:HlzOvOjVBOfTGSRXRyY0OiCS/3J1akRGQQpRO/7zyF4= github.com/coder/agentapi-sdk-go v0.0.0-20250505131810-560d1d88d225 h1:tRIViZ5JRmzdOEo5wUWngaGEFBG8OaE1o2GIHN5ujJ8= github.com/coder/agentapi-sdk-go v0.0.0-20250505131810-560d1d88d225/go.mod h1:rNLVpYgEVeu1Zk29K64z6Od8RBP9DwqCu9OfCzh8MR4= -github.com/coder/aibridge v0.3.1-0.20260120123323-c997d7bed20e h1:FcXw+6MXWFTrRYKaYuao6IRLdt/aqfonFfSDh0wFTa8= -github.com/coder/aibridge v0.3.1-0.20260120123323-c997d7bed20e/go.mod h1:x45BE/NNDesDN1eWy4bsg81QsL6ou7xXPIeQr0ePETQ= +github.com/coder/aibridge v0.3.1-0.20260121122740-e164b504fc52 h1:UcsOXQH881tXPpU75Cz4GpTmV7JTZ7GS8AdA0QdAAC4= +github.com/coder/aibridge v0.3.1-0.20260121122740-e164b504fc52/go.mod h1:x45BE/NNDesDN1eWy4bsg81QsL6ou7xXPIeQr0ePETQ= github.com/coder/aisdk-go v0.0.9 h1:Vzo/k2qwVGLTR10ESDeP2Ecek1SdPfZlEjtTfMveiVo= github.com/coder/aisdk-go v0.0.9/go.mod h1:KF6/Vkono0FJJOtWtveh5j7yfNrSctVTpwgweYWSp5M= github.com/coder/boundary v0.0.1-alpha h1:6shUQ2zkrWrfbgVcqWvpV2ibljOQvPvYqTctWBkKoUA= diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index b025901109..29bae4f057 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -18,6 +18,7 @@ export interface AIBridgeAnthropicConfig { // From codersdk/deployment.go export interface AIBridgeBedrockConfig { + readonly base_url: string; readonly region: string; readonly access_key: string; readonly access_key_secret: string;