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: fix linting errors
Krrish Dholakiab90ff30b2af2
diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.pyindex 1251e85468d..3bf5f0e5e44 100644--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py@@ -5,7 +5,7 @@ import jsonimport tracebackfrom base64 import b64encodefrom datetime import datetime-from typing import Any, Dict, List, Optional, Tuple, Union+from typing import Any, Dict, List, Optional, Tuple, Union, castfrom urllib.parse import urlencode, urlparseimport httpx@@ -1003,31 +1003,44 @@ def create_pass_through_route(if passthrough_params is not None:target_params.update(passthrough_params.get("passthrough_params", {}))+ # Extract and cast parameters with proper types+ param_target = target_params.get("target") or target+ param_custom_headers = target_params.get("custom_headers", custom_headers)+ param_forward_headers = target_params.get(+ "forward_headers", _forward_headers+ )+ param_merge_query_params = target_params.get(+ "merge_query_params", _merge_query_params+ )+ param_cost_per_request = target_params.get(+ "cost_per_request", cost_per_request+ )+# Construct the full target URL with subpath if neededfull_target = (HttpPassThroughEndpointHelpers.construct_target_url_with_subpath(- base_target=target_params.get("target", target),+ base_target=cast(str, param_target),subpath=subpath,include_subpath=include_subpath,))+ # Ensure custom_headers is a dict+ headers_dict = (+ param_custom_headers if isinstance(param_custom_headers, dict) else {}+ )+return await pass_through_request( # type: ignorerequest=request,target=full_target,- custom_headers=target_params.get("custom_headers", custom_headers)- or {},+ custom_headers=headers_dict,user_api_key_dict=user_api_key_dict,- forward_headers=target_params.get("forward_headers", _forward_headers),- merge_query_params=target_params.get(- "merge_query_params", _merge_query_params- ),+ forward_headers=cast(Optional[bool], param_forward_headers),+ merge_query_params=cast(Optional[bool], param_merge_query_params),query_params=query_params,stream=stream,custom_body=custom_body,- cost_per_request=target_params.get(- "cost_per_request", cost_per_request- ),+ cost_per_request=cast(Optional[float], param_cost_per_request),custom_llm_provider=custom_llm_provider,)