mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
docs(ui.md): add docs on self serve ui flow
This commit is contained in:
parent
9cb5a2bec0
commit
95f850fecc
5 changed files with 63 additions and 6 deletions
|
@ -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
|
||||
|
||||
<Image img={require('../../img/admin_dashboard.png')} />
|
||||
|
||||
## What users will see?
|
||||
|
||||
### Auth
|
||||
|
||||
<Image img={require('../../img/user_auth_screen.png')} />
|
||||
|
||||
### Create Keys
|
||||
|
||||
<Image img={require('../../img/user_create_key_screen.png')} />
|
BIN
docs/my-website/img/admin_dashboard.png
Normal file
BIN
docs/my-website/img/admin_dashboard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 73 KiB |
BIN
docs/my-website/img/user_auth_screen.png
Normal file
BIN
docs/my-website/img/user_auth_screen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 81 KiB |
BIN
docs/my-website/img/user_create_key_screen.png
Normal file
BIN
docs/my-website/img/user_create_key_screen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 KiB |
|
@ -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}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue