diff --git a/relay/channel/aws/relay-aws.go b/relay/channel/aws/relay-aws.go index 8a06003a5..ec5ea8988 100644 --- a/relay/channel/aws/relay-aws.go +++ b/relay/channel/aws/relay-aws.go @@ -12,6 +12,7 @@ import ( "github.com/QuantumNous/new-api/relay/channel/claude" relaycommon "github.com/QuantumNous/new-api/relay/common" "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" @@ -25,6 +26,19 @@ import ( ) func newAwsClient(c *gin.Context, info *relaycommon.RelayInfo) (*bedrockruntime.Client, error) { + var ( + httpClient *http.Client + err error + ) + if info.ChannelSetting.Proxy != "" { + httpClient, err = service.NewProxyHttpClient(info.ChannelSetting.Proxy) + if err != nil { + return nil, fmt.Errorf("new proxy http client failed: %w", err) + } + } else { + httpClient = service.GetHttpClient() + } + awsSecret := strings.Split(info.ApiKey, "|") var client *bedrockruntime.Client switch len(awsSecret) { @@ -34,6 +48,7 @@ func newAwsClient(c *gin.Context, info *relaycommon.RelayInfo) (*bedrockruntime. client = bedrockruntime.New(bedrockruntime.Options{ Region: region, BearerAuthTokenProvider: bearer.StaticTokenProvider{Token: bearer.Token{Value: apiKey}}, + HTTPClient: httpClient, }) case 3: ak := awsSecret[0] @@ -42,6 +57,7 @@ func newAwsClient(c *gin.Context, info *relaycommon.RelayInfo) (*bedrockruntime. client = bedrockruntime.New(bedrockruntime.Options{ Region: region, Credentials: aws.NewCredentialsCache(credentials.NewStaticCredentialsProvider(ak, sk, "")), + HTTPClient: httpClient, }) default: return nil, errors.New("invalid aws secret key")