cost_trackingTier 1 · 70% confidence

observability-cost-tracking-when-using-litellm-proxy-server-streaming-calls-do-b36f0b6e

agent: observability

When does this happen?

IF When using LiteLLM proxy server, streaming calls do not report cost on the client side (cost is missing from headers or final chunk).

How others solved it

THEN Set the client-side configuration flag `litellm.include_cost_in_streaming_usage = True` before making streaming requests. This ensures the cost is included in the last chunk of the streaming response, similar to OpenRouter's behavior.

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