Metadata-Version: 2.4
Name: ai-cost-auditor
Version: 0.1.0
Summary: Track AI API costs, token usage, and prompt quality across all providers
Project-URL: Homepage, https://github.com/jitentiwari82/ai-cost-auditor
Project-URL: Issues, https://github.com/jitentiwari82/ai-cost-auditor/issues
License: MIT
License-File: LICENSE
Keywords: AI,anthropic,cost,llm,openai,prompt,tokens
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Provides-Extra: all
Requires-Dist: anthropic>=0.34.0; extra == 'all'
Requires-Dist: openai>=1.40.0; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.34.0; extra == 'anthropic'
Provides-Extra: dev
Requires-Dist: anthropic>=0.34.0; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: openai>=1.40.0; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: openai
Requires-Dist: openai>=1.40.0; extra == 'openai'
Description-Content-Type: text/markdown

# AI Cost Auditor

Track AI API costs, token usage, and prompt quality across all providers — Anthropic, OpenAI, Google, Mistral, and more.

## Install

```bash
pip install ai-cost-auditor
```

With provider SDKs:

```bash
pip install "ai-cost-auditor[anthropic]"
pip install "ai-cost-auditor[openai]"
pip install "ai-cost-auditor[all]"
```

## Quick Start

```python
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 |
| Google | 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

```bash
# 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)

```python
tracker.track(
    provider="google",
    model="gemini-1.5-flash",
    input_tokens=300,
    output_tokens=120,
    prompt_text="Your prompt here",
)
```

## License

MIT
