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(proxy): preserve low-detail readiness status

user6536088aff1a
diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.py
index c9859ed25bb..096e23e673d 100644
--- a/litellm/proxy/health_endpoints/_health_endpoints.py
+++ b/litellm/proxy/health_endpoints/_health_endpoints.py
@@ -1530,6 +1530,17 @@ def _allow_public_health_readiness_details() -> bool:
return general_settings.get("allow_public_health_readiness_details") is True
+async def _set_public_readiness_status(response: Response) -> None:
+ from litellm.proxy.proxy_server import prisma_client
+
+ if prisma_client is None:
+ return
+
+ db_health_status = await _db_health_readiness_check()
+ if db_health_status["status"] != "connected":
+ response.status_code = status.HTTP_503_SERVICE_UNAVAILABLE
+
+
@router.get(
"/health/readiness",
tags=["health"],
@@ -1542,6 +1553,8 @@ async def health_readiness(response: Response):
"""
if _allow_public_health_readiness_details():
return await _get_health_readiness_details(response=response)
+
+ await _set_public_readiness_status(response=response)
return {"status": "healthy"}
diff --git a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py
index ae57c02e7c2..2edcb00c967 100644
--- a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py
+++ b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py
@@ -1520,8 +1520,7 @@ async def test_health_readiness_returns_503_when_db_disconnected():
result = await health_readiness(response=response)
assert response.status_code == 503
- assert result["db"] == "disconnected"
- assert result["status"] == "healthy" # body shape unchanged for back-compat
+ assert result == {"status": "healthy"}
@pytest.mark.asyncio
@@ -1544,7 +1543,7 @@ async def test_health_readiness_returns_200_when_db_connected():
result = await health_readiness(response=response)
assert response.status_code == 200
- assert result["db"] == "connected"
+ assert result == {"status": "healthy"}
@pytest.mark.asyncio
@@ -1563,7 +1562,7 @@ async def test_health_readiness_returns_200_when_no_db_configured():
result = await health_readiness(response=response)
assert response.status_code == 200
- assert result["db"] == "Not connected"
+ assert result == {"status": "healthy"}
def test_clean_endpoint_data_strips_credentials_keeps_routing_fields():