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
_add_deployment_model_to_endpoint_for_llm_passthrough_route
Ishaan Jaffer74a35914c626
diff --git a/litellm/router.py b/litellm/router.pyindex b136dcbae83..fbf8a1aa413 100644--- a/litellm/router.py+++ b/litellm/router.py@@ -2740,6 +2740,21 @@ class Router:))raise e++ def _add_deployment_model_to_endpoint_for_llm_passthrough_route(+ self, kwargs: Dict[str, Any],+ model: str,+ model_name: str+ ) -> Dict[str, Any]:+ """+ Add the deployment model to the endpoint for LLM passthrough route.++ e.g for bedrock invoke users can pass endpoint as /model/special-bedrock-model/invoke+ it should be actually sent as /model/us.anthropic.claude-3-5-sonnet-20240620-v1:0/invoke+ """+ if "endpoint" in kwargs and kwargs["endpoint"]:+ kwargs["endpoint"] = kwargs["endpoint"].replace(model, model_name)+ return kwargsasync def _ageneric_api_call_with_fallbacks_helper(self, model: str, original_generic_function: Callable, **kwargs@@ -2772,6 +2787,7 @@ class Router:model_name = data["model"]self.total_calls[model_name] += 1+ self._add_deployment_model_to_endpoint_for_llm_passthrough_route(kwargs=kwargs, model=model, model_name=model_name)### get customresponse = original_generic_function(**{@@ -2850,6 +2866,12 @@ class Router:self.total_calls[model_name] += 1+ # For passthrough routes, use the actual model from deployment+ # and swap model name in endpoint if present+ if "endpoint" in kwargs and kwargs["endpoint"]:+ kwargs["endpoint"] = kwargs["endpoint"].replace(model, model_name)+ kwargs["model"] = model_name+# Perform pre-call checks for routing strategyself.routing_strategy_pre_call_checks(deployment=deployment)