Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd18441d

Browse files
authored
feat: add AWS Bedrock support (#20507)
Depends oncoder/aibridge#44Closescoder/aibridge#28---------Signed-off-by: Danny Kopping <danny@coder.com>
1 parent4f7b279 commitd18441d

File tree

12 files changed

+228
-14
lines changed

12 files changed

+228
-14
lines changed

‎cli/testdata/server-config.yaml.golden‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,25 @@ aibridge:
726726
openai_key: ""
727727
# The base URL of the Anthropic API.
728728
# (default: https://api.anthropic.com/, type: string)
729-
base_url: https://api.anthropic.com/
729+
anthropic_base_url: https://api.anthropic.com/
730730
# The key to authenticate against the Anthropic API.
731731
# (default: <unset>, type: string)
732-
key: ""
732+
anthropic_key: ""
733+
# The AWS Bedrock API region.
734+
# (default: <unset>, type: string)
735+
bedrock_region: ""
736+
# The access key to authenticate against the AWS Bedrock API.
737+
# (default: <unset>, type: string)
738+
bedrock_access_key: ""
739+
# The access key secret to use with the access key to authenticate against the AWS
740+
# Bedrock API.
741+
# (default: <unset>, type: string)
742+
bedrock_access_key_secret: ""
743+
# The model to use when making requests to the AWS Bedrock API.
744+
# (default: global.anthropic.claude-sonnet-4-5-20250929-v1:0, type: string)
745+
bedrock_model: global.anthropic.claude-sonnet-4-5-20250929-v1:0
746+
# The small fast model to use when making requests to the AWS Bedrock API. Claude
747+
# Code uses Haiku-class models to perform background tasks. See
748+
# https://docs.claude.com/en/docs/claude-code/settings#environment-variables.
749+
# (default: global.anthropic.claude-haiku-4-5-20251001-v1:0, type: string)
750+
bedrock_small_fast_model: global.anthropic.claude-haiku-4-5-20251001-v1:0

‎coderd/apidoc/docs.go‎

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎codersdk/deployment.go‎

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3280,18 +3280,73 @@ Write out the current server config as YAML to stdout.`,
32803280
Value:&c.AI.BridgeConfig.Anthropic.BaseURL,
32813281
Default:"https://api.anthropic.com/",
32823282
Group:&deploymentGroupAIBridge,
3283-
YAML:"base_url",
3283+
YAML:"anthropic_base_url",
32843284
Hidden:true,
32853285
},
32863286
{
3287-
Name:"AIBridge AnthropicKEY",
3287+
Name:"AIBridge AnthropicKey",
32883288
Description:"The key to authenticate against the Anthropic API.",
32893289
Flag:"aibridge-anthropic-key",
32903290
Env:"CODER_AIBRIDGE_ANTHROPIC_KEY",
32913291
Value:&c.AI.BridgeConfig.Anthropic.Key,
32923292
Default:"",
32933293
Group:&deploymentGroupAIBridge,
3294-
YAML:"key",
3294+
YAML:"anthropic_key",
3295+
Hidden:true,
3296+
},
3297+
{
3298+
Name:"AIBridge Bedrock Region",
3299+
Description:"The AWS Bedrock API region.",
3300+
Flag:"aibridge-bedrock-region",
3301+
Env:"CODER_AIBRIDGE_BEDROCK_REGION",
3302+
Value:&c.AI.BridgeConfig.Bedrock.Region,
3303+
Default:"",
3304+
Group:&deploymentGroupAIBridge,
3305+
YAML:"bedrock_region",
3306+
Hidden:true,
3307+
},
3308+
{
3309+
Name:"AIBridge Bedrock Access Key",
3310+
Description:"The access key to authenticate against the AWS Bedrock API.",
3311+
Flag:"aibridge-bedrock-access-key",
3312+
Env:"CODER_AIBRIDGE_BEDROCK_ACCESS_KEY",
3313+
Value:&c.AI.BridgeConfig.Bedrock.AccessKey,
3314+
Default:"",
3315+
Group:&deploymentGroupAIBridge,
3316+
YAML:"bedrock_access_key",
3317+
Hidden:true,
3318+
},
3319+
{
3320+
Name:"AIBridge Bedrock Access Key Secret",
3321+
Description:"The access key secret to use with the access key to authenticate against the AWS Bedrock API.",
3322+
Flag:"aibridge-bedrock-access-key-secret",
3323+
Env:"CODER_AIBRIDGE_BEDROCK_ACCESS_KEY_SECRET",
3324+
Value:&c.AI.BridgeConfig.Bedrock.AccessKeySecret,
3325+
Default:"",
3326+
Group:&deploymentGroupAIBridge,
3327+
YAML:"bedrock_access_key_secret",
3328+
Hidden:true,
3329+
},
3330+
{
3331+
Name:"AIBridge Bedrock Model",
3332+
Description:"The model to use when making requests to the AWS Bedrock API.",
3333+
Flag:"aibridge-bedrock-model",
3334+
Env:"CODER_AIBRIDGE_BEDROCK_MODEL",
3335+
Value:&c.AI.BridgeConfig.Bedrock.Model,
3336+
Default:"global.anthropic.claude-sonnet-4-5-20250929-v1:0",// See https://docs.claude.com/en/api/claude-on-amazon-bedrock#accessing-bedrock.
3337+
Group:&deploymentGroupAIBridge,
3338+
YAML:"bedrock_model",
3339+
Hidden:true,
3340+
},
3341+
{
3342+
Name:"AIBridge Bedrock Small Fast Model",
3343+
Description:"The small fast model to use when making requests to the AWS Bedrock API. Claude Code uses Haiku-class models to perform background tasks. See https://docs.claude.com/en/docs/claude-code/settings#environment-variables.",
3344+
Flag:"aibridge-bedrock-small-fastmodel",
3345+
Env:"CODER_AIBRIDGE_BEDROCK_SMALL_FAST_MODEL",
3346+
Value:&c.AI.BridgeConfig.Bedrock.SmallFastModel,
3347+
Default:"global.anthropic.claude-haiku-4-5-20251001-v1:0",// See https://docs.claude.com/en/api/claude-on-amazon-bedrock#accessing-bedrock.
3348+
Group:&deploymentGroupAIBridge,
3349+
YAML:"bedrock_small_fast_model",
32953350
Hidden:true,
32963351
},
32973352
{
@@ -3316,6 +3371,7 @@ type AIBridgeConfig struct {
33163371
Enabled serpent.Bool`json:"enabled" typescript:",notnull"`
33173372
OpenAIAIBridgeOpenAIConfig`json:"openai" typescript:",notnull"`
33183373
AnthropicAIBridgeAnthropicConfig`json:"anthropic" typescript:",notnull"`
3374+
BedrockAIBridgeBedrockConfig`json:"bedrock" typescript:",notnull"`
33193375
}
33203376

33213377
typeAIBridgeOpenAIConfigstruct {
@@ -3328,6 +3384,14 @@ type AIBridgeAnthropicConfig struct {
33283384
Key serpent.String`json:"key" typescript:",notnull"`
33293385
}
33303386

3387+
typeAIBridgeBedrockConfigstruct {
3388+
Region serpent.String`json:"region" typescript:",notnull"`
3389+
AccessKey serpent.String`json:"access_key" typescript:",notnull"`
3390+
AccessKeySecret serpent.String`json:"access_key_secret" typescript:",notnull"`
3391+
Model serpent.String`json:"model" typescript:",notnull"`
3392+
SmallFastModel serpent.String`json:"small_fast_model" typescript:",notnull"`
3393+
}
3394+
33313395
typeAIConfigstruct {
33323396
BridgeConfigAIBridgeConfig`json:"bridge,omitempty"`
33333397
}

‎docs/reference/api/general.md‎

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎docs/reference/api/schemas.md‎

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎enterprise/cli/aibridged.go‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"golang.org/x/xerrors"
99

1010
"github.com/coder/aibridge"
11+
"github.com/coder/coder/v2/codersdk"
1112
"github.com/coder/coder/v2/enterprise/coderd"
1213
"github.com/coder/coder/v2/enterprise/x/aibridged"
1314
)
@@ -20,14 +21,14 @@ func newAIBridgeDaemon(coderAPI *coderd.API) (*aibridged.Server, error) {
2021

2122
// Setup supported providers.
2223
providers:= []aibridge.Provider{
23-
aibridge.NewOpenAIProvider(aibridge.ProviderConfig{
24+
aibridge.NewOpenAIProvider(aibridge.OpenAIConfig{
2425
BaseURL:coderAPI.DeploymentValues.AI.BridgeConfig.OpenAI.BaseURL.String(),
2526
Key:coderAPI.DeploymentValues.AI.BridgeConfig.OpenAI.Key.String(),
2627
}),
27-
aibridge.NewAnthropicProvider(aibridge.ProviderConfig{
28+
aibridge.NewAnthropicProvider(aibridge.AnthropicConfig{
2829
BaseURL:coderAPI.DeploymentValues.AI.BridgeConfig.Anthropic.BaseURL.String(),
2930
Key:coderAPI.DeploymentValues.AI.BridgeConfig.Anthropic.Key.String(),
30-
}),
31+
},getBedrockConfig(coderAPI.DeploymentValues.AI.BridgeConfig.Bedrock)),
3132
}
3233

3334
// Create pool for reusable stateful [aibridge.RequestBridge] instances (one per user).
@@ -45,3 +46,17 @@ func newAIBridgeDaemon(coderAPI *coderd.API) (*aibridged.Server, error) {
4546
}
4647
returnsrv,nil
4748
}
49+
50+
funcgetBedrockConfig(cfg codersdk.AIBridgeBedrockConfig)*aibridge.AWSBedrockConfig {
51+
ifcfg.Region.String()==""&&cfg.AccessKey.String()==""&&cfg.AccessKeySecret.String()=="" {
52+
returnnil
53+
}
54+
55+
return&aibridge.AWSBedrockConfig{
56+
Region:cfg.Region.String(),
57+
AccessKey:cfg.AccessKey.String(),
58+
AccessKeySecret:cfg.AccessKeySecret.String(),
59+
Model:cfg.Model.String(),
60+
SmallFastModel:cfg.SmallFastModel.String(),
61+
}
62+
}

‎enterprise/x/aibridged/aibridged_integration_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func TestIntegration(t *testing.T) {
164164
require.NoError(t,err)
165165

166166
logger:=testutil.Logger(t)
167-
providers:= []aibridge.Provider{aibridge.NewOpenAIProvider(aibridge.ProviderConfig{BaseURL:mockOpenAI.URL})}
167+
providers:= []aibridge.Provider{aibridge.NewOpenAIProvider(aibridge.OpenAIConfig{BaseURL:mockOpenAI.URL})}
168168
pool,err:=aibridged.NewCachedBridgePool(aibridged.DefaultPoolOptions,providers,logger)
169169
require.NoError(t,err)
170170

‎enterprise/x/aibridged/aibridged_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ func TestRouting(t *testing.T) {
288288
client:=mock.NewMockDRPCClient(ctrl)
289289

290290
providers:= []aibridge.Provider{
291-
aibridge.NewOpenAIProvider(aibridge.ProviderConfig{BaseURL:openaiSrv.URL}),
292-
aibridge.NewAnthropicProvider(aibridge.ProviderConfig{BaseURL:antSrv.URL}),
291+
aibridge.NewOpenAIProvider(aibridge.OpenAIConfig{BaseURL:openaiSrv.URL}),
292+
aibridge.NewAnthropicProvider(aibridge.AnthropicConfig{BaseURL:antSrv.URL},nil),
293293
}
294294
pool,err:=aibridged.NewCachedBridgePool(aibridged.DefaultPoolOptions,providers,logger)
295295
require.NoError(t,err)

‎go.mod‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ require (
476476
github.com/anthropics/anthropic-sdk-gov1.13.0
477477
github.com/brianvoe/gofakeit/v7v7.8.0
478478
github.com/coder/agentapi-sdk-gov0.0.0-20250505131810-560d1d88d225
479-
github.com/coder/aibridgev0.1.5
479+
github.com/coder/aibridgev0.1.6
480480
github.com/coder/aisdk-gov0.0.9
481481
github.com/coder/boundaryv1.0.1-0.20250925154134-55a44f2a7945
482482
github.com/coder/previewv1.0.4
@@ -509,6 +509,7 @@ require (
509509
github.com/aquasecurity/trivyv0.61.1-0.20250407075540-f1329c7ea1aa// indirect
510510
github.com/aquasecurity/trivy-checksv1.11.3-0.20250604022615-9a7efa7c9169// indirect
511511
github.com/aws/aws-sdk-gov1.55.7// indirect
512+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstreamv1.6.11// indirect
512513
github.com/bahlo/generic-list-gov0.2.0// indirect
513514
github.com/bgentry/go-netrcv0.0.0-20140422174119-9fd32a8b3d3d// indirect
514515
github.com/buger/jsonparserv1.1.1// indirect

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp