#Get tokens used after streaming a ChatCompletion
16 messages · Page 1 of 1 (latest)
Each streamed event is 1 token
So those will be your completion tokens
then for the prompt tokens you can tokenize the prompt using a local tokenizer
GPT itself told me this -- would this work you think?
Anyways I'm trying it out right now
no
I don't think so
and also GPT isn't good at developing for OpenAI APIs
I don't think each chunk returns a total_tokens
I know I just tried lol
if that doesn't work ill just do it myself, like you told me
yep doesn't work, I'll do that
thanks
The request has an overhead as well. If you read the OpenAI Tokenizer example, you will see it uses im_start, im_end, and extra newlines. I only use a single "user" message (no system). The token count I need to add for the prompt part is 7.