Open AI Assistants : how to get the token count?

This adds up with my testing, the token reporting of the API seems unconsistent at the moment.

What I imagine is that it is couting some output tokens as context tokens again and that makes the difference between what the API sees and the back end reports. It is also possible that they even yse different calculations.

At the moment, it seems more of a guide than a definite cost estimation. Nonetheless, you can at least use this information on your project, and estimate that the context cost could be up to 20% higher than the token count returned fomr the API.

If you provide details of timestamps (when you made your requests) it is possible that someone fmor OpenAI can add that information to the issue report and help fix it, as I imagine this is an issue already known to them.

In any case, best of luck! and sorry that there isn’t a perfect answer atm.

1 Like