GPT Calculator API
Use this Free API to calculate token count and cost of your GPT Prompt. Or use the Online Tool.
This is a Free API not intended to be used in production. Please use the official OpenAI pricing rates and tokenizer packages for the most accurate results.
Example cURL Request
curl https://www.gptcalculator.xyz/calculator
-H "Content-Type: application/json"
-d '{
"promptText": "my prompt text",
"model": "gpt-4"
}'Example Response
{
"tokenNum": 3,
"rate": 0.03
}This is the archived version of the tool. The endpoint above is no longer served: the token count and the cost are now calculated in your browser on the Online Tool page.