AiPrice – API for Accurate OpenAI Prompt Pricing
aiprice.dev
aiprice.dev
Not 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