Skip to main content

OpenAI Cost Logger

Project description

https://img.shields.io/badge/chatGPT-74aa9c.svg?logo=openai https://img.shields.io/pypi/pyversions/setuptools.svg

OpenAI Cost Logger

Simple cost logger for OpenAI requests. Track the cost of every request you make to OpenAI and visualize them in a user-friendly way.

How to install:

  • pip install openai-cost-logger
  • from openai_cost_logger.constants import DEFAULT_LOG_PATH, Models, MODELS_COST
    from openai_cost_logger.openai_cost_logger_viz import OpenAICostLoggerViz
    from openai_cost_logger.openai_cost_logger_utils import OpenAICostLoggerUtils
    from openai_cost_logger.openai_cost_logger import OpenAICostLogger
  • See also the homepage on PyPI.

  • See the demo file for a usage example.

Key Features:

  • Track the cost of every request you make to OpenAI and save them in a csv file.

  • Visualize the cost of all the requests you have made.

Endpoint supported:

  • Chat completion.

  • Every endpoint which response contains the field “usage.prompt_tokens” and “usage.completion_tokens”.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openai_cost_logger-0.1.0.tar.gz (4.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page