michaelachmann/gpt-cost-estimator
A cost estimator for OpenAI API calls in tqdm loops.
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.
Stars
20
Forks
3
Language
Python
License
MIT
Category
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.
Higher-rated alternatives
linshenkx/prompt-optimizer
一款提示词优化器,助力于编写高质量的提示词
Undertone0809/promptulate
🚀Lightweight Large language model automation and Autonomous Language Agents development...
CTLab-ITMO/CoolPrompt
Automatic Prompt Optimization Framework
microsoft/sammo
A library for prompt engineering and optimization (SAMMO = Structure-aware Multi-Objective...
Eladlev/AutoPrompt
A framework for prompt tuning using Intent-based Prompt Calibration