Skip to main content

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.

PyPI Python License: MIT

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vantageaiops-0.3.1.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vantageaiops-0.3.1-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file vantageaiops-0.3.1.tar.gz.

File metadata

  • Download URL: vantageaiops-0.3.1.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for vantageaiops-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3dd2ecc528b09cb2d84dc0b59be0202fdd9857ef5bdec796cf9981281ec19a45
MD5 4342a119e77dfe510adc7b80825a8243
BLAKE2b-256 626eecffc52c067dfb9d473df4e44b5adb7d090d112a9f02f82771ff23776532

See more details on using hashes here.

File details

Details for the file vantageaiops-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: vantageaiops-0.3.1-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

Hashes for vantageaiops-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 781ab4c9153ef4accb804910e70b1524f1fef45ce5d7329fcf97c1695459024b
MD5 cc7eb1075c0a18624aec80fbedb31bc7
BLAKE2b-256 e686f2154f20a5a2a9a9cbdd7070228183ad9290808a2beee929ad1b077e9248

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page