openai_pricing_logger is a Python package that logs OpenAI API costs and timestamps. It's designed to help you keep track of API usage and related costs, providing an easy way to monitor and analyze the expenses.
- Automatically logs API call costs and timestamps
- Easy integration with OpenAI's GPT-3.5-turbo and GPT-4 models
- Lightweight and easy to use
To install openai_pricing_logger, run the following command in your terminal:
pip install openai_pricing_logger
- Import the openai_api_listener context manager from the logger_package:
from logger_package import openai_api_listener
- Wrap your OpenAI API calls with the openai_api_listener context manager:
import openai
with openai_api_listener():
# Your OpenAI API calls go here
- The package will automatically log the cost and timestamp of each API call to a file named api_calls.log in the current directory.
Contributions are welcome! Please feel free to open issues and submit pull requests on the GitHub repository.
openai_pricing_logger is licensed under the MIT License.