mirror of
https://github.com/open-webui/pipelines.git
synced 2026-07-20 15:38:19 -04:00
feat: track the cost associated with each user #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @changchiyou on GitHub (Apr 10, 2024).
Is your feature request related to a problem? Please describe.
Currently, it's challenging to track the cost associated with each user.
Describe the solution you'd like
<litellm>/key/generateAPI.LiteLLMmodels using their unique API keys.Describe alternatives you've considered
open-webui(hosted web) account for user and retrieves<litellm>/key/generateapi using the email addressAdditional context
Reference:
@tjbck commented on GitHub (Apr 10, 2024):
Related: open-webui/pipelines#20, we should try to add this feature to the rest of our proxy servers as well.
@max00346 commented on GitHub (May 15, 2024):
This would also solve my Feature-Request: open-webui/open-webui#1320
@krrishdholakia commented on GitHub (May 28, 2024):
@changchiyou do you want to create a key per user?
LiteLLM also allows for tracking by the 'user' param in
/chat/completions-https://docs.litellm.ai/docs/proxy/users
@changchiyou commented on GitHub (May 28, 2024):
@krrishdholakia Does the method you provide, which uses
userinstead of an API key to track users, require additional manual adjustments/settings on the Open WebUI? I observed that Open WebUI does not send out the user parameter by default:https://github.com/open-webui/open-webui/blob/d43ee0fc5b018cec183de99e8047472c454737ae/src/routes/(app)/%2Bpage.svelte#L602-L666
and the logs in LiteLLM show that the
useris alwaysdefault_user_id:@juancarlosm commented on GitHub (May 30, 2024):
same problem here! We are unable to track costs per user:
@juancarlosm commented on GitHub (May 30, 2024):
If it helps, a dirty hack in backend/apps/[openai|litellm]/main.py at proxy function:
_tmp = json.loads(body)
_tmp['user'] = user.email
body = json.dumps(_tmp)
And now I can see the right user at langfuse:
@juancarlosm commented on GitHub (Jun 28, 2024):
https://github.com/open-webui/open-webui/discussions/3494