diff --git a/litellm/__init__.py b/litellm/__init__.py index 6f27e2881a..5ff730464a 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -61,13 +61,14 @@ from litellm.constants import ( DEFAULT_ALLOWED_FAILS, ) from litellm.types.guardrails import GuardrailItem -from litellm_proxy._types import ( +from litellm.types.proxy.management_endpoints.ui_sso import DefaultTeamSSOParams +from litellm.types.utils import ( + StandardKeyGenerationConfig, + LlmProviders, KeyManagementSystem, KeyManagementSettings, LiteLLM_UpperboundKeyGenerateParams, ) -from litellm.types.proxy.management_endpoints.ui_sso import DefaultTeamSSOParams -from litellm.types.utils import StandardKeyGenerationConfig, LlmProviders from litellm.integrations.custom_logger import CustomLogger from litellm.litellm_core_utils.logging_callback_manager import LoggingCallbackManager import httpx diff --git a/litellm/types/utils.py b/litellm/types/utils.py index fa03c59270..526a097606 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -2276,3 +2276,48 @@ class KeyManagementSystem(enum.Enum): HASHICORP_VAULT = "hashicorp_vault" LOCAL = "local" AWS_KMS = "aws_kms" + + +class KeyManagementSettings(LiteLLMPydanticObjectBase): + hosted_keys: Optional[List] = None + store_virtual_keys: Optional[bool] = False + """ + If True, virtual keys created by litellm will be stored in the secret manager + """ + prefix_for_stored_virtual_keys: str = "litellm/" + """ + If set, this prefix will be used for stored virtual keys in the secret manager + """ + + access_mode: Literal["read_only", "write_only", "read_and_write"] = "read_only" + """ + Access mode for the secret manager, when write_only will only use for writing secrets + """ + + primary_secret_name: Optional[str] = None + """ + If set, will read secrets from this primary secret in the secret manager + + eg. on AWS you can store multiple secret values as K/V pairs in a single secret + """ + + +class LiteLLM_UpperboundKeyGenerateParams(LiteLLMPydanticObjectBase): + """ + Set default upperbound to max budget a key called via `/key/generate` can be. + + Args: + max_budget (Optional[float], optional): Max budget a key can be. Defaults to None. + budget_duration (Optional[str], optional): Duration of the budget. Defaults to None. + duration (Optional[str], optional): Duration of the key. Defaults to None. + max_parallel_requests (Optional[int], optional): Max number of requests that can be made in parallel. Defaults to None. + tpm_limit (Optional[int], optional): Tpm limit. Defaults to None. + rpm_limit (Optional[int], optional): Rpm limit. Defaults to None. + """ + + max_budget: Optional[float] = None + budget_duration: Optional[str] = None + duration: Optional[str] = None + max_parallel_requests: Optional[int] = None + tpm_limit: Optional[int] = None + rpm_limit: Optional[int] = None diff --git a/litellm_proxy/_types.py b/litellm_proxy/_types.py index caa3d28716..702dd1969f 100644 --- a/litellm_proxy/_types.py +++ b/litellm_proxy/_types.py @@ -173,27 +173,6 @@ def hash_token(token: str): return hashed_token -class LiteLLM_UpperboundKeyGenerateParams(LiteLLMPydanticObjectBase): - """ - Set default upperbound to max budget a key called via `/key/generate` can be. - - Args: - max_budget (Optional[float], optional): Max budget a key can be. Defaults to None. - budget_duration (Optional[str], optional): Duration of the budget. Defaults to None. - duration (Optional[str], optional): Duration of the key. Defaults to None. - max_parallel_requests (Optional[int], optional): Max number of requests that can be made in parallel. Defaults to None. - tpm_limit (Optional[int], optional): Tpm limit. Defaults to None. - rpm_limit (Optional[int], optional): Rpm limit. Defaults to None. - """ - - max_budget: Optional[float] = None - budget_duration: Optional[str] = None - duration: Optional[str] = None - max_parallel_requests: Optional[int] = None - tpm_limit: Optional[int] = None - rpm_limit: Optional[int] = None - - class KeyManagementRoutes(str, enum.Enum): """ Enum for key management routes @@ -1237,30 +1216,6 @@ class OrganizationRequest(LiteLLMPydanticObjectBase): class DeleteOrganizationRequest(LiteLLMPydanticObjectBase): organization_ids: List[str] # required -class KeyManagementSettings(LiteLLMPydanticObjectBase): - hosted_keys: Optional[List] = None - store_virtual_keys: Optional[bool] = False - """ - If True, virtual keys created by litellm will be stored in the secret manager - """ - prefix_for_stored_virtual_keys: str = "litellm/" - """ - If set, this prefix will be used for stored virtual keys in the secret manager - """ - - access_mode: Literal["read_only", "write_only", "read_and_write"] = "read_only" - """ - Access mode for the secret manager, when write_only will only use for writing secrets - """ - - primary_secret_name: Optional[str] = None - """ - If set, will read secrets from this primary secret in the secret manager - - eg. on AWS you can store multiple secret values as K/V pairs in a single secret - """ - - class TeamDefaultSettings(LiteLLMPydanticObjectBase): team_id: str diff --git a/litellm_proxy/proxy_server.py b/litellm_proxy/proxy_server.py index 166b9a17df..63bc0ad653 100644 --- a/litellm_proxy/proxy_server.py +++ b/litellm_proxy/proxy_server.py @@ -33,6 +33,7 @@ from litellm.types.utils import ( ModelResponse, ModelResponseStream, TextCompletionResponse, + KeyManagementSettings, ) if TYPE_CHECKING: