litellm/tests/unit/proxy/utils
mateo-berri de0fcff544 fix(proxy): bill the provider usage on a stream a post_call guardrail blocks mid-stream
A streamed /v1/chat/completions or /v1/completions request that a post_call guardrail cut mid-stream wrote its
failure spend row with 0 tokens and $0, while the same block at the end of the stream billed the provider's usage.
When the proxy cuts a stream before the deferred success dispatch was parked, both the iterator hook and the
per-chunk hook now rebuild the usage and cost from the chunks already streamed (the provider's usage chunk when it
arrived, else a token count) before the failure row is written. /v1/completions on a chat model reaches the inner
stream through TextCompletionStreamWrapper.source_stream
2026-10-30 07:03:46 -07:00
..
helpers refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
prisma_and_spend fix(sso): enforce free user admission without locking out existing users (#48097) 2026-10-23 14:48:29 -07:00
proxy_logging fix(proxy): bill the provider usage on a stream a post_call guardrail blocks mid-stream 2026-10-30 07:03:46 -07:00
__init__.py test(proxy): move utils, agent_endpoints and endpoint tests into tests/unit/proxy (#44006) 2026-10-01 11:06:42 -07:00