Add User ID validation to ensure it is not an email or phone number
Title
Add validation to exclude invalid user_id (e.g. email or phone number) from Anthropic metadata
Relevant issues
Fixes #10106
Type
🐛 Bug Fix
Changes
This PR introduces a validation check for the user_id field in the _litellm_metadata dictionary to ensure it does not contain personally identifiable information (PII) such as emails or phone numbers.
Rationale
Anthropic requires that the user_id in metadata must be a UUID, hash value, or other opaque, non-identifying identifier. It must not contain any personally identifiable information such as names, email addresses, or phone numbers. Including such data can lead to the API rejecting the request with a 400 Bad Request error. View
This update ensures that if an invalid user_id is provided (e.g. an email), it will simply be excluded from the metadata, preventing avoidable request failures.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| litellm | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 17, 2025 1:06pm |
@krrishdholakia its blocking us, did you have a chance to take a look?
Hey @krrishdholakia this is also blocking us. Is there any progress here?
Running into the same issue. Didn't realize there is already a fix out since a couple of months...
Sorry for the delay, missed this PR - merged!