Categories
Developer Tools AI Agents LLM Observability OpenTelemetry Usage Analytics FinOps AI Cost Tracking Budget ManagementDeveloper links
AI API Cost Tracker
AI API Cost Tracker is an open-source ledger that prices every OpenAI, Anthropic and Gemini request and charges it to the customer, feature or agent run behind it. Apps report token counts through one HTTP endpoint, dependency-free client libraries or OpenTelemetry traces. Prompts and responses are never stored. Each request is costed at the price in force that day, so a rate change never rewrites history. Dashboards break spend down by project, provider, model, customer, feature and run, forecast month-end spend and flag spikes. Budgets, monthly or per run, alert at 80% and 100% by signed webhook, Slack or email. Agents can check a budget before they spend, or reserve it so concurrent steps cannot overspend. A "Why spend changed" page splits a rise into volume, model mix, tokens per request and price, and savings estimates size batching, caching and cheaper models. Outcomes turn spend into cost per resolved ticket. Reconciliation compares recorded costs with Anthropic's cost report, OpenAI's costs API and Google Cloud's billing export. An optional billing ledger sets each customer's revenue against their AI cost, drafts Stripe invoices and shares read-only portal links. Exports cover CSV, FinOps FOCUS and a reporting API. Roles, invitations and an audit log serve teams, with OpenID Connect sign-in for providers such as Okta or Keycloak. Running on a dedicated VPS on RepoCloud with guaranteed CPU, RAM, and SSD, full root SSH access, and a browser serial console. MIT licensed.
Benefits
- Prompts never leave your apps
- Only token counts, model names and attribution fields are sent to the tracker, and prompts and responses are never sent or stored, so a cost database holds no conversation text.
- Agents ask before they spend
- An agent calls the budget check or reserves an estimate before a step, and reservations keep concurrent steps within one monthly or per-run cap.
- Exact costs, never rewritten
- Each request is priced at the rate in effect when it happened, stored as exact decimals and rounded once to the micro-dollar, and later price changes leave recorded history untouched.
- See what each customer costs
- Spend is attributed to customers, users, features and runs, and outcomes such as resolved tickets give cost per result, which the optional billing ledger sets against revenue.
Features
- Tier-aware dated pricing
- Prices for OpenAI, Anthropic and Google models cover cache reads and writes, long-prompt tiers, batch, flex and fast tiers, audio, images and web searches, each with its source and date.
- Three ways to report
- Send token counts to POST /api/usage with a per-project key, use the dependency-free TypeScript and Python clients, or ingest OpenTelemetry traces carrying GenAI token attributes.
- Budgets, checks and reservations
- Monthly and per-run budgets alert at 80% and 100% by signed webhook, Slack or email, while POST /api/budget/check and reservations stop agents before they overspend.
- Why spend changed
- Splits a change between two periods into volume, model mix, tokens per request, input and output mix, cache rate and price that add up exactly, plus savings estimates.
- Reconciliation and exports
- Compares recorded cost with Anthropic's cost report, OpenAI's costs API and the Google Cloud billing export, and exports CSV, FOCUS 1.4 files or data through a read-only reporting API.
- Teams, roles and SSO
- Admin, member and viewer roles, single-use invitation links, organizations, an append-only audit log and OpenID Connect sign-in for providers such as Okta, Entra ID and Keycloak.