Replies: 1 comment 2 replies
-
Token values are estimates and will never be 100% accurate and lean conservative, as you have found.
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I'm running LibreChat in Docker, version is 0.7.8.
I'm running LibreChat in a corporate environment with monthly AI budget around 5k$. As it's pretty big number, I was curious to make up a per-user cost allocation, and I discovered a huge mismatch between what AI vendors display in their billing panels and what is stored in LibreChat's database.
As per these docs, and Danny's explanation here, I see that I should simply divide
tokenValue
by 1000000 to get amount of $$ spent on certain transaction.So, for testing purposes, I came up with a simple MongoDB aggregation presented below:
This aggregation gave me
5786033683
tokenValue, which translates to roughly 5786$ after applying this value to Danny's formula. However, my OpenAI and Google Cloud Platform dashboards shows 4165$ and 28$ (respectively) expenditures in May, which is almost 1500$ off of what is calculated based on values in the database. (GCP value might seem strange, but this is a true story - in our company Google's models are not used very often)After some research I've found out that raw tokens numbers stored in LibreChat's database sometimes are different from what OpenAI's Tokenizer provides. For example, I've prompted OpenAI's GPT-4o with such message:
Which was translated to 13 tokens, as per my LibreChat's "messages" and "transactions" collections. However, OpenAI's Tokenizer translated this into just 6 tokens.
So, my question is - what am I doing wrong? I suppose, there might be some more complicated logic or I'm doing math with wrong values, but I don't know where to look. Any assistance is appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions