From f13be1416f25df83692c6310afaf0f8f2bfe63d0 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 15 Mar 2025 10:25:06 -0700 Subject: [PATCH] docs token auth --- docs/my-website/docs/proxy/token_auth.md | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/my-website/docs/proxy/token_auth.md b/docs/my-website/docs/proxy/token_auth.md index c6d280cb822..04bf5faec59 100644 --- a/docs/my-website/docs/proxy/token_auth.md +++ b/docs/my-website/docs/proxy/token_auth.md @@ -102,7 +102,9 @@ curl --location 'http://0.0.0.0:4000/v1/chat/completions' \ -## Advanced - Set Accepted JWT Scope Names +## Advanced + +### Set Accepted JWT Scope Names Change the string in JWT 'scopes', that litellm evaluates to see if a user has admin access. @@ -114,7 +116,7 @@ general_settings: admin_jwt_scope: "litellm-proxy-admin" ``` -## Tracking End-Users / Internal Users / Team / Org +### Tracking End-Users / Internal Users / Team / Org Set the field in the jwt token, which corresponds to a litellm user / team / org. @@ -156,7 +158,7 @@ scope: ["litellm-proxy-admin",...] scope: "litellm-proxy-admin ..." ``` -## Control model access with Teams +### Control model access with Teams 1. Specify the JWT field that contains the team ids, that the user belongs to. @@ -207,11 +209,11 @@ OIDC Auth for API: [**See Walkthrough**](https://www.loom.com/share/00fe2deab59a - If all checks pass, allow the request -## Advanced - Custom Validate +### Custom JWT Validate Validate a JWT Token using custom logic, if you need an extra way to verify if tokens are valid for LiteLLM Proxy. -### 1. Setup custom validate function +#### 1. Setup custom validate function ```python from typing import Literal @@ -230,7 +232,7 @@ def my_custom_validate(token: str) -> Literal[True]: return True ``` -### 2. Setup config.yaml +#### 2. Setup config.yaml ```yaml general_settings: @@ -243,7 +245,7 @@ general_settings: custom_validate: custom_validate.my_custom_validate # 👈 custom validate function ``` -### 3. Test the flow +#### 3. Test the flow **Expected JWT** @@ -265,7 +267,7 @@ general_settings: -## Advanced - Allowed Routes +### Allowed Routes Configure which routes a JWT can access via the config. @@ -297,7 +299,7 @@ general_settings: team_allowed_routes: ["/v1/chat/completions"] # 👈 Set accepted routes ``` -## Advanced - Caching Public Keys +### Caching Public Keys Control how long public keys are cached for (in seconds). @@ -311,7 +313,7 @@ general_settings: public_key_ttl: 600 # 👈 KEY CHANGE ``` -## Advanced - Custom JWT Field +### Custom JWT Field Set a custom field in which the team_id exists. By default, the 'client_id' field is checked. @@ -330,7 +332,7 @@ general_settings: -## Advanced - Block Teams +### Block Teams To block all requests for a certain team id, use `/team/block` @@ -357,7 +359,7 @@ curl --location 'http://0.0.0.0:4000/team/unblock' \ ``` -## Advanced - Upsert Users + Allowed Email Domains +### Upsert Users + Allowed Email Domains Allow users who belong to a specific email domain, automatic access to the proxy.