About OpenAI API Cost Tracker

This tool is an open-source project designed by Ke Fang to track your daily OpenAI API usage and expenses. It provides an overview of how various OpenAI models, such as ChatGPT, GPT-4, Whisper, and text-embedding models, are contributing to the overall cost.


  1. Hourly Breakdown: Shows the usage of all cost-incurring models from the previous day on an hourly basis. This granular detail allows you to pinpoint unusual spikes in usage.
    OpenAI API cost bar chart

    Bar chart showing hourly breakdown of OpenAI API usage.

  2. Visual Representation: Choose between a bar chart or a pie chart to visualize the data. The bar chart provides a time-wise breakdown, while the pie chart offers a proportional view of the costs.
    OpenAI API cost pie chart

    Pie chart showing the cost proportion of each OpenAI model.

  3. Privacy and Security: The API Key is stored locally in localStorage. Since the tool is open-sourced and free, you can trust that your information remains secure.

How to Use

  1. Enter your OpenAI API key into the input field.
  2. Set the key and view your API usage statistics.
  3. You can switch between a bar chart and a pie chart using the toggle above the chart.
  4. You can select the time granularity and navigate between different days using the controls above the chart.

The Inspiration Behind the Tool

Designed out of personal need, this tool was created by Ke Fang to assist other developers and AI enthusiasts who found it challenging to track the expenses of various OpenAI models. The daily bill from OpenAI did not display the respective proportions of different models, leading to confusion. This tool simplifies that process, providing a clear view of what's consuming resources, enabling better budgeting and understanding of the OpenAI API usage.


Being an open-source project, contributions are welcome! You can view the source code on GitHub and make a pull request or open an issue if you have any suggestions or find any bugs.

Back to main page