token-warden 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +52 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -120,9 +120,59 @@ Flush all pending events to the ingestion endpoint. Returns a promise that resol
120
120
 
121
121
  Flush pending events and stop the background flush interval. Call this during graceful application shutdown.
122
122
 
123
- ## Dashboard (Coming Soon)
123
+ ## Dashboard
124
124
 
125
- A full-featured dashboard with budget alerts, anomaly detection, and per-feature cost drill-down is in development. Star this repo to get notified when it launches.
125
+ Token Warden includes a self-hosted dashboard for visualizing costs, setting budgets, and detecting anomalies.
126
+
127
+ ### Features
128
+
129
+ - **Per-feature cost breakdown** with daily spend charts and sparkline trends
130
+ - **Feature drill-down** with model usage, cost over time, and recent request history
131
+ - **Budget alerts** — set daily, weekly, or monthly limits per feature with configurable thresholds
132
+ - **Anomaly detection** — automatically flags cost spikes exceeding 3x the 7-day hourly average
133
+ - **Webhook notifications** — Slack-compatible alerts when budgets are breached
134
+ - **Dual database support** — SQLite for local dev, PostgreSQL for production
135
+
136
+ ### Setup
137
+
138
+ ```bash
139
+ cd apps/dashboard
140
+ npm install
141
+ npm run db:setup # Create tables + seed model pricing
142
+ npm run db:seed-demo # Optional: generate 30 days of demo data
143
+ npm run dev # Start on http://localhost:3100
144
+ ```
145
+
146
+ ### Connect the SDK
147
+
148
+ Point your Token Warden SDK at the dashboard's ingestion endpoint:
149
+
150
+ ```typescript
151
+ import { warden } from "token-warden";
152
+
153
+ warden.init({
154
+ apiKey: process.env.WARDEN_API_KEY, // Set this on the dashboard too
155
+ endpoint: "http://localhost:3100/api/events",
156
+ });
157
+ ```
158
+
159
+ ### Environment Variables
160
+
161
+ | Variable | Default | Description |
162
+ | --- | --- | --- |
163
+ | `WARDEN_API_KEY` | `tw_dev_key` | Bearer token for event ingestion (set to match your SDK config) |
164
+ | `DATABASE_URL` | SQLite (`./data/warden.db`) | Set to `postgres://...` for PostgreSQL |
165
+
166
+ ### Routes
167
+
168
+ | Route | Description |
169
+ | --- | --- |
170
+ | `/` | Dashboard overview — total spend, feature breakdown, daily trend |
171
+ | `/features/[name]` | Feature detail — cost over time, model usage, recent requests |
172
+ | `/alerts` | Budget management and alert history |
173
+ | `/setup` | API key display and integration guide |
174
+ | `/api/events` | `POST` — event ingestion endpoint |
175
+ | `/api/health` | `GET` — health check |
126
176
 
127
177
  ## Contributing
128
178
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "token-warden",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Lightweight LLM cost tracking SDK — auto-instrument OpenAI, Anthropic, Google, Bedrock, and more",
5
5
  "license": "MIT",
6
6
  "type": "module",