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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix: update authorization header to use 'Bearer' instead of 'bearer'
daily-kim62622ef4b296
diff --git a/litellm/llms/cohere/common_utils.py b/litellm/llms/cohere/common_utils.pyindex 6dbe52d575e..d194d9556b6 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 headersdiff --git a/litellm/llms/cohere/rerank/transformation.py b/litellm/llms/cohere/rerank/transformation.pyindex 5371b9a4b61..4683ea479f7 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.pyindex 4b75fa121b2..408595cd979 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.pyindex a1f43d0ca50..f55816edf9e 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]) -> Optionaexample header can be- {"Authorization": "bearer os.environ/COHERE_API_KEY"}+ {"Authorization": "Bearer os.environ/COHERE_API_KEY"}"""if custom_headers is None:return Nonediff --git a/tests/local_testing/test_pass_through_endpoints.py b/tests/local_testing/test_pass_through_endpoints.pyindex 6cc6a66007f..9836b262efa 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.pyindex a66c94c5836..47ac7511aa1 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",}