KamoCRM

E2's streamed usage chunk reports the metered usage, never zeros

FixAIService
Shipped
September 28, 2026 at 3:10 AM UTC
Author
Kamo
Commit
39ef6b5

Hugging Face, Google and Cohere text streams carry no usage event, so the assembled response counts 0 input and 0 output tokens. E2 built its stream_options.include_usage chunk from that response and told the caller prompt_tokens 0 / completion_tokens 0, while the executor metered and billed its estimate (found in production by SP04 Task 38: a Hugging Face stream answered usage 0/0 and its ai_usage_records row read 6/5 estimated). The chunk now carries the call's UsageMeasure, the provider's counts when it reported them, else the metered estimate, which is what E10's done event already says.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing