From c169193fc41fddd6fde222ed2fd8e911d0c03ef6 Mon Sep 17 00:00:00 2001 From: Chetan Sarva Date: Thu, 20 Nov 2025 18:38:45 -0500 Subject: [PATCH] feature: Support for AWS Bedrock API Keys (#4651) * feat: add AWS Bedrock API Key option to settings panel * feat: Bedrock API key auth method * fix: hide IAM note when using bedrock api key * move to camcelCase identifier for bedrock api key use linting --------- Co-authored-by: timothycarambat --- docker/.env.example | 3 + .../AwsBedrockLLMOptions/index.jsx | 24 ++++- server/.env.example | 3 + server/models/systemSettings.js | 1 + server/utils/AiProviders/bedrock/index.js | 49 ++++----- server/utils/AiProviders/bedrock/utils.js | 99 ++++++++++++++++++- .../agents/aibitat/providers/ai-provider.js | 19 +--- .../utils/agents/aibitat/providers/bedrock.js | 39 +++----- server/utils/helpers/updateENV.js | 8 +- 9 files changed, 164 insertions(+), 81 deletions(-) diff --git a/docker/.env.example b/docker/.env.example index 125a85a1..90d9c96e 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -115,6 +115,9 @@ GID='1000' # AWS_BEDROCK_LLM_CONNECTION_METHOD=iam # AWS_BEDROCK_LLM_MAX_OUTPUT_TOKENS=4096 # AWS_BEDROCK_LLM_SESSION_TOKEN= # Only required if CONNECTION_METHOD is 'sessionToken' +# or even use Short and Long Term API keys +# AWS_BEDROCK_LLM_CONNECTION_METHOD="apiKey" +# AWS_BEDROCK_LLM_API_KEY= # LLM_PROVIDER='fireworksai' # FIREWORKS_AI_LLM_API_KEY='my-fireworks-ai-key' diff --git a/frontend/src/components/LLMSelection/AwsBedrockLLMOptions/index.jsx b/frontend/src/components/LLMSelection/AwsBedrockLLMOptions/index.jsx index a8f19fb8..31aa2850 100644 --- a/frontend/src/components/LLMSelection/AwsBedrockLLMOptions/index.jsx +++ b/frontend/src/components/LLMSelection/AwsBedrockLLMOptions/index.jsx @@ -7,10 +7,9 @@ export default function AwsBedrockLLMOptions({ settings }) { settings?.AwsBedrockLLMConnectionMethod ?? "iam" ); - console.log("connectionMethod", connectionMethod); return (
- {!settings?.credentialsOnly && ( + {!settings?.credentialsOnly && connectionMethod !== "apiKey" && (
@@ -21,6 +20,7 @@ export default function AwsBedrockLLMOptions({ settings }) { href="https://docs.anythingllm.com/setup/llm-configuration/cloud/aws-bedrock" target="_blank" className="underline flex gap-x-1 items-center" + rel="noreferrer" > Read more on how to use AWS Bedrock in AnythingLLM @@ -38,7 +38,7 @@ export default function AwsBedrockLLMOptions({ settings }) { />

Select the method to authenticate with AWS Bedrock. @@ -56,6 +56,7 @@ export default function AwsBedrockLLMOptions({ settings }) { Session Token (Temporary Credentials) +

@@ -117,6 +118,23 @@ export default function AwsBedrockLLMOptions({ settings }) { />
)} + {connectionMethod === "apiKey" && ( +
+ + +
+ )}