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): reload the unpriced-model toggle regardless of supported_db_objects

mateodf00c334d156
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index 36033f0ff30..db3bb52984a 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -6823,7 +6823,8 @@ class ProxyConfig:
if self._should_load_db_object(object_type="config_overrides"):
await self._init_hashicorp_vault_config_override(prisma_client=prisma_client)
- await self._apply_safe_litellm_settings_overrides_from_db(prisma_client=prisma_client)
+
+ await self._apply_safe_litellm_settings_overrides_from_db(prisma_client=prisma_client)
async def _apply_safe_litellm_settings_overrides_from_db(self, prisma_client: PrismaClient) -> None:
config_record: Final = await get_config_param(prisma_client, "litellm_settings")
diff --git a/tests/test_litellm/proxy/management_endpoints/test_cost_tracking_settings.py b/tests/test_litellm/proxy/management_endpoints/test_cost_tracking_settings.py
index 8dfc83760b7..ea86731eba4 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_cost_tracking_settings.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_cost_tracking_settings.py
@@ -741,9 +741,11 @@ class TestBlockRequestsForModelsWithoutPricing:
assert litellm.block_requests_for_models_without_pricing is True
@pytest.mark.asyncio
- async def test_periodic_db_sync_applies_flag_to_peer_worker(self):
+ @pytest.mark.parametrize("loads_config_overrides", [True, False])
+ async def test_periodic_db_sync_applies_flag_to_peer_worker(self, loads_config_overrides):
"""The ~10s reconcile loop runs _init_non_llm_objects_in_db on every worker; it must apply
- the persisted flag so peers converge without a restart."""
+ the persisted flag so peers converge without a restart, including when supported_db_objects
+ leaves config_overrides out."""
from types import SimpleNamespace
from litellm.proxy.proxy_server import ProxyConfig
@@ -756,7 +758,7 @@ class TestBlockRequestsForModelsWithoutPricing:
patch.object(
ProxyConfig,
"_should_load_db_object",
- side_effect=lambda object_type: object_type == "config_overrides",
+ side_effect=lambda object_type: loads_config_overrides and object_type == "config_overrides",
),
patch.object(ProxyConfig, "_init_hashicorp_vault_config_override", AsyncMock()),
patch("litellm.proxy.proxy_server.get_config_param", AsyncMock(return_value=config_record)),