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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
refactor: rename filter var to satisfy mypy
Yuneng Jiangd3331f855b57
diff --git a/litellm/proxy/spend_tracking/spend_management_endpoints.py b/litellm/proxy/spend_tracking/spend_management_endpoints.pyindex 7c3f53ca108..805d0ec1953 100644--- a/litellm/proxy/spend_tracking/spend_management_endpoints.py+++ b/litellm/proxy/spend_tracking/spend_management_endpoints.py@@ -2379,26 +2379,26 @@ async def view_spend_logs( # noqa: PLR0915return responseelse:- filter_query: Dict[str, Any] = {}+ scoped_filter: Dict[str, Any] = {}if api_key is not None and isinstance(api_key, str):if api_key.startswith("sk-"):hashed_token = prisma_client.hash_token(token=api_key)else:hashed_token = api_key- filter_query["api_key"] = hashed_token+ scoped_filter["api_key"] = hashed_tokenif request_id is not None and isinstance(request_id, str):- filter_query["request_id"] = request_id+ scoped_filter["request_id"] = request_idif user_id is not None and isinstance(user_id, str):- filter_query["user"] = user_id+ scoped_filter["user"] = user_id- if not filter_query:+ if not scoped_filter:spend_logs = await prisma_client.get_data(table_name="spend", query_type="find_all")return spend_logsdata = await prisma_client.db.litellm_spendlogs.find_many(- where=filter_query, # type: ignore+ where=scoped_filter, # type: ignoreorder={"startTime": "desc"},)return data