Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:BerriAI Litellm Email Alert Types

From Leeroopedia
Attribute Value
Sources enterprise/litellm_enterprise/types/enterprise_callbacks/send_emails.py
Domains Types, Email, Enterprise Callbacks
Last Updated 2026-02-15 16:00 GMT

Overview

This module defines Pydantic models and enums used for email alerting events, settings management, and email parameter configuration across the enterprise email callback system.

Description

The module provides the following types:

Models:

  • EmailParams -- Pydantic model containing common email template parameters: logo_url, support_contact, base_url, recipient_email, subject, and signature.
  • SendKeyCreatedEmailEvent -- Extends WebhookEvent with a virtual_key field for key creation notifications.
  • SendKeyRotatedEmailEvent -- Extends WebhookEvent with virtual_key and optional key_alias for key rotation notifications.
  • EmailEventSettings -- Pairs an EmailEvent with an enabled boolean.
  • EmailEventSettingsUpdateRequest -- Request body containing a list of EmailEventSettings for bulk updates.
  • EmailEventSettingsResponse -- Response body containing a list of EmailEventSettings.
  • DefaultEmailSettings -- Provides default enabled/disabled values for all email events, with helper methods to_dict() and get_defaults().

Enums:

  • EmailEvent -- String enum with values:
    • virtual_key_created = "Virtual Key Created"
    • new_user_invitation = "New User Invitation"
    • virtual_key_rotated = "Virtual Key Rotated"
    • soft_budget_crossed = "Soft Budget Crossed"
    • max_budget_alert = "Max Budget Alert"

Usage

Import these types when working with the email alerting system, email endpoints, or email settings management.

Code Reference

Source Location

enterprise/litellm_enterprise/types/enterprise_callbacks/send_emails.py

Signature

class EmailParams(BaseModel):
    logo_url: str
    support_contact: str
    base_url: str
    recipient_email: str
    subject: str
    signature: str

class SendKeyCreatedEmailEvent(WebhookEvent):
    virtual_key: str

class SendKeyRotatedEmailEvent(WebhookEvent):
    virtual_key: str
    key_alias: Optional[str] = None

class EmailEvent(str, enum.Enum):
    virtual_key_created = "Virtual Key Created"
    new_user_invitation = "New User Invitation"
    virtual_key_rotated = "Virtual Key Rotated"
    soft_budget_crossed = "Soft Budget Crossed"
    max_budget_alert = "Max Budget Alert"

class EmailEventSettings(BaseModel):
    event: EmailEvent
    enabled: bool

class EmailEventSettingsUpdateRequest(BaseModel):
    settings: List[EmailEventSettings]

class EmailEventSettingsResponse(BaseModel):
    settings: List[EmailEventSettings]

class DefaultEmailSettings(BaseModel):
    settings: Dict[EmailEvent, bool] = ...
    def to_dict(self) -> Dict[str, bool]: ...
    @classmethod
    def get_defaults(cls) -> Dict[str, bool]: ...

Import

from litellm_enterprise.types.enterprise_callbacks.send_emails import (
    EmailEvent,
    EmailParams,
    SendKeyCreatedEmailEvent,
    SendKeyRotatedEmailEvent,
    EmailEventSettings,
    EmailEventSettingsUpdateRequest,
    EmailEventSettingsResponse,
    DefaultEmailSettings,
)

I/O Contract

Inputs

Type Fields Description
EmailParams logo_url, support_contact, base_url, recipient_email, subject, signature Parameters for rendering email templates.
SendKeyCreatedEmailEvent Inherits WebhookEvent + virtual_key: str Event data for key creation emails.
SendKeyRotatedEmailEvent Inherits WebhookEvent + virtual_key: str, key_alias: Optional[str] Event data for key rotation emails.

Outputs

Type Description
DefaultEmailSettings.get_defaults() Returns Dict[str, bool] with all events enabled by default.

Usage Examples

from litellm_enterprise.types.enterprise_callbacks.send_emails import (
    EmailEvent, DefaultEmailSettings, EmailEventSettings
)

# Get default settings
defaults = DefaultEmailSettings.get_defaults()
# {'Virtual Key Created': True, 'New User Invitation': True, ...}

# Create an event setting
setting = EmailEventSettings(
    event=EmailEvent.virtual_key_created,
    enabled=False,
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment