diff --git a/litellm/llms/custom_httpx/http_handler.py b/litellm/llms/custom_httpx/http_handler.py index 3dfef07d426..d8d13e36fb4 100644 --- a/litellm/llms/custom_httpx/http_handler.py +++ b/litellm/llms/custom_httpx/http_handler.py @@ -1235,7 +1235,7 @@ def get_async_httpx_client( if params is not None: # Filter out params that are only used for cache key, not for AsyncHTTPHandler.__init__ - handler_params = {k: v for k, v in params.items() if k != "disable_aiohttp_transport"} + handler_params = {k: v for k, v in params.items() if k not in ("disable_aiohttp_transport", "extra_headers")} handler_params["shared_session"] = shared_session _new_client = AsyncHTTPHandler(**handler_params) else: @@ -1284,7 +1284,7 @@ def _get_httpx_client(params: Optional[dict] = None) -> HTTPHandler: if params is not None: # Filter out params that are only used for cache key, not for HTTPHandler.__init__ - handler_params = {k: v for k, v in params.items() if k != "disable_aiohttp_transport"} + handler_params = {k: v for k, v in params.items() if k not in ("disable_aiohttp_transport", "extra_headers")} _new_client = HTTPHandler(**handler_params) else: _new_client = HTTPHandler(timeout=httpx.Timeout(timeout=600.0, connect=5.0))