Merge pull request #14764 from daily-kim/litellm_fix_bearer_capitalization

Fix: Authorization header to use correct "Bearer" capitalization
This commit is contained in:
Krish Dholakia
2025-10-03 22:02:46 -07:00
committed by GitHub
6 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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",
}
@@ -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",
}
@@ -84,7 +84,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
@@ -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}"},
}
]
+1 -1
View File
@@ -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",
}