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): clear LIT002 in /v2/key/info batch-cap guard

Thijmen Stavenuiterf4406b4060cd
diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py
index 2b37d0bc8fc..85f6d25f6dc 100644
--- a/litellm/proxy/management_endpoints/key_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py
@@ -3675,11 +3675,11 @@ async def info_key_fn_v2(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail={"message": "Malformed request. No keys passed in."},
)
- requested_key_count: Final = len(data.keys or []) + len(data.key_aliases or [])
+ requested_key_count: Final = len(data.keys or ()) + len(data.key_aliases or ())
if requested_key_count > MAX_KEY_INFO_KEYS_PER_REQUEST:
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
- detail={
+ detail={ # mutable-ok: one-shot HTTPException payload matching the sibling detail dict above; never mutated after construction
"message": (
f"Too many keys requested: {requested_key_count}. "
f"At most {MAX_KEY_INFO_KEYS_PER_REQUEST} keys and key_aliases combined per request."