diff --git a/docs/my-website/docs/proxy/token_auth.md b/docs/my-website/docs/proxy/token_auth.md index db2272c7e..81475951f 100644 --- a/docs/my-website/docs/proxy/token_auth.md +++ b/docs/my-website/docs/proxy/token_auth.md @@ -108,6 +108,34 @@ general_settings: litellm_jwtauth: admin_jwt_scope: "litellm-proxy-admin" ``` + +## Advanced - Spend Tracking (User / Team / Org) + +Set the field in the jwt token, which corresponds to a litellm user / team / org. + +```yaml +general_settings: + master_key: sk-1234 + enable_jwt_auth: True + litellm_jwtauth: + admin_jwt_scope: "litellm-proxy-admin" + team_id_jwt_field: "client_id" # 👈 CAN BE ANY FIELD + user_id_jwt_field: "sub" # 👈 CAN BE ANY FIELD + org_id_jwt_field: "org_id" # 👈 CAN BE ANY FIELD +``` + +Expected JWT: + +``` +{ + "client_id": "my-unique-team", + "sub": "my-unique-user", + "org_id": "my-unique-org" +} +``` + +Now litellm will automatically update the spend for the user/team/org in the db for each call. + ### JWT Scopes Here's what scopes on JWT-Auth tokens look like