Skip to content

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]

fix(pass_through_endpoints.py): fix returned response headers for pass-through endpoitns

Krrish Dholakiab56ecd7e028c
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index 9c35db02f19..eff98ae672e 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -1,6 +1,4 @@
model_list:
- - model_name: "text-embedding-ada-002"
+ - model_name: "*"
litellm_params:
- model: "azure/azure-embedding-model"
- api_base: os.environ/AZURE_API_BASE
- api_key: os.environ/AZURE_API_KEY
+ model: "*"
\ No newline at end of file
diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
index ead0b7eb79d..fd18c707f34 100644
--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
@@ -308,7 +308,6 @@ async def pass_through_request(
)
async_client = httpx.AsyncClient()
-
response = await async_client.request(
method=request.method,
url=url,
@@ -362,10 +361,17 @@ async def pass_through_request(
cache_hit=False,
)
+ excluded_headers = {"transfer-encoding", "content-encoding"}
+ headers = {
+ key: value
+ for key, value in response.headers.items()
+ if key.lower() not in excluded_headers
+ }
+
return Response(
content=content,
status_code=response.status_code,
- headers=dict(response.headers),
+ headers=headers,
)
except Exception as e:
verbose_proxy_logger.exception(
@@ -423,7 +429,7 @@ def create_pass_through_route(
)
except Exception:
- verbose_proxy_logger.warning("Defaulting to target being a url.")
+ verbose_proxy_logger.debug("Defaulting to target being a url.")
async def endpoint_func(
request: Request,