Skip to content

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]

Additional Fixes (09/17/2024) (#5759)

Krish Dholakia9c8fdee06808
diff --git a/litellm/integrations/SlackAlerting/slack_alerting.py b/litellm/integrations/SlackAlerting/slack_alerting.py
index bc108714998..7b2f75b9e58 100644
--- a/litellm/integrations/SlackAlerting/slack_alerting.py
+++ b/litellm/integrations/SlackAlerting/slack_alerting.py
@@ -69,6 +69,7 @@ class SlackAlerting(CustomBatchLogger):
"cooldown_deployment",
"new_model_added",
"outage_alerts",
+ "failed_tracking_spend",
],
alert_to_webhook_url: Optional[
Dict[AlertType, Union[List[str], str]]
@@ -598,6 +599,12 @@ class SlackAlerting(CustomBatchLogger):
async def failed_tracking_alert(self, error_message: str):
"""Raise alert when tracking failed for specific model"""
+ if self.alerting is None or self.alert_types is None:
+ # do nothing if alerting is not switched on
+ return
+ if "failed_tracking_spend" not in self.alert_types:
+ return
+
_cache: DualCache = self.internal_usage_cache
message = "Failed Tracking Cost for " + error_message
_cache_key = "budget_alerts:failed_tracking:{}".format(message)
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index c039b94afab..a2911dca614 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -19,16 +19,4 @@ model_list:
- model_name: o1-preview
litellm_params:
model: o1-preview
-
-guardrails:
- - guardrail_name: "hide-secrets"
- litellm_params:
- guardrail: "hide-secrets" # supported values: "aporia", "lakera"
- mode: "pre_call"
- # detect_secrets_config: {
- # "plugins_used": [
- # {"name": "SoftlayerDetector"},
- # {"name": "StripeDetector"},
- # {"name": "NpmDetector"}
- # ]
- # }
\ No newline at end of file
+
\ No newline at end of file
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py
index adcd3f89d45..2aeb8d7e765 100644
--- a/litellm/proxy/_types.py
+++ b/litellm/proxy/_types.py
@@ -123,6 +123,7 @@ AlertType = Literal[
"outage_alerts",
"region_outage_alerts",
"fallback_reports",
+ "failed_tracking_spend",
]
diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py
index 917885bc2d8..a3b0179c2bc 100644
--- a/litellm/proxy/auth/auth_checks.py
+++ b/litellm/proxy/auth/auth_checks.py
@@ -607,11 +607,17 @@ async def can_key_call_model(
filtered_models += models_in_current_access_groups
verbose_proxy_logger.debug(f"model: {model}; allowed_models: {filtered_models}")
+
+ all_model_access: bool = False
+
if (
- model is not None
- and model not in filtered_models
- and "*" not in filtered_models
+ len(filtered_models) == 0
+ or "*" in filtered_models
+ or "openai/*" in filtered_models
):
+ all_model_access = True
+
+ if model is not None and model not in filtered_models and all_model_access is False:
raise ValueError(
f"API Key not allowed to access model. This token can only access models={valid_token.models}. Tried to access {model}"
)