litellm
litellm copied to clipboard
[Feature]: Automatically end_user creation
The Feature
It would be super nice if LiteLLM could automatically add end-users to the database (EndUserTable) every time a request having a 'user' param is received and the user is not in LiteLLM_EndUserTable table:
INSERT INTO public."LiteLLM_EndUserTable" (user_id, blocked)
SELECT '[email protected]', false
WHERE NOT EXISTS (
SELECT 1
FROM public."LiteLLM_EndUserTable"
WHERE user_id = '[email protected]'
);
This way the UI tab (Usage --> Customer Usage) would automatically show to end_user spend log.
We can make it an optional feature via env var, something like: AUTO_CREATE_END_USERS """
Motivation, pitch
The UI tab (Usage --> Customer Usage) would automatically show to end_user spend log. Since there is no API endpoint to query a spend by 'end_user', this could be valuable.
Twitter / LinkedIn details
No response