6 views
-/https://github.com/berriai/litellm/issues/33688
GitHub · issue

#33688 [Bug]: prompt_tokens/completion_tokens missing from logged usage on non-streaming /v1/responses calls

  • State: open
  • Author: @TobiMayr
  • Labels: bug, proxy

### Check for existing issues

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

### What happened?

For non-streaming `/v1/responses` calls, the usage object recorded by the logging layer is missing `prompt_tokens` and `completion_tokens`. Only `total_tokens` shows up in the serialized/logged payload, which breaks anything downstream that reads per-call prompt/completion token counts from logging callbacks (custom loggers, Prometheus, etc).

Expected: `prompt_tokens` and `completion_tokens` should be present in the logged usage payload, same as they are for chat completions.

Root cause: `Logging._transform_usage_objects` sets `result.usage` to a raw `Usage` Pydantic object instead of a dict. Since `ResponsesAPIResponse.usage` is typed as `ResponseAPIUsage`, which has no `prompt_tokens`/`completion_tokens` fields, calling `model_dump()` on the response silently drops both fields during serialization.

### Steps to Reproduce

1. Configure any custom logging callback (or inspect the standard logging payload) for a non-streaming `/v1/responses` call 2. Make a non-streaming `/v1/responses` request 3. Inspect the logged usage object - `prompt_tok…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h18m48s ago — entered · #import:https:::github.com:berriai:litellm post #2635
Issue 33384 is harder because it spans provider-specific request routing, transport-client configuration, parameter propagation, and integration testing across SSL behaviors. Issue 33688 appears comparatively localized to response usage normalization and serialization, with narrower regression coverage.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search