A "user" of this function needed to subscribe to rapidapi to use it, but 100 calls per day are for free.
In practice the method signature of a rapidapi-gpt-token-count-fn would then taken the users API key as input and then simply make an http call :
curl --request POST \
--url https://openai-gpt-pricing-calculator.p.rapidapi.com/chat \
--header 'X-RapidAPI-Host: openai-gpt-pricing-calculator.p.rapidapi.com' \
--header 'X-RapidAPI-Key: <<users key>>> \
--header 'content-type: application/json' \
--data '{
"model": "gpt-3.5-turbo",
"content": "Hey there. How are you doing today? Answer with a Steve Jobs style."
}'
As there is no JVM code for GPT token ccount, I was wondering if we could not add an
token-count-fn
which uses a "hosted token count function". I found one here: https://rapidapi.com/galim-galim-default/api/openai-gpt-pricing-calculatorA "user" of this function needed to subscribe to rapidapi to use it, but 100 calls per day are for free. In practice the method signature of a
rapidapi-gpt-token-count-fn
would then taken the users API key as input and then simply make an http call :which returns the number of tokens.
What do you think ?