GPT Cost Estimator
This Python package, GPTCostCalculator, provides a simple yet effective tool for estimating the cost of using different ChatGPT models. It is designed for anyone using ChatGPT models in their applications and need to estimate the cost of a particular query.
You do NOT need an OpenAI API key to use this package.
This package is available on pypi
Features
- Provides cost estimation for input and output tokens of various ChatGPT models.
- Supports multiple models including GPT-4, GPT-4-32k, GPT-4-1106-preview, GPT-3.5-turbo-1106, and GPT-3.5-turbo-instruct.
- Easy integration with existing Python projects.
Supported Models
As of the current release, the package supports the following ChatGPT models:
gpt-4o: Input Price - $5, Output Price - $15 per 1M tokens.gpt-3.5-turbo-0125: Input Price - $0.5, Output Price - $1.5 per 1M tokens.gpt-3.5-turbo-instruct: Input Price - $1.5, Output Price - $2 per 1M tokens.
Installation
To install the package, simply run the following command:
pip install GPTCostCalculator
Usage
Here is a basic example of how to use the package:
from GPTCostCalculator import Calculator
# Initialize the calculator
calculator = Calculator()
# Estimate the cost
report = estimator.cost_estimate(model="gpt-4o", input_text="Your input text here", output_text="Expected output text", info_text = True)
output_text is not mandatory.
Dependencies
tiktoken: Used for tokenizing the input and output texts.
Contributing
Contributions to the GPTCostCalculator package are welcome. Please feel free to fork the repository, make your changes, and create a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
For any queries or feedback, please contact me.
Disclaimer
Please note that the costs provided by this package are estimates and may vary based on actual usage of ChatGPT models.
Release files for GPTCostCalculator 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gptcostcalculator-1.0.2.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| GPTCostCalculator-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / gptcostcalculator-1.0.2.tar.gz
| Download URL | gptcostcalculator-1.0.2.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab26f0fb8891153a652fda44dad212faf6d6a7e9804261eec74211ae87b3d2d6
|
|
BLAKE2b-256 checksum How to use checksums |
c054ec1618435e35fff90caa9835c7fa8ce9dd6652b57492933e6e40fb490fa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / GPTCostCalculator-1.0.2-py3-none-any.whl
| Download URL | GPTCostCalculator-1.0.2-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1b73cff9040633c864aedc8df6387fa438f62304413cc1c16ad3dd78f4ae417
|
|
BLAKE2b-256 checksum How to use checksums |
bb30205976ba71c3fecf03182be7942d2b4c22c19fb99a9bc19635d38c538655
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|