diff --git a/openhands/core/config/llm_config.py b/openhands/core/config/llm_config.py index c8b20c96a0..5942c99f7e 100644 --- a/openhands/core/config/llm_config.py +++ b/openhands/core/config/llm_config.py @@ -183,3 +183,13 @@ class LLMConfig(BaseModel): # Azure issue: https://github.com/All-Hands-AI/OpenHands/issues/7755 if self.model.startswith('azure') and self.api_version is None: self.api_version = '2024-12-01-preview' + + # Set AWS credentials as environment variables for LiteLLM Bedrock + if self.aws_access_key_id: + os.environ['AWS_ACCESS_KEY_ID'] = self.aws_access_key_id.get_secret_value() + if self.aws_secret_access_key: + os.environ['AWS_SECRET_ACCESS_KEY'] = ( + self.aws_secret_access_key.get_secret_value() + ) + if self.aws_region_name: + os.environ['AWS_REGION_NAME'] = self.aws_region_name