LLM cost tracking and AI API monitoring — token tracking, budget alerts and efficiency analysis for OpenAI, Anthropic, Google and AI agents
Project description
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.
Install
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
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 with:
- Token counts (prompt + completion)
- Cost in USD
- Latency (ms)
- Model and provider
- Team / environment tags
Anthropic
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
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
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
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vantageaiops-0.3.0.tar.gz.
File metadata
- Download URL: vantageaiops-0.3.0.tar.gz
- Upload date:
- Size: 42.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b4ddce823a0bdf8330c4b894827adb7e513119d6b4cc5ca47fb680abed0590c
|
|
| MD5 |
5243eecfac82f21286f7f679c3b99171
|
|
| BLAKE2b-256 |
8d586998d0cd52bf5d6057ad7950c18b840f4381b2e5c37f21a737d58213af8a
|
File details
Details for the file vantageaiops-0.3.0-py3-none-any.whl.
File metadata
- Download URL: vantageaiops-0.3.0-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a6b0227eb0841affabf1e448c2e027567fcf6063b978b191955824c72878783
|
|
| MD5 |
7ee38a81ad56c0b2cd009dcde23d0175
|
|
| BLAKE2b-256 |
c8e77da4ddb6789a1dd0227f7bcfa7276e8e2da7d1dc79e22673a1cbedddbae8
|