Skip to content

docs: document validate_end_user_id_in_db for per-session customer IDs - #1106

Merged
shivamrawat1 merged 2 commits into
mainfrom
litellm_docs_end_user_id_validation
Sep 1, 2026
Merged

shivamrawat1 merged 2 commits into
mainfrom
litellm_docs_end_user_id_validation

Conversation

@shivamrawat1

Copy link
Copy Markdown
Contributor

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 in metadata.user_id, LiteLLM reads that field as a customer ID, so every session becomes its own customer and picks up its own copy of the max_end_user_budget_id default budget. A monthly cap on real customers ends up acting as a per-session cap on developer traffic.

litellm.validate_end_user_id_in_db already 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.md gains 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 with max_end_user_budget_id that 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.md gains 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:

validate_end_user_id_in_db=False -> '{"device_id":"4ec41ed1","account_uuid":"","session_id":"abc"}'
validate_end_user_id_in_db=True  -> None
x-litellm-customer-id header     -> 'acct-123'

Extraction order is get_end_user_id_from_request_body in litellm/proxy/auth/auth_utils.py, the JSON rejection is _coerce_user_id_to_str in the same file, the preserve-for-default-budget branch is resolve_and_validate_end_user_id in litellm/proxy/auth/auth_checks.py, and the TTLs are _END_USER_VALIDATION_POSITIVE_TTL / _END_USER_VALIDATION_NEGATIVE_TTL.

Linear ticket

Resolves LIT-6661

@vercel

vercel Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
litellm Ready Ready Preview Sep 1, 2026 10:26pm UTC

Request Review

@shivamrawat1
shivamrawat1 merged commit d22ff51 into main Sep 1, 2026
3 checks passed
@shivamrawat1
shivamrawat1 deleted the litellm_docs_end_user_id_validation branch September 1, 2026 22:28

This branch was previously deployed

1 inactive deployment
Preview — 26ce784f Deployed Sep 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant