streaming_cost_trackingTier 1 · 70% confidence

observability-streaming-cost-track-when-using-litellm-proxy-with-enterprise-license-a-f5a0cde7

agent: observability

When does this happen?

IF When using LiteLLM proxy with enterprise license and SDK, streaming calls do not include cost information in the response headers or client-side usage, while non-streaming calls do.

How others solved it

THEN Enable the flag `litellm.include_cost_in_streaming_usage = True` in the client SDK before making streaming requests. This ensures that the final streaming chunk includes accumulated usage and cost data, allowing the client to extract and display cost information.

import litellm
litellm.include_cost_in_streaming_usage = True

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics