Skip to main content

Email Notifications

LiteLLM Email Notifications

Overviewโ€‹

Send LiteLLM Proxy users emails for specific events.

CategoryDetails
Supported Eventsโ€ข User added as a user on LiteLLM Proxy
โ€ข Proxy API Key created for user
โ€ข Proxy API Key rotated for user
Supported Email Integrationsโ€ข Resend API
โ€ข SMTP

Usageโ€‹

info

LiteLLM Cloud: This feature is enabled for all LiteLLM Cloud users, there's no need to configure anything.

1. Configure email integrationโ€‹

Get SMTP credentials to set this up

proxy_config.yaml
litellm_settings:
callbacks: ["smtp_email"]

Add the following to your proxy env

SMTP_HOST="smtp.resend.com"
SMTP_TLS="True"
SMTP_PORT="587"
SMTP_USERNAME="resend"
SMTP_SENDER_EMAIL="notifications@alerts.litellm.ai"
SMTP_PASSWORD="xxxxx"

2. Create a new userโ€‹

On the LiteLLM Proxy UI, go to users > create a new user.

After creating a new user, they will receive an email invite a the email you specified when creating the user.

Email Templatesโ€‹

1. User added as a user on LiteLLM Proxyโ€‹

This email is send when you create a new user on LiteLLM Proxy.

How to trigger this event

On the LiteLLM Proxy UI, go to Users > Create User > Enter the user's email address > Create User.

2. Proxy API Key created for userโ€‹

This email is sent when you create a new API key for a user on LiteLLM Proxy.

How to trigger this event

On the LiteLLM Proxy UI, go to Virtual Keys > Create API Key > Select User ID

On the Create Key Modal, Select Advanced Settings > Set Send Email to True.

3. Proxy API Key Rotated for Userโ€‹

This email is sent when you rotate an API key for a user on LiteLLM Proxy.

How to trigger this event

On the LiteLLM Proxy UI, go to Virtual Keys > Click on a key > Click "Regenerate Key"

info

Ensure there is a user_id attached to the key. This would have been set when creating the key.

After regenerating the key, the user will receive an email notification with:

  • Security-focused messaging about the rotation
  • The new API key (or a placeholder if EMAIL_INCLUDE_API_KEY=false)
  • Instructions to update their applications
  • Security best practices

Email Customizationโ€‹

info

Customizing Email Branding is an Enterprise Feature Get in touch with us for a Free Trial

LiteLLM allows you to customize various aspects of your email notifications. Below is a complete reference of all customizable fields:

FieldEnvironment VariableTypeDefault ValueExampleDescription
Logo URLEMAIL_LOGO_URLstringLiteLLM logo"https://your-company.com/logo.png"Public URL to your company logo
Support ContactEMAIL_SUPPORT_CONTACTstringsupport@berri.ai"support@your-company.com"Email address for user support
Email SignatureEMAIL_SIGNATUREstring (HTML)Standard LiteLLM footer"<p>Best regards,<br/>Your Team</p><p><a href='https://your-company.com'>Visit us</a></p>"HTML-formatted footer for all emails
Invitation SubjectEMAIL_SUBJECT_INVITATIONstring"LiteLLM: New User Invitation""Welcome to Your Company!"Subject line for invitation emails
Key Creation SubjectEMAIL_SUBJECT_KEY_CREATEDstring"LiteLLM: API Key Created""Your New API Key is Ready"Subject line for key creation emails
Key Rotation SubjectEMAIL_SUBJECT_KEY_ROTATEDstring"LiteLLM: API Key Rotated""Your API Key Has Been Rotated"Subject line for key rotation emails
Include API KeyEMAIL_INCLUDE_API_KEYbooleantrue"false"Whether to include the actual API key in emails (set to false for enhanced security)
Proxy Base URLPROXY_BASE_URLstringhttp://0.0.0.0:4000"https://proxy.your-company.com"Base URL for the LiteLLM Proxy (used in email links)

HTML Support in Email Signatureโ€‹

The EMAIL_SIGNATURE field supports HTML formatting for rich, branded email footers. Here's an example of what you can include:

<p>Best regards,<br/>The LiteLLM Team</p>
<p>
<a href='https://docs.litellm.ai'>Documentation</a> |
<a href='https://github.com/BerriAI/litellm'>GitHub</a>
</p>
<p style='font-size: 12px; color: #666;'>
This is an automated message from LiteLLM Proxy
</p>

Supported HTML features:

  • Text formatting (bold, italic, etc.)
  • Line breaks (<br/>)
  • Links (<a href='...'>)
  • Paragraphs (<p>)
  • Basic inline styling
  • Company information and social media links
  • Legal disclaimers or terms of service links

Environment Variablesโ€‹

You can customize the following aspects of emails through environment variables:

# Email Branding
EMAIL_LOGO_URL="https://your-company.com/logo.png" # Custom logo URL
EMAIL_SUPPORT_CONTACT="support@your-company.com" # Support contact email
EMAIL_SIGNATURE="<p>Best regards,<br/>Your Company Team</p><p><a href='https://your-company.com'>Visit our website</a></p>" # Custom HTML footer/signature

# Email Subject Lines
EMAIL_SUBJECT_INVITATION="Welcome to Your Company!" # Subject for invitation emails
EMAIL_SUBJECT_KEY_CREATED="Your API Key is Ready" # Subject for key creation emails
EMAIL_SUBJECT_KEY_ROTATED="Your API Key Has Been Rotated" # Subject for key rotation emails

# Security Settings
EMAIL_INCLUDE_API_KEY="false" # Set to false to hide API keys in emails (default: true)

# Proxy Configuration
PROXY_BASE_URL="https://proxy.your-company.com" # Base URL for the LiteLLM Proxy (used in email links)

Security: Hiding API Keys in Emailsโ€‹

For enhanced security, you can configure LiteLLM to not include actual API keys in email notifications. This is useful when:

  • You want to reduce the risk of key exposure via email interception
  • Your security policy requires keys to only be retrieved from the secure dashboard
  • You're concerned about email forwarding or storage security

When disabled, emails will show: [Key hidden for security - retrieve from dashboard] instead of the actual API key.

Configuration:

# Hide API keys in emails (enhanced security)
EMAIL_INCLUDE_API_KEY="false"

# Include API keys in emails (default behavior)
EMAIL_INCLUDE_API_KEY="true" # or omit this variable

Behavior:

SettingKey Created EmailKey Rotated Email
true (default)Shows actual sk-xxxxx keyShows actual sk-xxxxx key
falseShows placeholder messageShows placeholder message

Users can always retrieve their keys from the LiteLLM Proxy dashboard.

HTML Support in Email Signatureโ€‹

The EMAIL_SIGNATURE environment variable supports HTML formatting, allowing you to create rich, branded email footers. You can include:

  • Text formatting (bold, italic, etc.)
  • Line breaks using <br/>
  • Links using <a href='...'>
  • Paragraphs using <p>
  • Company information and social media links
  • Legal disclaimers or terms of service links

Example HTML signature:

<p>Best regards,<br/>The LiteLLM Team</p>
<p>
<a href='https://docs.litellm.ai'>Documentation</a> |
<a href='https://github.com/BerriAI/litellm'>GitHub</a>
</p>
<p style='font-size: 12px; color: #666;'>
This is an automated message from LiteLLM Proxy
</p>

Default Templatesโ€‹

If environment variables are not set, LiteLLM will use default templates:

  • Default logo: LiteLLM logo
  • Default support contact: support@berri.ai
  • Default signature: Standard LiteLLM footer
  • Default subjects: "LiteLLM: {event_message}" (replaced with actual event message)

Template Variablesโ€‹

When setting custom email subjects, you can use template variables that will be replaced with actual values:

# Examples of template variable usage
EMAIL_SUBJECT_INVITATION="Welcome to \{company_name\}!"
EMAIL_SUBJECT_KEY_CREATED="Your \{company_name\} API Key"

The system will automatically replace \{event_message\} and other template variables with their actual values when sending emails.

FAQโ€‹

The PROXY_BASE_URL environment variable is used to construct email links. If you are using the LiteLLM Proxy in a local environment, you will see "http://0.0.0.0:4000" in the email links.

If you are using the LiteLLM Proxy in a production environment, you will see the actual base URL of the LiteLLM Proxy.

You can set the PROXY_BASE_URL environment variable to the actual base URL of the LiteLLM Proxy.

PROXY_BASE_URL="https://proxy.your-company.com"