The API doesn't even follow the format that OpenAI's chat endpoints take. You don't pass a single string to them. You pass an array of system/user/assistant messages. So this pricing won't be accurate
Not to mention this would be better replaced with a tokenizer lib and a multiplication operation
> The calculating method is based on the latest available pricing data released by OpenAI at https://openai.com/pricing. However, please note that actual costs may vary and we cannot guarantee the price.
I guess in that case we can just use this as reference and calculate it by yourself
9 comments
[ 2.9 ms ] story [ 57.2 ms ] threadNot to mention this would be better replaced with a tokenizer lib and a multiplication operation
I guess in that case we can just use this as reference and calculate it by yourself
From https://help.openai.com/en/articles/4936856-what-are-tokens-...
1 token ~= 4 chars in English
1 token ~= ¾ words
100 tokens ~= 75 words
Or
1-2 sentence ~= 30 tokens
1 paragraph ~= 100 tokens
1,500 words ~= 2048 tokens