diff --git a/docs/my-website/docs/proxy/ui.md b/docs/my-website/docs/proxy/ui.md index 1cac1fb23..6f3f3bb61 100644 --- a/docs/my-website/docs/proxy/ui.md +++ b/docs/my-website/docs/proxy/ui.md @@ -1,3 +1,5 @@ +import Image from '@theme/IdealImage'; + # [BETA] Self-serve UI Allow your users to create their own keys through a UI @@ -8,4 +10,54 @@ This is in beta, so things may change. If you have feedback, [let us know](https ::: +## Quick Start +Requirements: + +- Need to a [Resend](https://resend.com/) account for sending emails + +[**See code**](https://github.com/BerriAI/litellm/blob/61cd800b9ffbb02c286481d2056b65c7fb5447bf/litellm/proxy/proxy_server.py#L1782) + +### Step 1. Save Resend keys + +```env +export RESEND_API_KEY="my-resend-api-key" +export RESEND_API_EMAIL="my-resend-sending-email" # e.g. krrish@berri.ai +``` + +### Step 2. Enable user auth + +In your config.yaml, + +```yaml +general_settings: + # other changes + allow_user_auth: true +``` + +This will enable: +* Users to create keys via `/key/generate` (by default, only admin can create keys) +* The `/user/auth` endpoint to send user's emails with their login credentials (key + user id) + +### Step 3. Connect to UI + +You can use our hosted UI (https://dashboard.litellm.ai/) or [self-host your own](https://github.com/BerriAI/litellm/tree/main/ui). + +If you self-host, you need to save the UI url in your proxy environment as `LITELLM_HOSTED_UI`. + +Connect your proxy to your UI, by entering: +1. The hosted proxy URL +2. Accepted email subdomains +3. [OPTIONAL] Allowed admin emails + + + +## What users will see? + +### Auth + + + +### Create Keys + + \ No newline at end of file diff --git a/docs/my-website/img/admin_dashboard.png b/docs/my-website/img/admin_dashboard.png new file mode 100644 index 000000000..0d935a322 Binary files /dev/null and b/docs/my-website/img/admin_dashboard.png differ diff --git a/docs/my-website/img/user_auth_screen.png b/docs/my-website/img/user_auth_screen.png new file mode 100644 index 000000000..48fef02a5 Binary files /dev/null and b/docs/my-website/img/user_auth_screen.png differ diff --git a/docs/my-website/img/user_create_key_screen.png b/docs/my-website/img/user_create_key_screen.png new file mode 100644 index 000000000..fcba4ae2b Binary files /dev/null and b/docs/my-website/img/user_create_key_screen.png differ diff --git a/ui/pages/user.py b/ui/pages/user.py index 666458301..da203ea6e 100644 --- a/ui/pages/user.py +++ b/ui/pages/user.py @@ -76,12 +76,17 @@ def auth_page(page_param: str): else: post_endpoint = f"{decoded_params['proxy_url']}/user/auth" - try: - assert email.split("@")[1] in decoded_params["accepted_email_subdomain"] - except: - raise Exception( - f"Only emails from {decoded_params['accepted_email_subdomain']} are allowed" - ) + if ( + decoded_params["accepted_email_subdomain"] == "*" + ): # if user wants to allow all emails + pass + else: + try: + assert email.split("@")[1] in decoded_params["accepted_email_subdomain"] + except: + raise Exception( + f"Only emails from {decoded_params['accepted_email_subdomain']} are allowed" + ) response = requests.post( post_endpoint, json={"user_email": email, "page": page_param} )