From f8c28e2f5aa68fd082edbcb198a8ade76f25fd71 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 21 Sep 2026 21:30:04 +0000 Subject: [PATCH] fix(proxy): use contextlib.suppress for cost-map lookup miss to stay under BLE001 budget Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../management_endpoints/model_management_endpoints.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/management_endpoints/model_management_endpoints.py b/litellm/proxy/management_endpoints/model_management_endpoints.py index 837d7721524..3ec04383973 100644 --- a/litellm/proxy/management_endpoints/model_management_endpoints.py +++ b/litellm/proxy/management_endpoints/model_management_endpoints.py @@ -14,7 +14,7 @@ import asyncio import datetime import json from collections.abc import AsyncGenerator, Awaitable, Callable, Mapping, Sequence -from contextlib import AbstractAsyncContextManager, asynccontextmanager +from contextlib import AbstractAsyncContextManager, asynccontextmanager, suppress from dataclasses import dataclass from fnmatch import fnmatchcase from json import JSONDecodeError @@ -940,10 +940,9 @@ def _cost_map_entry(db_model: Deployment, incoming_model_info: Mapping[str, obje lookup: Final = base_model if isinstance(base_model, str) else _decrypted_model(db_model.litellm_params.model) if lookup is None: return MappingProxyType({}) - try: + with suppress(Exception): return MappingProxyType(dict(litellm.get_model_info(model=lookup))) - except Exception: - return MappingProxyType({}) + return MappingProxyType({}) LoadedCatalog: TypeAlias = Callable[[], Mapping[str, Mapping[str, object]]] # mutable-ok: Callable parameter syntax