Skip to content

Conversation

mhdawson
Copy link
Contributor

@mhdawson mhdawson commented Sep 26, 2025

What does this PR do?

Refs: #3420

When telemetry is enabled the router uncondionally expects the usage attribute to be availble and fails if it is not present.

Usage is not currently being requested by litellm_openai_mixin.py for streaming requests when using the responses API which means that providers like vertexai fail if telemetry is enabled and streaming is used.

This is part of the required fix. Other part is in liteLLM, will plan to submit PR for that soon.

Test Plan

I applied this change along with the change for litellm in a llama stack deployment and validated that I could make streaming requests through the responses API to a gemini model and they would succeed instead of failing due to the missing usage attribute when telemetry is enabled.

Refs: llamastack#3420

When telemetry is enabled the router uncondionally expects the
usage attribute to be availble and fails if it is not present.

Telemetry is not currently being requested by litellm_openai_mixin.py
for streaming requests which means that providers like vertexai
fail if telemetry is enabled and streaming is used.

This is part of the required fix. Other part is in litell, will
plan to submit PR for that soon.

Signed-off-by: Michael Dawson <[email protected]>
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 26, 2025
mhdawson added a commit to mhdawson/litellm that referenced this pull request Sep 26, 2025
Refs: llamastack/llama-stack#3571

Llama stack unconditionally expects usage information when
using Responses API and streaming when telemetry is enabled.
For full details see llamastack/llama-stack#3571.

Debugging that issue revealed that LiteLLM does not honour a
request for usage when streaming and using the vertex api. This
PR adds that reporting using the same function as used elsewhere.

Signed-off-by: Michael Dawson <[email protected]>
Copy link
Contributor

@ashwinb ashwinb left a comment

Choose a reason for hiding this comment

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

seems reasonable to me. @ehhuang please take a look once.

Copy link
Contributor

@cdoern cdoern left a comment

Choose a reason for hiding this comment

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

nice. thank you

@ehhuang
Copy link
Contributor

ehhuang commented Sep 29, 2025

LG

@ehhuang ehhuang merged commit ddf3f17 into llamastack:main Sep 29, 2025
23 checks passed
@mhdawson
Copy link
Contributor Author

For reference here is the PR in liteLLM - BerriAI/litellm#14961

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants