michaelachmann/gpt-cost-estimator

A cost estimator for OpenAI API calls in tqdm loops.

41
/ 100
Emerging

Wraps OpenAI API calls as a decorator to track input/output token counts using `tiktoken` and calculate per-request costs in real-time within `tqdm` progress bars. Supports mock responses for cost estimation without API calls, model name aliases, and custom pricing overrides. Designed for Jupyter notebooks with a simple API: decorate your OpenAI function, iterate with `tqdm`, then call `CostEstimator.get_total_cost()` to retrieve accumulated expenses.

No commits in the last 6 months. Available on PyPI.

Stale 6m
Maintenance 0 / 25
Adoption 11 / 25
Maturity 18 / 25
Community 12 / 25

How are scores calculated?

Stars

20

Forks

3

Language

Python

License

MIT

Last pushed

Nov 25, 2024

Monthly downloads

134

Commits (30d)

0

Dependencies

4

Get this data via API

curl "https://pt-edge.onrender.com/api/v1/quality/prompt-engineering/michaelachmann/gpt-cost-estimator"

Open to everyone — 100 requests/day, no key needed. Get a free key for 1,000/day.