@@ -222,7 +222,11 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
222222 this . options . awsBedrockEndpointEnabled && { endpoint : this . options . awsBedrockEndpoint } ) ,
223223 }
224224
225- if ( this . options . awsUseProfile && this . options . awsProfile ) {
225+ if ( this . options . awsUseApiKey && this . options . awsApiKey ) {
226+ // Use API key/token-based authentication if enabled and API key is set
227+ clientConfig . token = { token : this . options . awsApiKey }
228+ clientConfig . authSchemePreference = [ "httpBearerAuth" ] // Otherwise there's no end of credential problems.
229+ } else if ( this . options . awsUseProfile && this . options . awsProfile ) {
226230 // Use profile-based credentials if enabled and profile is set
227231 clientConfig . credentials = fromIni ( {
228232 profile : this . options . awsProfile ,
@@ -1078,7 +1082,7 @@ Please verify:
10781082 "throttl" ,
10791083 "rate" ,
10801084 "limit" ,
1081- "bedrock is unable to process your request" , // AWS Bedrock specific throttling message
1085+ "bedrock is unable to process your request" , // Amazon Bedrock specific throttling message
10821086 "please wait" ,
10831087 "quota exceeded" ,
10841088 "service unavailable" ,
@@ -1124,7 +1128,7 @@ Suggestions:
11241128Please try:
112511291. Contact AWS support to request a quota increase
112611302. Reduce request frequency temporarily
1127- 3. Check your AWS Bedrock quotas in the AWS console
1131+ 3. Check your Amazon Bedrock quotas in the AWS console
112811324. Consider using a different model or region with available capacity
11291133
11301134` ,
@@ -1139,15 +1143,15 @@ Please try:
11391143
11401144Please try:
114111451. Wait a few minutes and retry
1142- 2. Check the model status in AWS Bedrock console
1146+ 2. Check the model status in Amazon Bedrock console
114311473. Verify the model is properly provisioned
11441148
11451149` ,
11461150 logLevel : "error" ,
11471151 } ,
11481152 INTERNAL_SERVER_ERROR : {
11491153 patterns : [ "internal server error" , "internal error" , "server error" , "service error" ] ,
1150- messageTemplate : `AWS Bedrock internal server error. This is a temporary service issue.
1154+ messageTemplate : `Amazon Bedrock internal server error. This is a temporary service issue.
11511155
11521156Please try:
115311571. Retry the request after a brief delay
@@ -1184,7 +1188,7 @@ Please try:
11841188 ] ,
11851189 messageTemplate : `Parameter validation error: {errorMessage}
11861190
1187- This error indicates that the request parameters don't match AWS Bedrock's expected format.
1191+ This error indicates that the request parameters don't match Amazon Bedrock's expected format.
11881192
11891193Common causes:
119011941. Extended thinking parameter format is incorrect
@@ -1193,7 +1197,7 @@ Common causes:
11931197
11941198Please check:
11951199- Model supports the requested features (extended thinking, etc.)
1196- - Parameter format matches AWS Bedrock specification
1200+ - Parameter format matches Amazon Bedrock specification
11971201- Model ID is correct for the requested features` ,
11981202 logLevel : "error" ,
11991203 } ,
@@ -1218,7 +1222,7 @@ Please check:
12181222 return "THROTTLING"
12191223 }
12201224
1221- // Check for AWS Bedrock specific throttling exception names
1225+ // Check for Amazon Bedrock specific throttling exception names
12221226 if ( ( error as any ) . name === "ThrottlingException" || ( error as any ) . __type === "ThrottlingException" ) {
12231227 return "THROTTLING"
12241228 }
0 commit comments