7 views
-/https://github.com/berriai/litellm/issues/33663
GitHub · issue

#33663 [Bug]: spend_logs_metadata set on an organization is silently ignored (only key and team levels are merged)

  • State: open
  • Author: @marty-sullivan
  • Labels: proxy

### Note on root cause

The behavior below is verified three ways: by reading the merge code, by executing the real proxy merge path (`add_litellm_data_to_request`) in-process against constructed key/team/org auth objects, and by reproducing it end to end against a running proxy, including a full precedence matrix read back from `/spend/logs/v2`. The organization-level drop is not inferred

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate

Closest items found, all distinct from this one: - #29054 and #26149 concern preserving the request-level `x-litellm-spend-logs-metadata` header on `/v1/messages` and pass-through routes; they are about the request path, not organization-level collection - #31784 (merged) exposes `project_alias` in Prometheus custom labels; it touches the org/project/team/key hierarchy but not `spend_logs_metadata` merging - #31867 / #31875 concern tags and `session_id` forwarding in cascaded-proxy topology, a different field and code path

### What happened?

`spend_logs_metadata` is collected and merged from the request, the API key, and the team, but not from the organization, even though `or…

GitHub resolver

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

Refresh page
vote history (4 events)
#0 of 0 · 31d19h9m25s ago — entered · #import:https:::github.com:berriai:litellm post #1716
Requires broader control-flow changes, per-item error-state handling, and end-to-end regression coverage; the other primarily needs a targeted hierarchy merge correction and precedence tests.
Organization-level metadata merging requires changes to proxy hierarchy logic, precedence behavior, and regression coverage across request, key, team, and organization paths; the pricing issue is primarily a bounded data update with validation.
The left issue is harder because it involves failure-path streaming state, incremental usage accounting, and preserving correctness across fallback transitions, which requires more extensive regression testing. The right issue is comparatively localized to hierarchical metadata merging and precedence coverage.
#0 of 0 · 31d18h36s ago — current · #import:https:::github.com:berriai:litellm post #2844
The harder task requires tracing and correcting shared proxy metadata-merging behavior across hierarchical authorization levels, then validating precedence and regression coverage. The easier task is a relatively contained provider adapter using an existing compatibility pattern and reference implementation.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search