Skip to main content

🚀 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

costtracker-0.1.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

costtracker-0.1.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file costtracker-0.1.1.tar.gz.

File metadata

  • Download URL: costtracker-0.1.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for costtracker-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9dea3ea7351e89b11d6c65e8e6200cf981b8505bbcdfdf005aad3644f5e6f6a0
MD5 16e5ac64389d1aeeab435b824c06d39f
BLAKE2b-256 db6fa4aa62f4422b14e75cdaa597ee24683d34975ea35e925728e80340b93774

See more details on using hashes here.

File details

Details for the file costtracker-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: costtracker-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for costtracker-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87aa27943a2508a9b68390a4c10db8334fb63392db1048a8122e6311d94153e0
MD5 a14a9c5a0a2dc90fe922dccae3ebb3d5
BLAKE2b-256 c5715cd4b33001fe858dfa86b4e9b092f1ef15b78df47309025a9ead7887baa4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

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