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: headers parameter to default to None rather than empty dict (#10728)
terylt2655fb197724
diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.pyindex 000d511d031..cd894a459a0 100644--- a/litellm/llms/custom_httpx/llm_http_handler.py+++ b/litellm/llms/custom_httpx/llm_http_handler.py@@ -245,7 +245,7 @@ class BaseLLMHTTPHandler:stream: Optional[bool] = False,fake_stream: bool = False,api_key: Optional[str] = None,- headers: Optional[dict] = {},+ headers: Optional[Dict[str, Any]] = None,client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,provider_config: Optional[BaseConfig] = None,):@@ -680,7 +680,7 @@ class BaseLLMHTTPHandler:api_key: Optional[str] = None,client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,aembedding: bool = False,- headers={},+ headers: Optional[Dict[str, Any]] = None,) -> EmbeddingResponse:provider_config = ProviderConfigManager.get_provider_embedding_config(model=model, provider=litellm.LlmProviders(custom_llm_provider)@@ -688,7 +688,7 @@ class BaseLLMHTTPHandler:# get config from model, custom llm providerheaders = provider_config.validate_environment(api_key=api_key,- headers=headers,+ headers=headers or {},model=model,messages=[],optional_params=optional_params,@@ -821,7 +821,7 @@ class BaseLLMHTTPHandler:timeout: Optional[Union[float, httpx.Timeout]],model_response: RerankResponse,_is_async: bool = False,- headers: dict = {},+ headers: Optional[Dict[str, Any]] = None,api_key: Optional[str] = None,api_base: Optional[str] = None,client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,@@ -829,7 +829,7 @@ class BaseLLMHTTPHandler:# get config from model, custom llm providerheaders = provider_config.validate_environment(api_key=api_key,- headers=headers,+ headers=headers or {},model=model,)@@ -951,7 +951,7 @@ class BaseLLMHTTPHandler:custom_llm_provider: str,client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,atranscription: bool = False,- headers: dict = {},+ headers: Optional[Dict[str, Any]] = None,provider_config: Optional[BaseAudioTranscriptionConfig] = None,) -> TranscriptionResponse:if provider_config is None:@@ -960,7 +960,7 @@ class BaseLLMHTTPHandler:)headers = provider_config.validate_environment(api_key=api_key,- headers=headers,+ headers=headers or {},model=model,messages=[],optional_params=optional_params,