Skip to content

Conversation

georg-wolflein
Copy link
Contributor

@georg-wolflein georg-wolflein commented Oct 2, 2025

Title

Fix end user cost tracking in the responses API

Relevant issues

Fixes #13860

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Screenshot of tests passing locally:
image

Type

🐛 Bug Fix
✅ Test

Changes

See #13860: cost tracking for end users didn't work for the responses API (but it did work for completions API) because the end user ID was set in the litellm_metadata field, not in the metadata field.

This PR checks both fields using the already existing get_litellm_metadata_from_kwargs helper function.

Copy link

vercel bot commented Oct 2, 2025

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

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Oct 2, 2025 10:30am

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2025

CLA assistant check
All committers have signed the CLA.

@georg-wolflein georg-wolflein changed the title Fix end user cost tracking in the responses API [Fix] Proxy: end user cost tracking in the responses API Oct 2, 2025
Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ishaan-jaff ishaan-jaff merged commit dbfa8ec into BerriAI:main Oct 2, 2025
6 of 7 checks passed
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.

[Bug]: Responses API does not track customer spend when provided with user property
3 participants