Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Integrating user information generated by LiteLLM with Langfuse #7238

Open
vrvrv opened this issue Dec 15, 2024 · 2 comments
Open
Labels
enhancement New feature or request feb 2025 help wanted Extra attention is needed langfuse

Comments

@vrvrv
Copy link

vrvrv commented Dec 15, 2024

The Feature

I would like to propose a feature where, when a request is made to LiteLLM using a user API token issued by LiteLLM, the user ID associated with that token is automatically logged. Additionally, it would be beneficial if this information could be automatically logged in Langfuse to identify which user created the trace.
This integration will allow the automatic inclusion of user_id in the logging process when requests are sent to Langfuse using the issued tokens. This ensures that Langfuse can accurately track and differentiate request volumes on a per-user basis.

Motivation, pitch

I need accurately log and analyze user-specific spend and token usage in Langfuse. Currently, without the trace_user_id being included in metadata manually, it is challenging to distinguish between requests made by different users, which limits the ability to perform user-specific analytics and reporting (when user misses including metadata)

By enforcing the integration of user information from LiteLLM into Langfuse, we can ensure that each request is associated with the correct userID. This feature is crucial for projects that require detailed user activity tracking and analysis, such as those involving personalized services or usage-based billing.

This proposal addresses the problem of insufficient user-specific logging and enhances the overall functionality and utility of both LiteLLM and Langfuse systems.

Are you a ML Ops Team?

No

@vrvrv vrvrv added the enhancement New feature or request label Dec 15, 2024
@ishaan-jaff ishaan-jaff added help wanted Extra attention is needed feb 2025 langfuse labels Feb 7, 2025
@ishaan-jaff
Copy link
Contributor

  • what information do you want to see ?
  • should litellm auto add this based on the virtual key used ?
  • Ideally can you write out all fields you want litellm to fill in ?

@krrishdholakia
Copy link
Contributor

using a user API token issued by LiteLLM, the user ID associated with that token is automatically logged

Hey @vrvrv this is already done - https://docs.litellm.ai/docs/proxy/logging_spec#standardlogginguserapikeymetadata

see: user_api_key_user_id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feb 2025 help wanted Extra attention is needed langfuse
Projects
None yet
Development

No branches or pull requests

3 participants