Skip to main content

Simple Library for OpenAI Usage

Project description

openai-usage

PyPI

Utilities to track OpenAI API usage.

Installation

pip install openai-usage

Usage

from openai_usage import Usage

# Track usage manually
usage = Usage()
usage.add(Usage(requests=1, input_tokens=10, output_tokens=20, total_tokens=30))

# Create from OpenAI object
from openai.types.completion_usage import CompletionUsage
openai_usage = CompletionUsage(prompt_tokens=10, completion_tokens=20, total_tokens=30)
usage = Usage.from_openai(openai_usage)

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_usage-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openai_usage-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file openai_usage-0.1.0.tar.gz.

File metadata

  • Download URL: openai_usage-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Darwin/24.5.0

File hashes

Hashes for openai_usage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 19d24dc78b14d9d723493898c676786c049fbb5a3fa000f1abd2b07c8d5d86eb
MD5 58c478c7f80079622ce64c1fbaa12c81
BLAKE2b-256 12f71dc7aca3753bbc511b6b57925a48cdd9f4140673d365ee5bd6323ee4229f

See more details on using hashes here.

File details

Details for the file openai_usage-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: openai_usage-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Darwin/24.5.0

File hashes

Hashes for openai_usage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4679afabadb07f2e08d875a6727ed3dd004f5c5ba0fa290f07b5738ca648902
MD5 923de9d4d1c11e4ae5080de589f241ed
BLAKE2b-256 0389ce04a06299e08e29af0457bd2aa6454898d2de6fa6399847ef7a2d3571ed

See more details on using hashes here.

Supported by

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