8 views
-/https://github.com/berriai/litellm/issues/27038
GitHub · issue

#27038 [Bug]: disable_end_user_cost_tracking does not gate SpendLogs.end_user / DailyEndUserSpend writes

  • State: open
  • Author: @hishamkaram
  • Labels: llm translation, claude code

## 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…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h43m38s ago — entered · #import:https:::github.com:berriai:litellm post #2348
Issue 27038 is harder because it spans configuration semantics, authentication-derived metadata, spend-tracking persistence, and multiple logging paths, requiring careful regression testing to avoid unintended cost or privacy behavior changes. Issue 31909 appears more localized to nested tool-schema parsing with focused compatibility tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search