Add /usage endpoint with token tracking, live balances, and cost calculations

This commit is contained in:
William Stuckey
2026-03-26 19:43:34 -05:00
parent be3dccbe10
commit e7fe5732b7
6 changed files with 462 additions and 4 deletions
+3 -1
View File
@@ -5,8 +5,9 @@ Anthropic-compatible proxy that routes AI requests to multiple providers based o
## File Structure
- `proxy.mjs` - Main proxy server (zero dependencies, Node.js built-ins only)
- `config.json` - API keys and auth token (gitignored)
- `config.json` - API keys, auth token, and pricing (gitignored)
- `config.example.json` - Template config
- `usage-data.json` - Token usage tracking, auto-generated and gitignored
- `ein-ai-proxy.service` - Systemd unit file
- `deploy.sh` - Deployment and testing script
- `sync-context.sh` - Syncs global context to Claude Code and Roo Code
@@ -14,6 +15,7 @@ Anthropic-compatible proxy that routes AI requests to multiple providers based o
## Development
Run locally: `node proxy.mjs` (requires `config.json`)
Test health endpoint: `curl http://localhost:3100/health`
Check usage: `curl http://localhost:3100/usage`
Zero npm dependencies — do not add any.
## Deployment