How to calculate token usage using stream=True?

It is irrelevant how the count is carried out, the error is when using real-time transmission.
Today, after almost 2 months of testing, the consumption matches on my meter and on the OpenAI website.