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): move CommonProxyErrors into litellm/types/proxy (#45745)
nate-berri38880fd5ce26
diff --git a/litellm/integrations/gcs_bucket/gcs_bucket.py b/litellm/integrations/gcs_bucket/gcs_bucket.pyindex 092357ae92b..24a5e940e08 100644--- a/litellm/integrations/gcs_bucket/gcs_bucket.py+++ b/litellm/integrations/gcs_bucket/gcs_bucket.py@@ -26,8 +26,8 @@ else:class GCSBucketLogger(GCSBucketBase, AdditionalLoggingUtils):def __init__(self, bucket_name: str | None = None) -> None:- from litellm.proxy._types import CommonProxyErrorsfrom litellm.proxy.proxy_server import premium_user+ from litellm.types.proxy.common_proxy_errors import CommonProxyErrorsself.batch_size = int(os.getenv("GCS_BATCH_SIZE", GCS_DEFAULT_BATCH_SIZE))self.flush_interval = int(os.getenv("GCS_FLUSH_INTERVAL", GCS_DEFAULT_FLUSH_INTERVAL_SECONDS))@@ -52,8 +52,8 @@ class GCSBucketLogger(GCSBucketBase, AdditionalLoggingUtils):#### ASYNC ####async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):- from litellm.proxy._types import CommonProxyErrorsfrom litellm.proxy.proxy_server import premium_user+ from litellm.types.proxy.common_proxy_errors import CommonProxyErrorsif premium_user is not True:raise ValueError(diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex 2afab2e117e..5882323bc48 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -4345,18 +4345,9 @@ class ModelAccessDeniedProxyException(ProxyException):return self.internal_message.replace("\r", "").replace("\n", "")-class CommonProxyErrors(str, enum.Enum):- db_not_connected_error = (- "DB not connected. This endpoint needs a database; set DATABASE_URL to a "- "PostgreSQL connection string (postgresql://...) to enable it. "- "See https://docs.litellm.ai/docs/proxy/virtual_keys"- )- no_llm_router = "No models configured on proxy"- not_allowed_access = "Admin-only endpoint. Not allowed to access this."- not_premium_user = "You must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. \nPricing: https://www.litellm.ai/#pricing"- max_parallel_request_limit_reached = "Crossed TPM / RPM / Max Parallel Request Limit"- missing_enterprise_package = "Missing litellm-enterprise package. Please install it to use this feature. Run `pip install litellm-enterprise`"- missing_enterprise_package_docker = "This uses the enterprise folder - only available on the Docker image."+from litellm.types.proxy.common_proxy_errors import ( # noqa: E402 # public re-export+ CommonProxyErrors as CommonProxyErrors, # noqa: PLC0414 # public re-export+)class SpendCalculateRequest(LiteLLMPydanticObjectBase):diff --git a/litellm/secret_managers/google_secret_manager.py b/litellm/secret_managers/google_secret_manager.pyindex 2a5152179bb..6d6543cee4b 100644--- a/litellm/secret_managers/google_secret_manager.py+++ b/litellm/secret_managers/google_secret_manager.py@@ -8,7 +8,7 @@ from litellm.caching.caching import InMemoryCachefrom litellm.constants import SECRET_MANAGER_REFRESH_INTERVALfrom litellm.integrations.gcs_bucket.gcs_bucket_base import GCSBucketBasefrom litellm.llms.custom_httpx.http_handler import get_httpx_client-from litellm.proxy._types import CommonProxyErrors+from litellm.types.proxy.common_proxy_errors import CommonProxyErrorsfrom litellm.types.secret_managers.main import KeyManagementSystemdiff --git a/litellm/types/proxy/common_proxy_errors.py b/litellm/types/proxy/common_proxy_errors.pynew file mode 100644index 00000000000..51426220c82--- /dev/null+++ b/litellm/types/proxy/common_proxy_errors.py@@ -0,0 +1,15 @@+import enum+++class CommonProxyErrors(str, enum.Enum):+ db_not_connected_error = (+ "DB not connected. This endpoint needs a database; set DATABASE_URL to a "+ "PostgreSQL connection string (postgresql://...) to enable it. "+ "See https://docs.litellm.ai/docs/proxy/virtual_keys"+ )+ no_llm_router = "No models configured on proxy"+ not_allowed_access = "Admin-only endpoint. Not allowed to access this."+ not_premium_user = "You must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. \nPricing: https://www.litellm.ai/#pricing"+ max_parallel_request_limit_reached = "Crossed TPM / RPM / Max Parallel Request Limit"+ missing_enterprise_package = "Missing litellm-enterprise package. Please install it to use this feature. Run `pip install litellm-enterprise`"+ missing_enterprise_package_docker = "This uses the enterprise folder - only available on the Docker image."