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
chore(typing): tighten annotations added in the last day and ratchet budgets
Devin AId6feb35a0429
diff --git a/litellm/batches/batch_utils.py b/litellm/batches/batch_utils.pyindex 6eb13d2cba7..2bc61aed771 100644--- a/litellm/batches/batch_utils.py+++ b/litellm/batches/batch_utils.py@@ -551,7 +551,7 @@ def _get_batch_job_usage_from_response_body(return usage-def _get_anthropic_result_from_batch_results_line(batch_results_line: Mapping[str, Any]) -> dict:+def _get_anthropic_result_from_batch_results_line(batch_results_line: Mapping[str, Any]) -> Mapping[str, Any]:"""Get the ``result`` object from a line of an Anthropic message batch results JSONL file.@@ -563,7 +563,7 @@ def _get_anthropic_result_from_batch_results_line(batch_results_line: Mapping[stdef _get_response_from_batch_job_output_file(batch_job_output_file: Mapping[str, Any], custom_llm_provider: str = "openai"-) -> Any:+) -> Mapping[str, Any]:"""Get the response from the batch job output file"""diff --git a/litellm/integrations/prometheus.py b/litellm/integrations/prometheus.pyindex f9195db1d67..66756be6a6d 100644--- a/litellm/integrations/prometheus.py+++ b/litellm/integrations/prometheus.py@@ -3552,7 +3552,9 @@ class PrometheusLogger(CustomLogger):except Exception as e:verbose_logger.exception("Error initializing user/team count metrics: %s", e)- async def _set_key_list_budget_metrics(self, keys: list[str | UserAPIKeyAuth | LiteLLM_DeletedVerificationToken]):+ async def _set_key_list_budget_metrics(+ self, keys: list[str | UserAPIKeyAuth | LiteLLM_DeletedVerificationToken]+ ) -> None:"""Helper function to set budget metrics for a list of keys"""for key in keys:if isinstance(key, UserAPIKeyAuth):diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.pyindex 54f567b7aa2..5fe5dda0ca4 100644--- a/litellm/proxy/management_endpoints/key_management_endpoints.py+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py@@ -2326,10 +2326,9 @@ async def _process_single_key_update(prisma_client=prisma_client,)- _existing_row_metadata: Final = getattr(existing_key_row, "metadata", None)enforce_batch_enqueued_token_limit_is_admin_only(data=update_key_request,- existing_metadata=_existing_row_metadata if isinstance(_existing_row_metadata, dict) else None,+ existing_metadata=existing_key_row.metadata,user_api_key_dict=user_api_key_dict,entity="key",)diff --git a/litellm/repositories/model_repository.py b/litellm/repositories/model_repository.pyindex 27e23a39cc9..3965aeb2d49 100644--- a/litellm/repositories/model_repository.py+++ b/litellm/repositories/model_repository.py@@ -36,7 +36,7 @@ class _ProxyModelActions(Protocol):class ModelRepository(BaseRepository[LiteLLM_ProxyModelTable]):"""Repository for proxy model database operations with encryption support."""- def __init__(self, prisma_client: object, encryption_key: str | None = None):+ def __init__(self, prisma_client: object, encryption_key: str | None = None) -> None:super().__init__(prisma_client)self._encryption_key = encryption_keydiff --git a/ruff-strict-budget.json b/ruff-strict-budget.jsonindex e651600eb8f..3e037e5bedc 100644--- a/ruff-strict-budget.json+++ b/ruff-strict-budget.json@@ -9,13 +9,13 @@"limit": 827},"ANN201": {- "limit": 2017+ "limit": 2016},"ANN202": {- "limit": 852+ "limit": 851},"ANN204": {- "limit": 711+ "limit": 710},"ANN205": {"limit": 112