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(types): annotate GenerateRequestBase containers and check_max_budget (#45801)
nate-berrib7d48ecd281f
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex bd6b77f4873..64bb4157f4a 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -1183,40 +1183,40 @@ class GenerateRequestBase(LiteLLMPydanticObjectBase):key_alias: str | None = Noneduration: str | None = None- models: list | None = []+ models: list[Any] | None = []spend: float | None = 0max_budget: float | None = Noneuser_id: str | None = Noneteam_id: str | None = Noneagent_id: str | None = Nonemax_parallel_requests: int | None = None- metadata: dict | None = {}+ metadata: dict[Any, Any] | None = {}tpm_limit: int | None = Nonerpm_limit: int | None = Nonebudget_duration: str | None = Nonebudget_limits: list[BudgetLimitEntry] | None = None # multiple concurrent budget windows- allowed_cache_controls: list | None = []- config: dict | None = {}- permissions: dict | None = {}- model_max_budget: dict | None = {} # {"gpt-4": 5.0, "gpt-3.5-turbo": 5.0}, defaults to {}+ allowed_cache_controls: list[object] | None = []+ config: dict[object, object] | None = {}+ permissions: dict[object, object] | None = {}+ model_max_budget: dict[object, object] | None = {} # {"gpt-4": 5.0, "gpt-3.5-turbo": 5.0}, defaults to {}budget_fallbacks: dict[str, list[str]] | None = Nonemodel_config = ConfigDict(protected_namespaces=())- model_rpm_limit: dict | None = None- model_tpm_limit: dict | None = None+ model_rpm_limit: dict[object, object] | None = None+ model_tpm_limit: dict[object, object] | None = Nonemcp_rpm_limit: dict[str, int] | None = Nonetag_rpm_limit: dict[str, int] | None = Noneguardrails: list[str] | None = Nonepolicies: list[str] | None = Noneprompts: list[str] | None = Noneblocked: bool | None = None- aliases: dict | None = {}+ aliases: dict[object, object] | None = {}object_permission: LiteLLM_ObjectPermissionBase | None = None@field_validator("max_budget", mode="before")@classmethod- def check_max_budget(cls, v):+ def check_max_budget(cls, v: object) -> object:if v == "":return Nonereturn v