Skip to main content

Open-source LLM FinOps proxy — track OpenAI, Anthropic (Claude), and Google Gemini API costs by feature, team, and customer. Zero code changes.

Project description

BurnLens — See exactly what your LLM API calls cost

pip install burnlens — open-source LLM FinOps proxy for OpenAI, Anthropic (Claude), and Google Gemini. Track real token costs, attribute spend to features, teams, and customers, and detect waste. Zero code changes. Everything runs locally.

PyPI Downloads License: Apache 2.0 Python 3.10+ GitHub stars

Zero code changes. Every dollar tracked. Works with the official OpenAI, Anthropic, and Google AI SDKs out of the box.


Install

pip install burnlens
burnlens start
# Dashboard → http://127.0.0.1:8420/ui

Point your SDK at the proxy

# OpenAI — note the /v1 suffix
export OPENAI_BASE_URL=http://127.0.0.1:8420/proxy/openai/v1

# Anthropic (Claude)
export ANTHROPIC_BASE_URL=http://127.0.0.1:8420/proxy/anthropic

# Google Gemini — one-line patch
import burnlens.patch; burnlens.patch.patch_google()

Your existing SDK code works unchanged. BurnLens intercepts, logs, and forwards — nothing else.

Tag any request for attribution

X-BurnLens-Tag-Feature:  chat
X-BurnLens-Tag-Team:     backend
X-BurnLens-Tag-Customer: acme-corp

Tags are stripped before reaching the AI provider. They never leave your machine.


Why BurnLens

  • OpenAI and Anthropic bill by model, not by feature. You find out at month end which feature cost the most.
  • Reasoning tokens on o1 / o3 / Claude thinking models cost 10× more than expected. One prompt change can balloon your bill.
  • One bad deploy can burn $47K before anyone notices. Budget alerts catch it in minutes.

BurnLens fixes this at the proxy layer — no instrumentation, no SDK wrapping, no vendor lock-in.


What you get

BurnLens dashboard — LLM cost tracking by model, feature, team, and customer

  • Cost timeline — daily spend trend across all providers
  • Attribution — cost by model, feature, team, customer
  • Waste detection — context bloat, duplicate requests, model overkill
  • Per-request detail — tokens, cost, and latency for every call
  • Budget alerts — Slack + terminal notifications when you hit spend limits

Supported providers

Provider Models
OpenAI gpt-4o, gpt-4o-mini, o1, o3, o1-mini, gpt-4-turbo
Anthropic (Claude) claude-opus-4, claude-sonnet-4, claude-3-5-sonnet, claude-3-haiku
Google Gemini gemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash

Reasoning tokens, cached tokens, and vision tokens are all tracked separately.


CLI

burnlens start         # proxy + dashboard on :8420
burnlens top           # live cost by model (htop-style)
burnlens report        # weekly cost summary
burnlens analyze       # waste detection report
burnlens export        # CSV of last 7 days

Configuration

Zero config required — sensible defaults out of the box. Optional burnlens.yaml:

budget_limit_usd: 500.00
budgets:
  teams:
    backend: 200.00
    research: 100.00
alerts:
  slack_webhook: https://hooks.slack.com/...

How it works

App → SDK → BurnLens proxy (localhost:8420) → AI provider
                 ↓
           SQLite: logs request, calculates cost, extracts tags
                 ↓
        Dashboard (localhost:8420/ui) + CLI (burnlens top/report)
  • Local-first. Everything runs on localhost. No cloud account needed.
  • Privacy-preserving. Prompts and completions never leave your machine. API keys pass through, never stored remotely.
  • Streaming passthrough. SSE chunks forwarded immediately. < 20 ms proxy overhead.
  • Fail-open. If BurnLens can't log, it still forwards the request. Never breaks your app.

Cloud (optional)

Need team-wide dashboards and multi-workspace cost tracking? BurnLens Cloud offers:

  • Free — local proxy only (this repo)
  • Cloud — $29/mo — personal cloud dashboard, 7-day trial
  • Teams — $99/mo — multi-user workspaces, shared budgets

The CLI is free forever. Cloud is opt-in and only syncs anonymised cost records (tokens + cost — never prompts, completions, or API keys).


Contributing

Issues and PRs welcome. See CONTRIBUTING.md.

License

Apache License 2.0

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

burnlens-1.0.1.tar.gz (110.2 kB view details)

Uploaded Source

Built Distribution

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

burnlens-1.0.1-py3-none-any.whl (130.0 kB view details)

Uploaded Python 3

File details

Details for the file burnlens-1.0.1.tar.gz.

File metadata

  • Download URL: burnlens-1.0.1.tar.gz
  • Upload date:
  • Size: 110.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for burnlens-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e7bd09efd20936e09c8f05a58f1d893b5697f94dc70507891c2a0f6ee5db659c
MD5 014ad0a566f717d1273a3f217348818d
BLAKE2b-256 048761c974c45edacd9f7b38f7e4adb70f36609f4530a0f1fc2c28f8c3813106

See more details on using hashes here.

File details

Details for the file burnlens-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: burnlens-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 130.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for burnlens-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bbb7b26592e506a3f3776012349c960fe301917040f58adbad27d051b84c298f
MD5 520cf0d1582b9092de023c8fa02748ce
BLAKE2b-256 c7b49110312b8c560b420792a29450201f61e3b4aaa06448fc9a8befc6bb8e4d

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