mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* feat(budgets): add per-model tpm and rpm limit maps to budgets and customers Budgets gain model_tpm_limit and model_rpm_limit (model name to whole number, 0 or more). /budget/new, /budget/update, /budget/info and /customer/new carry them, and the auth path loads a customer's maps onto UserAPIKeyAuth as end_user_model_tpm_limit and end_user_model_rpm_limit so the limiter can enforce them in a follow-up. * fix(budgets): keep org, team and project per-model limits in metadata; lock_timeout and type gate fixes Organizations, teams and projects store model_tpm_limit / model_rpm_limit in their own metadata, which the limiter reads, so the shared budget allowlist leaves those two fields to customers. Migration starts with SET LOCAL lock_timeout. Mapping annotations and rebind-ok reasons satisfy the type discipline gate. Customer info tests expect the two new budget keys. * fix(organizations): keep stripping budget_id and flattening nested per-model maps on update The update path pops every budget field from the organization row again, so a caller's budget_id never changes the attached budget, and a nested litellm_budget_table still flattens the two maps into org metadata. Drops the explanatory comment on CUSTOMER_ONLY_BUDGET_FIELDS. * fix(types): keep basedpyright and ruff strict counts flat for the new budget fields Reads the per-model maps off the end-user params with membership checks instead of .get on an untyped dict, writes the inline customer budget through the client's typed jsonify_object, and builds budget rows in handle_budget_for_entity with model_validate so the two Mapping fields never receive object-typed kwargs. * chore: drop unrelated reformatting from project endpoints Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
72 lines
2.5 KiB
Python
72 lines
2.5 KiB
Python
"""
|
|
Domain models for LiteLLM backend.
|
|
"""
|
|
|
|
from litellm.models.access_group import LiteLLM_AccessGroupTable
|
|
from litellm.models.autorouter_session import LiteLLM_AutoRouterSession
|
|
from litellm.models.budget import (
|
|
CUSTOMER_ONLY_BUDGET_FIELDS,
|
|
LiteLLM_BudgetTable,
|
|
LiteLLM_BudgetTableFull,
|
|
LiteLLM_TeamMemberTable,
|
|
)
|
|
from litellm.models.config import LiteLLM_Config
|
|
from litellm.models.credentials import (
|
|
CreateCredentialItem,
|
|
CredentialBase,
|
|
CredentialItem,
|
|
)
|
|
from litellm.models.end_user import LiteLLM_EndUserTable
|
|
from litellm.models.managed_files import (
|
|
LiteLLM_ManagedFileTable,
|
|
LiteLLM_ManagedObjectTable,
|
|
LiteLLM_ManagedVectorStoresTable,
|
|
LiteLLM_ManagedVectorStoreTable,
|
|
)
|
|
from litellm.models.mcp_server import LiteLLM_MCPServerTable
|
|
from litellm.models.model import LiteLLM_ProxyModelTable
|
|
from litellm.models.object_permission import LiteLLM_ObjectPermissionTable
|
|
from litellm.models.organization import LiteLLM_OrganizationTable
|
|
from litellm.models.organization_membership import LiteLLM_OrganizationMembershipTable
|
|
from litellm.models.project import LiteLLM_ProjectTable
|
|
from litellm.models.skills import LiteLLM_SkillsTable
|
|
from litellm.models.spend_logs import LiteLLM_ErrorLogs, LiteLLM_SpendLogs
|
|
from litellm.models.subscription_account import LiteLLM_SubscriptionAccountTable
|
|
from litellm.models.tag import LiteLLM_TagTable
|
|
from litellm.models.team import LiteLLM_TeamTable
|
|
from litellm.models.team_membership import LiteLLM_TeamMembership
|
|
from litellm.models.user import LiteLLM_UserTable
|
|
from litellm.models.verification_token import LiteLLM_VerificationToken
|
|
|
|
__all__ = [
|
|
"CUSTOMER_ONLY_BUDGET_FIELDS",
|
|
"CreateCredentialItem",
|
|
"CredentialBase",
|
|
"CredentialItem",
|
|
"LiteLLM_AccessGroupTable",
|
|
"LiteLLM_AutoRouterSession",
|
|
"LiteLLM_BudgetTable",
|
|
"LiteLLM_BudgetTableFull",
|
|
"LiteLLM_Config",
|
|
"LiteLLM_EndUserTable",
|
|
"LiteLLM_ErrorLogs",
|
|
"LiteLLM_MCPServerTable",
|
|
"LiteLLM_ManagedFileTable",
|
|
"LiteLLM_ManagedObjectTable",
|
|
"LiteLLM_ManagedVectorStoreTable",
|
|
"LiteLLM_ManagedVectorStoresTable",
|
|
"LiteLLM_ObjectPermissionTable",
|
|
"LiteLLM_OrganizationMembershipTable",
|
|
"LiteLLM_OrganizationTable",
|
|
"LiteLLM_ProjectTable",
|
|
"LiteLLM_ProxyModelTable",
|
|
"LiteLLM_SkillsTable",
|
|
"LiteLLM_SpendLogs",
|
|
"LiteLLM_SubscriptionAccountTable",
|
|
"LiteLLM_TagTable",
|
|
"LiteLLM_TeamMemberTable",
|
|
"LiteLLM_TeamMembership",
|
|
"LiteLLM_TeamTable",
|
|
"LiteLLM_UserTable",
|
|
"LiteLLM_VerificationToken",
|
|
]
|