# Token counter in stream. Help

**URL:** <https://community.openai.com/t/token-counter-in-stream-help/564788>\
**Category:** API\
**Created:** [December 19, 2023, 1:28pm UTC](https://community.openai.com/t/token-counter-in-stream-help/564788 "2023-12-19T13:28:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AteneaIA](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ateneaia/32/146743_2.png) [@AteneaIA](https://community.openai.com/u/AteneaIA)\
**Post date:** [December 19, 2023, 1:28pm UTC](https://community.openai.com/t/token-counter-in-stream-help/564788/1 "2023-12-19T13:28:37Z")

</div>

I can’t find a way to count the tokens using stream.  
Has anyone achieved it?  
I can’t find a way to carry out a count using this function.

---

<div class="post-metadata">

**Author:** ![AI.LS](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ai.ls/32/123582_2.png) [@AI.LS](https://community.openai.com/u/AI.LS)\
**Post date:** [December 19, 2023, 3:47pm UTC](https://community.openai.com/t/token-counter-in-stream-help/564788/2 "2023-12-19T15:47:38Z")

</div>

I can just count each message’ token and sum them up after the stream ends.

---

<div class="post-metadata">

**Author:** ![AteneaIA](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ateneaia/32/146743_2.png) [@AteneaIA](https://community.openai.com/u/AteneaIA)\
**Post date:** [December 19, 2023, 3:51pm UTC](https://community.openai.com/t/token-counter-in-stream-help/564788/3 "2023-12-19T15:51:27Z")

</div>

The completion chain in this mode does not offer the number of tokens sent, I can count those generated but not those sent.

---

<div class="post-metadata">

**Author:** ![AI.LS](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ai.ls/32/123582_2.png) [@AI.LS](https://community.openai.com/u/AI.LS)\
**Post date:** [December 19, 2023, 4:12pm UTC](https://community.openai.com/t/token-counter-in-stream-help/564788/4 "2023-12-19T16:12:29Z")

</div>

Yeah, we should count both input + output manually.

---

<div class="post-metadata">

**Author:** ![AteneaIA](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ateneaia/32/146743_2.png) [@AteneaIA](https://community.openai.com/u/AteneaIA)\
**Post date:** [December 19, 2023, 4:22pm UTC](https://community.openai.com/t/token-counter-in-stream-help/564788/5 "2023-12-19T16:22:24Z")

</div>

After deleting and returning to the complete answers with the accurate token count, I give up on further attempts and tests.  
There is no way, the consumption that the website reflects is always higher, very very higher.  
I have carried out a thousand tests to rule out compromised equipment, compromised internet lines, I have generated keys in a 100% secure manner and I do not expose them…  
The consumption of API is brutal and uncontrolled, even exceeding the established consumption limits.  
I am desperate and I have not received a response from openai, I have been sending them messages for a week without getting any response.
