From 62622ef4b296efaf80dba825ce65e78bd3dac24e Mon Sep 17 00:00:00 2001 From: daily-kim Date: Sun, 21 Sep 2025 10:44:47 +0000 Subject: [PATCH] fix: update authorization header to use 'Bearer' instead of 'bearer' --- litellm/llms/cohere/common_utils.py | 4 ++-- litellm/llms/cohere/rerank/transformation.py | 2 +- litellm/llms/infinity/rerank/transformation.py | 2 +- .../proxy/pass_through_endpoints/pass_through_endpoints.py | 2 +- tests/local_testing/test_pass_through_endpoints.py | 6 +++--- tests/test_passthrough_endpoints.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/litellm/llms/cohere/common_utils.py b/litellm/llms/cohere/common_utils.py index 6dbe52d575..d194d9556b 100644 --- a/litellm/llms/cohere/common_utils.py +++ b/litellm/llms/cohere/common_utils.py @@ -31,7 +31,7 @@ def validate_environment( "Request-Source": "unspecified:litellm", "accept": "application/json", "content-type": "application/json", - "Authorization": "bearer $CO_API_KEY" + "Authorization": "Bearer $CO_API_KEY" } """ headers.update( @@ -42,7 +42,7 @@ def validate_environment( } ) if api_key: - headers["Authorization"] = f"bearer {api_key}" + headers["Authorization"] = f"Bearer {api_key}" return headers diff --git a/litellm/llms/cohere/rerank/transformation.py b/litellm/llms/cohere/rerank/transformation.py index 5371b9a4b6..4683ea479f 100644 --- a/litellm/llms/cohere/rerank/transformation.py +++ b/litellm/llms/cohere/rerank/transformation.py @@ -86,7 +86,7 @@ class CohereRerankConfig(BaseRerankConfig): ) default_headers = { - "Authorization": f"bearer {api_key}", + "Authorization": f"Bearer {api_key}", "accept": "application/json", "content-type": "application/json", } diff --git a/litellm/llms/infinity/rerank/transformation.py b/litellm/llms/infinity/rerank/transformation.py index 4b75fa121b..408595cd97 100644 --- a/litellm/llms/infinity/rerank/transformation.py +++ b/litellm/llms/infinity/rerank/transformation.py @@ -49,7 +49,7 @@ class InfinityRerankConfig(CohereRerankConfig): ) default_headers = { - "Authorization": f"bearer {api_key}", + "Authorization": f"Bearer {api_key}", "accept": "application/json", "content-type": "application/json", } diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py index a1f43d0ca5..f55816edf9 100644 --- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py @@ -76,7 +76,7 @@ async def set_env_variables_in_header(custom_headers: Optional[dict]) -> Optiona example header can be - {"Authorization": "bearer os.environ/COHERE_API_KEY"} + {"Authorization": "Bearer os.environ/COHERE_API_KEY"} """ if custom_headers is None: return None diff --git a/tests/local_testing/test_pass_through_endpoints.py b/tests/local_testing/test_pass_through_endpoints.py index 6cc6a66007..9836b262ef 100644 --- a/tests/local_testing/test_pass_through_endpoints.py +++ b/tests/local_testing/test_pass_through_endpoints.py @@ -117,7 +117,7 @@ async def test_pass_through_endpoint_rerank(client): { "path": "/v1/rerank", "target": "https://api.cohere.com/v1/rerank", - "headers": {"Authorization": f"bearer {_cohere_api_key}"}, + "headers": {"Authorization": f"Bearer {_cohere_api_key}"}, } ] @@ -193,7 +193,7 @@ async def test_pass_through_endpoint_rpm_limit( "path": "/v1/rerank", "target": "https://api.cohere.com/v1/rerank", "auth": auth, - "headers": {"Authorization": f"bearer {_cohere_api_key}"}, + "headers": {"Authorization": f"Bearer {_cohere_api_key}"}, } ] @@ -293,7 +293,7 @@ async def test_pass_through_endpoint_sequential_rpm_limit( "path": "/v1/rerank", "target": "https://api.cohere.com/v1/rerank", "auth": auth, - "headers": {"Authorization": f"bearer {_cohere_api_key}"}, + "headers": {"Authorization": f"Bearer {_cohere_api_key}"}, } ] diff --git a/tests/test_passthrough_endpoints.py b/tests/test_passthrough_endpoints.py index a66c94c583..47ac7511aa 100644 --- a/tests/test_passthrough_endpoints.py +++ b/tests/test_passthrough_endpoints.py @@ -17,7 +17,7 @@ dotenv.load_dotenv() async def cohere_rerank(session): url = "http://localhost:4000/v1/rerank" headers = { - "Authorization": f"bearer {os.getenv('COHERE_API_KEY')}", + "Authorization": f"Bearer {os.getenv('COHERE_API_KEY')}", "Content-Type": "application/json", "Accept": "application/json", }