Skip to content

Latest commit

 

History

History
46 lines (27 loc) · 1.23 KB

README.md

File metadata and controls

46 lines (27 loc) · 1.23 KB

openai_pricing_logger

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.

Features

  • 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

Installation

To install openai_pricing_logger, run the following command in your terminal:

pip install openai_pricing_logger 

Usage

  1. Import the openai_api_listener context manager from the logger_package:
from logger_package import openai_api_listener
  1. Wrap your OpenAI API calls with the openai_api_listener context manager:
import openai

with openai_api_listener():
    # Your OpenAI API calls go here
  1. The package will automatically log the cost and timestamp of each API call to a file named api_calls.log in the current directory.

Contributing

Contributions are welcome! Please feel free to open issues and submit pull requests on the GitHub repository.

License

openai_pricing_logger is licensed under the MIT License.