#27038 [Bug]: disable_end_user_cost_tracking does not gate SpendLogs.end_user / DailyEndUserSpend writes
## What happened Setting `litellm_settings.disable_end_user_cost_tracking: true` in proxy config does **not** prevent `LiteLLM_SpendLogs.end_user` from being populated, nor prevent rows from being inserted/updated in `LiteLLM_DailyEndUserSpend`.
The flag short-circuits `get_end_user_id_for_cost_tracking()` to return `None`, but `litellm/proxy/spend_tracking/spend_tracking_utils.py:311` immediately re-fills `end_user_id` from the standard logging payload:
https://github.com/BerriAI/litellm/blob/main/litellm/proxy/spend_tracking/spend_tracking_utils.py#L311
```python end_user_id = get_end_user_id_for_cost_tracking(litellm_params) # line 278: returns None when flag is set ... if ( standard_logging_payload is not None ): ... end_user_id = end_user_id or standard_logging_payload["metadata"].get( "user_api_key_end_user_id" ) ```
The `standard_logging_payload` value was populated from auth-time extraction in `auth_utils.get_end_user_id_from_request_body`, so the `or`-fallback defeats the disable flag for the SpendLogs / DailyEndUserSpend code paths. The Prometheus path correctly honors the flag.
Downstream effect (production observation): tens of thousands of…