Token calculation question when using GPT API stream

hello

I have a question about gpt api token calculation.

If I do not use stream, the number of tokens used is automatically displayed.

When using stream, the number of tokens used does not appear to be displayed.

Am I perhaps missing something?

Is any additional processing required?

thank you

Hi!

No, you’re not missing anything. With streaming mode, you have to compute the tokens yourself, but you can just use tiktoken

3 Likes

oh, i see

Thank you for good information.
:grinning: :grinning: :grinning: :grinning: :grinning: :grinning:

1 Like