SuperTokenTracker (Python)
Google Gemini token tracker that automatically logs prompts, responses, and token usage.
Drop-in replacement for google-genai - just change your import!
Installation
pip install supertokentracker
Quick Start
from supertokentracker import genai
client = genai.Client(api_key="YOUR_API_KEY")
response = client.models.generate_content(
model="gemini-2.0-flash-exp",
contents="Why is the sky blue?"
)
print(response.text)
requests = client.get_tracked_requests()
print(f"Total tokens used: {requests[0]['usage']['totalTokens']}")
Migration from google-genai
Simply replace:
from google import genai # Before
With:
from supertokentracker import genai # After
Everything else stays the same!
Features
- Drop-in replacement for
google-genaipackage - Automatic token tracking for all Gemini API calls
- Local JSON file storage or remote tracking
- Tracks errors, metadata, and response times
- Zero-config setup
Configuration
Local Storage (default)
from supertokentracker import genai
client = genai.Client(
api_key="YOUR_API_KEY",
local_storage={
"file_path": "./custom-logs.json",
"auto_save": True
}
)
Remote Storage
from supertokentracker import genai
client = genai.Client(
api_key="YOUR_GEMINI_API_KEY",
storage="remote",
remote_storage={
"api_key": "YOUR_AITRACKER_API_KEY",
"project_name": "my-project"
}
)
View tracked requests at tokentracker.dev
License
MIT
Metadata
Release files for supertokentracker 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| supertokentracker-0.2.3.tar.gz | 7.4 kB | Without provenance | Details for supertokentracker-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| supertokentracker-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for supertokentracker-0.2.3-py3-none-any.whl |
Total release size: 15.4 kB
Release files / supertokentracker-0.2.3.tar.gz
| Download URL | supertokentracker-0.2.3.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ace464340ddd075cea9880d7f232500c358f77819c68786873532497be86cb8
|
|
BLAKE2b-256 checksum How to use checksums |
e16b15c68446d9e0ddb1b4f1aade6cb8d374d334f51e1783b7c771cb1dd4530c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / supertokentracker-0.2.3-py3-none-any.whl
| Download URL | supertokentracker-0.2.3-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c76af15c1015b5a76a1c89409cee6df24c4052b088c63c2bd2e1f6203ee68af
|
|
BLAKE2b-256 checksum How to use checksums |
ff445a9dfa91eb8da92ac37e4c4f68e5b0305ea4cc0a06a104da28b38a2e907e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for supertokentracker 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.