Token Cost Calculator for OpenAI models (gpt-3.5 & gpt-4)

I’m very happy to share my first streamlit app:
Token Cost Calculator

Ever wondered:

  • how much your chatGPT query would actually cost?
  • how the costs of a query are split up and where to optimize first?
  • how many queries you could do with 100$
  • what the costs would be if you do 20.000 classifications with a Language Model?

I present to the community a simple token cost calculator for OpenAI models.
Just select a model in the sidebar / menu … enter your prompt, any additional context and your expected output and the app will show you the costs for 1 query.

You don’t need an OpenAI Key. Simply start by coping parts of existing queries you have into the corresponding fields.

If you activate “Detail Mode” in the sidepanel/menu it also gives you the option to:

  • see what are the costs assigned to each part of your query
  • see the cost distribution in percent
  • see the encodings of your input
  • see how many queries you could do with 100$
  • see how much it would cost to do 500 or even 100.000 queries
  • freely adjust the amount of Prompt, Input and Output tokens

I created the app to learn some streamlit basics and also to have a handy little tool to give our prospects a better feeling on how much there queries would actually cost and where these costs are coming from (Prompt vs Input vs Output). Especially when doing lots of queries.

I hope you also like it.
Any feedback is highly welcome.

Greetings from Vienna, Austria!