Repository navigation
docs: document validate_end_user_id_in_db for per-session customer IDs - #1106
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A customer standing up a global end-customer spend cap found their Usage -> Customer Usage page filling with entries like
{"device_id":"4ec41ed1...","account_uuid":"","session_id":"..."}. Claude Code sends that blob inmetadata.user_id, LiteLLM reads that field as a customer ID, so every session becomes its own customer and picks up its own copy of themax_end_user_budget_iddefault budget. A monthly cap on real customers ends up acting as a per-session cap on developer traffic.litellm.validate_end_user_id_in_dbalready fixes this and has since v1.87.0 (BerriAI/litellm#28290), but it appears nowhere in the docs, so there was no way for anyone to find it.What changed
docs/proxy/customers.mdgains a "Restricting Which IDs Become Customers" section covering what the flag accepts and rejects, that a dropped ID is not an error, the cache TTLs, and the pairing withmax_end_user_budget_idthat keeps unregistered real customers capped while JSON-shaped IDs are still dropped. The default budget section now links to it.docs/tutorials/claude_code_customer_tracking.mdgains a short note on why the customer header matters, since without one Claude Code reaches customer tracking on its own.Verified against code
Behavior checked against HEAD of BerriAI/litellm, not from memory:
Extraction order is
get_end_user_id_from_request_bodyinlitellm/proxy/auth/auth_utils.py, the JSON rejection is_coerce_user_id_to_strin the same file, the preserve-for-default-budget branch isresolve_and_validate_end_user_idinlitellm/proxy/auth/auth_checks.py, and the TTLs are_END_USER_VALIDATION_POSITIVE_TTL/_END_USER_VALIDATION_NEGATIVE_TTL.Linear ticket
Resolves LIT-6661