Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Add aws_bedrock_runtime_endpoint into Credential Types (#17053)

yuneng-jiangd2b3ef0667db
diff --git a/litellm/types/router.py b/litellm/types/router.py
index 2bf126211c3..002792d0490 100644
--- a/litellm/types/router.py
+++ b/litellm/types/router.py
@@ -159,6 +159,7 @@ class CredentialLiteLLMParams(BaseModel):
aws_access_key_id: Optional[str] = None
aws_secret_access_key: Optional[str] = None
aws_region_name: Optional[str] = None
+ aws_bedrock_runtime_endpoint: Optional[str] = None
## IBM WATSONX ##
watsonx_region_name: Optional[str] = None
diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.py
index 8851264db07..032616849bd 100644
--- a/tests/test_litellm/test_router.py
+++ b/tests/test_litellm/test_router.py
@@ -1692,3 +1692,35 @@ async def test_router_acompletion_with_unknown_model_and_no_fallback():
# Check that the error message is correct.
# The router returns 'no healthy deployments' because get_model_list returns [] not None.
assert "no healthy deployments for this model" in str(excinfo.value)
+
+
+def test_get_deployment_credentials_with_provider_aws_bedrock_runtime_endpoint():
+ """
+ Test that get_deployment_credentials_with_provider correctly copies
+ aws_bedrock_runtime_endpoint from deployment litellm_params to credentials.
+ """
+ router = litellm.Router(
+ model_list=[
+ {
+ "model_name": "bedrock-claude-model",
+ "litellm_params": {
+ "model": "bedrock/us.anthropic.claude-3-5-sonnet-20240620-v1:0",
+ "aws_access_key_id": "test-access-key",
+ "aws_secret_access_key": "test-secret-key",
+ "aws_region_name": "us-east-1",
+ "aws_bedrock_runtime_endpoint": "https://bedrock-runtime.us-east-1.amazonaws.com",
+ },
+ }
+ ],
+ )
+
+ credentials = router.get_deployment_credentials_with_provider(
+ model_id="bedrock-claude-model"
+ )
+
+ assert credentials is not None
+ assert credentials["aws_bedrock_runtime_endpoint"] == "https://bedrock-runtime.us-east-1.amazonaws.com"
+ assert credentials["aws_access_key_id"] == "test-access-key"
+ assert credentials["aws_secret_access_key"] == "test-secret-key"
+ assert credentials["aws_region_name"] == "us-east-1"
+ assert credentials["custom_llm_provider"] == "bedrock"