๐ฅ burn0
Know what your code costs
One import tracks every API call in your stack.
LLMs, SaaS, infrastructure. See per-request costs in real time.
The cost observability layer your codebase is missing.

[](https://npmjs.com/package/@burn0/burn0)
[](https://npmjs.com/package/@burn0/burn0)
[](https://github.com/burn0-dev/burn0)
[](https://typescriptlang.org)
[](LICENSE)
[Website](https://burn0.dev) ยท [Docs](https://docs.burn0.dev) ยท [Dashboard](https://burn0.dev/dashboard) ยท [Twitter](https://twitter.com/burn0dev)
---
### ๐ฌ See it in action
https://github.com/user-attachments/assets/56962fc8-b9cf-49b2-9481-bc10aca6fb56
## The Problem
You're running OpenAI, Anthropic, Stripe, Supabase, SendGrid, and a dozen other APIs. Your monthly bill is $2,847 and climbing 340% month-over-month.
**You have no idea which feature is burning money.**
Observability platforms charge $199/mo. API monitoring tools charge $149/mo. Cost management SaaS charges $99/mo.
**burn0 is free. One import. That's it.**
```
burn0 โธ $4.32 today (47 calls) โโ openai: $3.80 ยท anthropic: $0.52
```
---
## Quick Start
```bash
npm i @burn0/burn0
```
Add one line to your entry file:
```typescript
import "@burn0/burn0"; // Must be first import
import express from "express";
import OpenAI from "openai";
// ... your app runs exactly the same
```
That's it. Costs appear in your terminal:
```
burn0 โธ $0.47 today (12 calls) โโ openai: $0.41 ยท stripe: $0.06
```
On exit:
```
burn0 โธ session: $0.47 (12 calls, 4m 22s) โโ today: $14.32 โโ ~$430/mo
```
### Want full history and dashboards? Add an API key:
```bash
# 1. Sign in with GitHub and create a key
open https://burn0.dev/login
# โ Dashboard โ API Keys โ Create Key
# 2. Add it to your project
echo 'BURN0_API_KEY=b0_sk_your_key_here' >> .env
# 3. Restart โ costs now sync to burn0.dev
```
Now you get a **live event feed**, **cost breakdown by service**, **monthly projections**, and **full request history** โ all at [burn0.dev/dashboard](https://burn0## The Problem.dev/dashboard).
> burn0 only syncs metadata (service, model, tokens, cost, latency) โ never request/response bodies or your API keys.
---
## How It Compares
| | Observability Platform | API Monitoring | Cost Management SaaS | **burn0** |
| ------------------- | ---------------------- | -------------- | -------------------- | ---------------------- |
| **Price** | $199/mo | $149/mo | $99/mo | **Free forever** |
| **Setup** | SDK + dashboard config | Proxy setup | Manual tagging | **One import** |
| **Latency** | 5-50ms | 10-100ms | Async | **<1ms** |
| **Per-feature** | Manual instrumentation | No | Manual | **`burn0.track()`** |
| **Works locally** | No | No | No | **Yes** |
| **Open source** | No | No | No | **MIT Licensed** |
| **Data leaves app** | Always | Always | Always | **Only if you opt in** |
**You're spending $526/mo on tools that burn0 replaces for $0.**
---
## CLI
```bash
# Interactive setup wizard
npx burn0 init
# Cost report (last 7 days)
npx burn0 report
# Today only
npx burn0 report --today
# Run any app with tracking (zero code changes)
npx burn0 dev -- node app.js
# Connect to cloud dashboard
npx burn0 connect
```
### `burn0 report` output
```
burn0 report โโ last 7 days
Total: $12.47 (342 calls)
openai $8.32 โโโโโโโโโโโโโโโโโโโโ 67%
anthropic $3.15 โโโโโโโโโโโโโโโโโโโโ 25%
google-gemini $0.85 โโโโโโโโโโโโโโโโโโโโ 7%
resend $0.15 โโโโโโโโโโโโโโโโโโโโ 1%
โโ projection โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
~$53/mo estimated (based on last 7 days)
```
---
## Feature Attribution
Know exactly which feature burns money:
```typescript
import { track } from "@burn0/burn0";
await track("onboarding", async () => {
const profile = await ai.generateProfile(user);
await stripe.createSubscription(user.id);
await sendWelcomeEmail(user.email);
});
```
```
burn0 โธ feature "onboarding" โโ $0.47/user
โโ openai $0.39 (83%)
โโ stripe $0.0001 (2%)
โโ sendgrid $0.08 (17%)
```
Track per user, per feature, per request. No manual tagging. No dashboards to configure.
---
## 50+ Services Supported
burn0 auto-detects services from hostnames. Zero configuration.
### AI / LLMs
| Service | Detection | Pricing Model |
| ------------- | ----------------------------------- | ----------------- |
| OpenAI | `api.openai.com` | Per-token (exact) |
| Anthropic | `api.anthropic.com` | Per-token (exact) |
| Google Gemini | `generativelanguage.googleapis.com` | Per-token (exact) |
| Mistral | `api.mistral.ai` | Per-token (exact) |
| Cohere | `api.cohere.ai` | Per-token |
| Groq | `api.groq.com` | Per-token |
| Together AI | `api.together.xyz` | Per-token |
| Perplexity | `api.perplexity.ai` | Per-token |
| DeepSeek | `api.deepseek.com` | Per-token |
| Replicate | `api.replicate.com` | Per-second |
| Fireworks AI | `api.fireworks.ai` | Per-token |
| AI21 Labs | `api.ai21.com` | Per-token |
| Pinecone | `*.pinecone.io` | Per-request |
### Pay-per-use APIs
| Service | Detection | Pricing Model |
| ----------- | --------------------- | --------------- |
| Stripe | `api.stripe.com` | Per-transaction |
| PayPal | `api.paypal.com` | Per-transaction |
| Plaid | `*.plaid.com` | Per-request |
| SendGrid | `api.sendgrid.com` | Per-email |
| Resend | `api.resend.com` | Per-email |
| Twilio | `api.twilio.com` | Per-message |
| Vonage | `api.nexmo.com` | Per-message |
| Algolia | `*.algolia.net` | Per-search |
| Google Maps | `maps.googleapis.com` | Per-request |
| Mapbox | `api.mapbox.com` | Per-request |
| Cloudinary | `api.cloudinary.com` | Per-transform |
| Sentry | `sentry.io` | Per-event |
| Segment | `api.segment.io` | Per-event |
| Mixpanel | `api.mixpanel.com` | Per-event |
### Databases & Infrastructure
| Service | Detection | Pricing Model |
| ------------- | ------------------------ | -------------- |
| Supabase | `*.supabase.co` | Per-request |
| PlanetScale | `*.psdb.cloud` | Per-request |
| MongoDB Atlas | `*.mongodb.net` | Per-request |
| Upstash | `*.upstash.io` | Per-request |
| Neon | `*.neon.tech` | Per-request |
| Turso | `*.turso.io` | Per-request |
| Firebase | `*.firebaseio.com` | Per-request |
| AWS S3 | `*.s3.amazonaws.com` | Per-request |
| AWS Lambda | `lambda.*.amazonaws.com` | Per-invocation |
| Vercel | `api.vercel.com` | Per-request |
**Unknown APIs are auto-tracked by request count.** Nothing slips through.
---
## How It Works
```
Your app starts
โ
โโ import '@burn0/burn0' patches globalThis.fetch + node:http
โ
โโ Every outbound HTTP call is intercepted (zero behavior change)
โ
โโ Service identified from hostname (api.openai.com โ OpenAI)
โ
โโ Token counts + costs extracted from response metadata
โ
โโ Costs displayed in terminal + stored in local ledger
```
1. **Interception is synchronous** โ your request goes out immediately
2. **Cost extraction is async** โ happens after the response, never blocks
3. **Sub-millisecond overhead** โ benchmarked, not estimated
4. **Never reads content** โ only extracts metadata: service, model, tokens, status, latency
5. **Never throws** โ graceful degradation if anything fails internally
6. **ยฑ2% accuracy** โ exact token counts from LLM APIs, bundled pricing for SaaS
---
## Two Modes
| Mode | API Key | What happens |
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------- |
| **Local** (default) | No | Costs in terminal + local ledger. Zero network calls to burn0. |
| **Cloud** (opt-in) | Yes | Same as local + events sync to [dashboard](https://burn0.dev/dashboard) for full history and team visibility. |
> **Start local, upgrade when ready.** burn0 works perfectly without an API key. When you want history and dashboards, add a key โ it takes 60 seconds. [Get your free API key โ](https://burn0.dev/login)
---
## Configuration
| Env Variable | Default | Description |
| ------------------- | ----------------------- | --------------------------------------- |
| `BURN0_API_KEY` | โ | API key for cloud mode |
| `BURN0_API_URL` | `https://api.burn0.dev` | Backend URL |
| `BURN0_DEBUG` | `false` | Enable debug logging |
| `BURN0_ENABLE_TEST` | โ | Set to `1` to enable in `NODE_ENV=test` |
---
## Works With Everything
burn0 works with any Node.js framework. If it makes HTTP calls, burn0 tracks the costs.
```
Express ยท Next.js ยท Fastify ยท Hono ยท Koa ยท NestJS ยท Remix ยท Nuxt
```
**Requirements:** Node.js >= 18
---
## Frequently Asked Questions
### Does it slow down my API calls?
No. Interception is synchronous but event processing is fully async. burn0 adds sub-millisecond overhead to your API calls.
### Does it send my data anywhere?
By default, no. In local mode, costs are logged to your terminal and stored in a local file. Cloud mode (opt-in) ships only metadata โ never request/response bodies.
### How accurate are the cost estimates?
burn0 extracts exact token counts from LLM API responses. For pay-per-use APIs, it uses bundled pricing data. Accuracy is within ยฑ2%.
### Can I use it in production?
Yes. burn0 is designed for production use. It never throws, never adds latency, and gracefully degrades if anything fails internally.
### Is it really free?
Yes. burn0 is MIT licensed and free forever. No API key required for local mode. Cloud features (dashboard, team analytics) are available as a paid tier.
---
## Development
```bash
git clone https://github.com/burn0-dev/burn0.git
cd burn0
npm install
npm run build
npm test
```
---
## Community
| Channel | Link |
| ---------- | ----------------------------------------------------- |
| ๐ Website | [burn0.dev](https://burn0.dev) |
| ๐ Docs | [docs.burn0.dev](https://docs.burn0.dev) |
| ๐ฆ Twitter | [@burn0dev](https://twitter.com/burn0dev) |
| ๐ป GitHub | [burn0-dev/burn0](https://github.com/burn0-dev/burn0) |
---
**MIT License** ยท Built by the [burn0](https://burn0.dev) team
โญ If burn0 saves you money, consider starring the repo.