Metadata-Version: 2.4
Name: vantageaiops
Version: 0.3.1
Summary: LLM cost tracking and AI API monitoring — token tracking, budget alerts and efficiency analysis for OpenAI, Anthropic, Google and AI agents
License-Expression: MIT
Keywords: ai,llm,openai,anthropic,observability,cost,tokens,hallucination
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == "openai"
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.34.0; extra == "anthropic"
Provides-Extra: google
Requires-Dist: google-generativeai>=0.7.0; extra == "google"
Provides-Extra: litellm
Requires-Dist: litellm>=1.40.0; extra == "litellm"
Provides-Extra: analysis
Requires-Dist: anthropic>=0.34.0; extra == "analysis"
Requires-Dist: aiohttp>=3.9.0; extra == "analysis"
Provides-Extra: server
Requires-Dist: fastapi>=0.115.0; extra == "server"
Requires-Dist: uvicorn[standard]>=0.30.0; extra == "server"
Requires-Dist: pydantic>=2.7.0; extra == "server"
Requires-Dist: supabase>=2.5.0; extra == "server"
Requires-Dist: clickhouse-connect>=0.7.0; extra == "server"
Requires-Dist: aiohttp>=3.9.0; extra == "server"
Provides-Extra: all
Requires-Dist: openai>=1.0.0; extra == "all"
Requires-Dist: anthropic>=0.34.0; extra == "all"
Requires-Dist: google-generativeai>=0.7.0; extra == "all"
Requires-Dist: litellm>=1.40.0; extra == "all"
Requires-Dist: fastapi>=0.115.0; extra == "all"
Requires-Dist: uvicorn[standard]>=0.30.0; extra == "all"
Requires-Dist: pydantic>=2.7.0; extra == "all"
Requires-Dist: supabase>=2.5.0; extra == "all"
Requires-Dist: clickhouse-connect>=0.7.0; extra == "all"
Requires-Dist: aiohttp>=3.9.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: ruff>=0.5.0; extra == "dev"
Requires-Dist: httpx>=0.27.0; extra == "dev"

# vantage-ai

**LLM cost tracking and AI API monitoring SDK.**

Track token usage, cost, latency and quality for OpenAI, Anthropic, Google and Mistral — with one line of code.

[![PyPI](https://img.shields.io/pypi/v/vantageaiops)](https://pypi.org/project/vantageaiops/)
[![Python](https://img.shields.io/pypi/pyversions/vantageaiops)](https://pypi.org/project/vantageaiops/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

## Install

```bash
pip install vantageaiops            # core only
pip install vantageaiops[openai]    # + OpenAI proxy
pip install vantageaiops[anthropic] # + Anthropic proxy
pip install vantageaiops[google]    # + Gemini proxy
pip install vantageaiops[all]       # everything
```

## Quickstart

```python
import vantage
from vantage.wrappers import create_openai_proxy
import openai

# 1. Init once (e.g. in app startup)
vantage.init(api_key="vnt_your_key")

# 2. Wrap your OpenAI client — zero other changes
client = create_openai_proxy(openai.OpenAI())

# 3. Use normally — every call is automatically tracked
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)
```

Every call is logged to your [VantageAI dashboard](https://vantageaiops.com/app.html) with:
- Token counts (prompt + completion)
- Cost in USD
- Latency (ms)
- Model and provider
- Team / environment tags

## Anthropic

```python
import vantage
from vantage.wrappers import create_anthropic_proxy
import anthropic

vantage.init(api_key="vnt_your_key")
client = create_anthropic_proxy(anthropic.Anthropic())

response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}]
)
```

## Manual tracking

```python
import vantage

vantage.init(api_key="vnt_your_key")

vantage.track(
    model="gpt-4o",
    provider="openai",
    prompt_tokens=500,
    completion_tokens=120,
    total_cost_usd=0.0035,
    latency_ms=842,
    team="search",
    environment="production",
)
```

## Agent / multi-step traces

```python
import uuid, vantage

vantage.init(api_key="vnt_your_key")

trace_id = str(uuid.uuid4())

# Step 1 — root call
vantage.track(model="gpt-4o", ..., trace_id=trace_id, span_depth=0)

# Step 2 — sub-call
vantage.track(model="claude-3-5-sonnet-20241022", ..., trace_id=trace_id, span_depth=1)
```

Traces appear in the **Agent Traces** tab of your dashboard with per-span cost breakdown.

## Configuration

```python
vantage.init(
    api_key="vnt_your_key",
    org="acme",                  # auto-parsed from key if omitted
    team="platform",             # default team tag
    environment="production",    # default: "production"
    ingest_url="https://api.vantageaiops.com",
    flush_interval=2.0,          # seconds between auto-flush
    batch_size=50,               # events per HTTP request
    debug=False,
)
```

## Links

- [Dashboard](https://vantageaiops.com/app.html)
- [Full docs](https://vantageaiops.com/docs.html)
- [REST API reference](https://vantageaiops.com/docs.html#api)
- [GitHub](https://github.com/amanjain/vantageai)
