Custom tokenizer depending on provider
Token estimates seems to depends heavily to openai api.
As far as I know, each model provider (openrouter, gemini, openai, …) has it own method to retreive the token counts for each request (for example, openrouter use await fetch("https://openrouter.ai/api/v1/generation?id=$GENERATION_ID", { headers })
Log in to comment and vote
Comments1
Mar 2, 2024
Unfortunately there isn't a reliable way to count the exact token usage.
I think you should check the dashboard of the provider to be sure.