AI Cost Auditor
Track AI API costs, token usage, and prompt quality across all providers — Anthropic, OpenAI, Google, Mistral, and more.
Install
pip install ai-cost-auditor
With provider SDKs:
pip install "ai-cost-auditor[anthropic]"
pip install "ai-cost-auditor[openai]"
pip install "ai-cost-auditor[all]"
Quick Start
from ai_cost_auditor import CostTracker
import anthropic
tracker = CostTracker()
client = tracker.wrap_anthropic(anthropic.Anthropic())
# Use exactly like the normal client — tracking is automatic
resp = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Explain async/await in Python"}]
)
# View stats
stats = tracker.get_stats(days=7)
print(f"Cost: ${stats['period']['total_cost_usd']:.4f}")
# Generate HTML report with charts
tracker.generate_report("report.html")
Features
- Cost tracking — automatic pricing for 30+ models
- Token tracking — input/output tokens per call, by day/model/provider
- Prompt quality — 5-dimension scoring (clarity, specificity, context, structure, efficiency)
- HTML reports — interactive Chart.js charts: cost over time, provider breakdown, model usage
- Language-agnostic — works with any provider via manual
tracker.track() - VSCode extension — live cost status bar + interactive dashboard
Supported Providers & Models
| Provider | Models |
|---|---|
| Anthropic | claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5, claude-3.x |
| OpenAI | gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, o1, o3-mini |
| gemini-1.5-pro, gemini-1.5-flash, gemini-2.0-flash | |
| Mistral | mistral-large, mistral-small, codestral |
| Cohere | command-r-plus, command-r |
CLI
# Analyze prompt quality
ai-cost-auditor analyze "Write a function to validate email addresses"
# Show stats
ai-cost-auditor stats --days 7
# Generate report and open in browser
ai-cost-auditor report --days 30 --open
Manual Tracking (any provider)
tracker.track(
provider="google",
model="gemini-1.5-flash",
input_tokens=300,
output_tokens=120,
prompt_text="Your prompt here",
)
License
MIT
Metadata
Release files for ai-cost-auditor 0.1.0
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 |
|---|---|---|---|---|
| ai_cost_auditor-0.1.0.tar.gz | 61.9 kB | Without provenance | Details for ai_cost_auditor-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_cost_auditor-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ai_cost_auditor-0.1.0-py3-none-any.whl |
Total release size: 84.7 kB
Release files / ai_cost_auditor-0.1.0.tar.gz
| Download URL | ai_cost_auditor-0.1.0.tar.gz |
|---|---|
| Size | 61.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
103372b6f62c4780cb01bacb2ebec12465748c77ae6b7595c47dcea4fff5d6c2
|
|
BLAKE2b-256 checksum How to use checksums |
f919c305bfb7d58b5a1dbb27e8640e3ecb2d99031d4b12da116afd15f5ecf376
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / ai_cost_auditor-0.1.0-py3-none-any.whl
| Download URL | ai_cost_auditor-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77058a5c38272d079c91f89adcea18168831774dd1945196689f2d639c98e83f
|
|
BLAKE2b-256 checksum How to use checksums |
e26bfed026eb402b3a606a71e5dc29cd4dbde9ad29da43e541ef3e99c45d4cae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for ai-cost-auditor 0.1.0
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.