🚀 costtracker
Track your LLM API cost in your terminal in real time — with one command.
✨ Why costtracker?
Building with LLMs is easy.
Tracking cost isn’t.
costtracker solves this by giving you:
⚡ Instant cost visibility for every API call
No dashboards. No setup. No complexity.
🔥 Features
- 📊 Real-time cost tracking
- ⚡ One-line integration
- 🧠 Works with OpenAI and Gemini models (present)
- 🪶 Lightweight & zero-config
- 🧱 Built for developers
⚡ Quick Demo
pip install costtracker
costtracker run file.py
⚡ Output
Model: gemini-2.5-flash-lite
Tokens: 13 (input: 4, output: 9)
Cost: $0.000011
⚙️ Setup
Create a .env file in your root directory:
GEMINI_API_KEY=your_api_key_here
🧪 Usage
import os
from dotenv import load_dotenv
from costtracker import track
from google import genai
load_dotenv()
api_key=os.getenv("GEMINI_API_KEY")
client=genai.Client(api_key=api_key)
response=client.models.generate_content(
model="gemini-2.5-flash-lite",
contents="Hello there!"
)
track(response)
💡 Use Cases
- 🧑💻 AI app developers tracking API usage
- 🚀 Startup teams controlling LLM costs
- 📊 Experimentation with prompt optimization
- 🧪 GenAI project building
🤝 Contributing
- Contributions are welcome!
- Feel free to open issues or submit PRs.
⭐ If you like this project
Give it a star
📄 License
MIT License
Metadata
Release files for costtracker 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| costtracker-0.1.1.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| costtracker-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.0 kB
Release files / costtracker-0.1.1.tar.gz
| Download URL | costtracker-0.1.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dea3ea7351e89b11d6c65e8e6200cf981b8505bbcdfdf005aad3644f5e6f6a0
|
|
BLAKE2b-256 checksum How to use checksums |
db6fa4aa62f4422b14e75cdaa597ee24683d34975ea35e925728e80340b93774
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Release files / costtracker-0.1.1-py3-none-any.whl
| Download URL | costtracker-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87aa27943a2508a9b68390a4c10db8334fb63392db1048a8122e6311d94153e0
|
|
BLAKE2b-256 checksum How to use checksums |
c5715cd4b33001fe858dfa86b4e9b092f1ef15b78df47309025a9ead7887baa4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|