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]

Merge upstream/main - resolve health check conflicts

Alejandro Tapia80c09295add6
diff --cc litellm/proxy/health_check.py
index 48a20833cb2,de4517efc88..d228bdb2129
--- a/litellm/proxy/health_check.py
+++ b/litellm/proxy/health_check.py
@@@ -190,7 -283,8 +283,9 @@@ async def perform_health_check
model: Optional[str] = None,
cli_model: Optional[str] = None,
details: Optional[bool] = True,
+ model_id: Optional[str] = None,
+ max_concurrency: Optional[int] = None,
+ instrumentation_context: Optional[dict] = None,
):
"""
Perform a health check on the system.
@@@ -208,14 -303,18 +308,23 @@@
{"model_name": cli_model, "litellm_params": {"model": cli_model}}
]
else:
+ if instrumentation_enabled:
+ logger.debug(
+ "health_check_cycle_skipped source=%s cycle_id=%s reason=no_models",
+ source,
+ cycle_id,
+ )
return [], []
+ cycle_start_time = time.monotonic()
+ requested_model_count = len(model_list)
+
- if model is not None:
+ # Filter by model_id first so a single deployment is checked when id is specified
+ if model_id is not None:
+ _by_id = [x for x in model_list if (x.get("model_info") or {}).get("id") == model_id]
+ if _by_id:
+ model_list = _by_id
+ elif model is not None:
_new_model_list = [
x for x in model_list if x["litellm_params"]["model"] == model
]
diff --cc litellm/proxy/health_endpoints/_health_endpoints.py
index b844a959622,3570b2dd6aa..f865e67c7a9
--- a/litellm/proxy/health_endpoints/_health_endpoints.py
+++ b/litellm/proxy/health_endpoints/_health_endpoints.py
@@@ -736,7 -746,7 +746,8 @@@ async def _perform_health_check_and_sav
cli_model=cli_model,
model=target_model,
details=details,
- max_concurrency=max_concurrency,
++ max_concurrency=max_concurrency,,
+ model_id=model_id,
)
# Optionally save health check result to database (non-blocking)