I built an open-source billing engine for AI Agents

5 hours ago 3

The Open-Source Billing and Analytics Engine for AI
Stop losing money on AI costs.

Follow on X

License Stargazers

Report an Issue   •   Request a Feature


application-analytics-preview

The Problem: AI companies are burning through compute costs without visibility into profitability per customer, feature, or agent. Most developers discover they're losing money only after the damage is done.

Our Solution: Real-time cost tracking, margin analysis, and pricing optimization specifically designed for AI applications.

  • Customer & Agent Analytics: Track costs, usage, and profitability per customer.
  • Real-time Metering: Real-time cost tracking across OpenAI, Anthropic, Gemini, and more
  • Know Your Margins: Margin analysis per customer, feature, and AI agent.
  • Scalable by Design: Production-ready stack built for high-volume requests.
  • 5-Minute Setup: Launch instantly with Docker.
  • Self-Hosted & Secure: Your data, your infrastructure. Total privacy.

Getting Started in 5 Minutes

Deploy your own instance of Frost AI locally.

git clone https://github.com/frozen-labs/frost.ai.git cd frost.ai

To start the application (includes the database), run:

cp /apps/fullstack/.env.example /apps/fullstack/.env

That's it! Frost AI is now running at http://localhost:3000. To stop the application, run:

Usage: How to Track an AI Call

Just make an API call to track your costs.

curl -X POST http://localhost:3000/api/signals/track \ -H "Content-Type: application/json" \ -d '{ "customerId": "c2f4a5f0-1b3c-4d5e-6f7g-8h9i0j1k2l3m", "agentId": "customer-support-agent", "signalId": "email-processed", "metadata": { "used_tokens": 450, "model_used": "gpt-4-turbo", "prompt_id": "prompt_xyz789" } }'
import requests payload = { "customerId": "c2f4a5f0-1b3c-4d5e-6f7g-8h9i0j1k2l3m", "agentId": "customer-support-agent", "signalId": "email-processed", "metadata": { "used_tokens": 450, "model_used": "gpt-4-turbo", "prompt_id": "prompt_xyz789" } } requests.post("http://localhost:3000/api/signals/track", json=payload)
const payload = { customerId: "c2f4a5f0-1b3c-4d5e-6f7g-8h9i0j1k2l3m", agentId: "customer-support-agent", signalId: "email-processed", metadata: { used_tokens: 450, model_used: "gpt-4-turbo", prompt_id: "prompt_xyz789", }, }; fetch("http://localhost:3000/api/signals/track", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), });

Our vision is to build it into a complete, end-to-end billing solution for AI companies.

  • Subscription & Hybrid Pricing Models: Move beyond simple per-action pricing to support monthly/yearly subscriptions, tiered pricing, and complex hybrid models (e.g., a base fee + overages).
  • True Billing & Invoicing: The highest priority is to build the billing engine. This will include generating invoices from the tracked usage data and integrating with payment gateways like Stripe.
  • Advanced Analytics & Alerting: Deeper insights, customizable reports, and automated alerts to notify you of cost spikes or low margins.
  • Client-side SDKs: Official libraries for Python and JS/TS to make integration trivial.

Have an idea for our roadmap? Suggest a feature!

Shape the Future of Frost AI

Frost AI is a free and open-source project. We welcome contributions of all kinds! Whether you're a developer, a designer, or just an enthusiast, you can help make this project better.

Thanks to our friends: Drizzle, TanStack, shadcn/ui, Turborepo, and the countless other open-source projects that make Frost AI possible.

Read Entire Article