docs token auth

This commit is contained in:
Ishaan Jaff 2025-03-15 10:25:06 -07:00
parent b8996283a3
commit f13be1416f

View file

@ -102,7 +102,9 @@ curl --location 'http://0.0.0.0:4000/v1/chat/completions' \
</TabItem>
</Tabs>
## 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.