How meter-token-prediction/meter works
Meter is an inference proxy and spend-control plane. An application sends model requests to the proxy, which estimates cost, checks budgets and breaker state, routes the call to a provider, and records priced usage for analysis. Separately, the treasurer monitors wallet runway and can purchase credits under a mandate; the dashboard presents scoped ledger and treasury activity. The README also documents waste analysis and a private try-it-yourself judge console. Some subsystem wiring is inferred only from documented capabilities, so uncertain internal links are omitted.
Main entry points: app.py Inference proxy · db.ts Dashboard queries · treasurer.py Runway treasurer · JudgeConsole.tsx Try-it console
Components 23
Inference control
- Inference proxy
proxy/app.py - Cost predictor
predictor/engine.py - Budget enforcement
proxy/budget.py - Circuit breaker
proxy/breaker.py - Provider routing
proxy/providers.py - Usage pricing
proxy/pricing.py
Treasury
- Runway treasurer
treasury/treasurer.py - Treasury records
treasury/db.py - Mandate execution
treasury/prava.py - Prava payment rail
- Linq messaging
Analysis
- Usage ledger
proxy/db.py - Waste analysis
predictor/optimize.py
Dashboard and demo
- Control Room
dashboard/src/app/(dashboard)/dashboard/page.tsx - Dashboard queries
dashboard/src/lib/db.ts - Live logs API
dashboard/src/app/api/live-logs/route.ts - Treasury events API
dashboard/src/app/api/treasury-events/route.ts - Live polling
dashboard/src/lib/usePoll.ts - Try-it console
dashboard/src/components/judge/JudgeConsole.tsx - Judge API
judge/routes.py - Private sessions
judge/sessions.py
Other components
- Application
- Dashboard user
Connections 24
- Application → Inference proxy: sends requests
- Inference proxy → Cost predictor: estimates cost
- Inference proxy → Budget enforcement: checks limits
- Inference proxy → Circuit breaker: checks breaker
- Inference proxy → Provider routing: routes calls
- Provider routing → Application: returns response
- Inference proxy → Usage pricing: prices usage
- Inference proxy → Usage ledger: records calls
- Usage ledger → Waste analysis: supplies usage
- Control Room → Dashboard queries: loads views
- Dashboard queries → Usage ledger: queries ledger
- Live polling → Live logs API: fetches logs
- Live logs API → Dashboard queries: reads logs
- Live polling → Treasury events API: fetches events
- Treasury events API → Dashboard queries: reads events
- Runway treasurer → Treasury records: reads wallet state
- Runway treasurer → Mandate execution: requests top-up
- Mandate execution → Prava payment rail: executes purchase
- Runway treasurer → Linq messaging: sends alert
- Dashboard user → Try-it console: starts session
- Try-it console → Judge API: calls console API
- Judge API → Private sessions: resolves session
- Judge API → Inference proxy: runs prompt
- Try-it console → Control Room: views scoped data