How to display total API key usage – APIs


Hey guys, so in bubble when using the OpenAI API, there is a way to show the token usage for a single message but I want to show the total usage of all the messages (similar to what can be seen when looking at the usage on OpenAI).

I understand that I need to get the tokens when I generate the message from the API and then add that to a data field and just keep adding the tokens up but I cant seem to get it quite right.

Any help would be much appreciated!!



Source link

Leave a Comment