Provider dashboards stop at "project spent $5,000". KostLens turns every OpenAI, Anthropic and Gemini call into a financial dashboard: cost per customer, per feature, per model — with a projected invoice, budgets and anomaly alerts.
Free up to 10k events/month, forever · no credit card · 5-minute setup
Why not just the provider console?
OpenAI, Anthropic and Google bill you by organization, key and model — dimensions of their system. Your questions are about your system: customers, features, margins. They can't answer those. We can, because you tag the calls.
Features
Built for SaaS teams shipping AI features who need to know where the money goes — and who it goes to.
Tag calls with an endUserId and every customer gets a price tag. Spot the one costing more than they pay.
Chat, summarize, extract — see which feature burns the budget and which one earns it.
Know on day 9 what the invoice will say on day 30. Budgets warn at 80%, alert at 100%.
A day running 3× above your 7-day average pings Slack or email before the bill does.
Your real token volumes, today's prices, every model: "what would this month cost on Haiku?" — answered.
One curl in CI drops a marker on the chart. "Did Tuesday's deploy double our spend?" takes two seconds.
kostlens-ci --max-usd 5 fails the pipeline when AI spend crosses your ceiling.
The KostLens MCP server answers "which customer costs us the most?" right inside Claude.
How it works
KostLens is an observer, not a proxy: your calls never pass through our servers, your keys never leave your code, and a KostLens outage can never take your app down. Prices are computed server-side from a versioned catalog — intro windows and long-context tiers included.
One wrapper around the SDK you already use. Streaming included. OpenAI-compatible APIs (Groq, OpenRouter, DeepSeek…) work too.
endUserId and feature turn raw usage into business answers.
Live dashboard, projections, budgets and alerts. Or import history in 2 minutes with a provider admin key — zero code.
import { KostLens, wrapOpenAI } from "@kostlens/track";
const kl = new KostLens({ apiKey: "kl_live_…" });
const openai = wrapOpenAI(new OpenAI(), kl, {
tags: { feature: "chat", endUserId: user.id },
});
// use openai exactly as before —
// every call is now measured from kostlens import KostLens, wrap_openai
kl = KostLens("kl_live_…")
client = wrap_openai(OpenAI(), kl,
tags={"feature": "chat",
"end_user_id": user.id})
# use client exactly as before —
# every call is now measured kl := kostlens.New(kostlens.Options{APIKey: key})
httpc := kostlens.WrapHTTPClient(nil, kl,
kostlens.MiddlewareOptions{
Tags: map[string]string{"feature": "chat"},
})
// pass httpc to the official OpenAI /
// Anthropic Go SDK — done Pricing
An event is one tracked AI call. Dashboards, alerts and all three SDKs (TypeScript, Python, Go) are in every plan.
FAQ
No. KostLens is an observer, never a proxy: the SDK measures your call locally and sends a tiny usage event asynchronously. Your prompts and keys never touch us, and if KostLens is down your app doesn't notice.
Our price catalog is versioned with effective dates — intro windows (like Sonnet 5's) and >200k long-context tiers included — and synced against community sources. New models get repriced retroactively, so history is never wrong.
Yes. Streamed responses are relayed untouched to your app while the final token counts are captured — in both the TypeScript and Python SDKs.
Paste an OpenAI or Anthropic admin key in Settings and KostLens imports your daily usage history in about 2 minutes — zero code. You get day × model costs immediately; add the SDK later for per-customer numbers.
OpenAI (including the Responses API), Anthropic and Google Gemini natively — plus anything OpenAI-compatible (Groq, OpenRouter, DeepSeek, Kimi…) through the OpenAI wrapper. Unknown models are still tracked and priced as soon as a price lands in the catalog.
Yes, MIT — both SDKs. What you pay for is the platform: storage, dashboards, alerts, projections and the price catalog kept honest.
Free for 10k events a month. Wired into your app before your coffee cools.
Start free