A local OpenAI-compatible proxy that removes duplicate tokens, routes requests to the cheapest available model, and logs your savings — all on your machine.
badgr-auto sits between your coding tool and your AI provider. It cuts costs twice: fewer tokens sent, cheaper model chosen.
Deduplicates repeated context and compresses long conversation history before forwarding. Typically removes 20–50% of tokens.
Short autocomplete tasks go to a free local model. Normal queries go to a cheap OSS cloud model. Only complex tasks hit premium models.
Every request is logged locally. Run badgr-auto stats to see tokens saved and what you would have paid with Haiku or Sonnet.
npm install -g badgr-autoRequires Node.js ≥ 20.
badgr-auto startThe guided setup detects your hardware, finds running local models (Ollama / LM Studio), and optionally connects your AI Badgr account for cloud routing.
The proxy starts at http://localhost:51999/v1.
Point any OpenAI-compatible tool at the proxy. Use your AI Badgr API key (or any non-empty string for local-only mode).
Base URL
http://localhost:51999/v1Model
badgr-autobadgr-auto logs two savings comparisons to stderr after every request — token optimisation and routing.
✓ Routed: local model
✓ Tokens: 8,420 → 5,960 (−2,460 tokens, 29%)
✓ Cloud cost: $0.00
✓ Estimated saved vs Claude Haiku: $0.0048
✓ Estimated saved vs Claude Sonnet: $0.0179
✓ Latency: 142msFor cloud routes, Actual cost is shown instead of Cloud cost: $0.00.
badgr-auto stats # all time
badgr-auto stats 7d # last 7 days
badgr-auto stats 1d # last 24 hours Estimated savings — Last 7 days
Token optimisation
Requests: 1,240
Original tokens: 4.92M
Optimized tokens: 2.94M
Tokens removed: 1.98M
Average context reduction: 40.4%
Routing savings
Actual cost: $8.70
Cost using Claude Haiku: $28.10
Cost using Claude Sonnet: $56.90
Saved vs Claude Haiku: $19.40
Saved vs Claude Sonnet: $48.20
Requests routed:
Local: 38%
OSS cloud: 52%
Premium: 10%badgr-auto routes each request to one of four tiers based on task complexity, prompt length, and available endpoints.
| Tier | Where | Used for | Cost |
|---|---|---|---|
edge | Local (Ollama / LM Studio) | Autocomplete, formatting, small edits | $0.00 |
mid | OSS cloud model | Refactor, summarise, normal chat | Low |
async | Background GPU | Embeddings, indexing, batch eval | Low |
premium | Premium model (Claude etc.) | Deep debugging, critical output | Standard |
Override the tier for a request by passing badgr_task_type in the request body (e.g. "badgr_task_type": "autocomplete").
Everything that runs on your machine is open source under the MIT licence. You can read the code, audit what happens to your prompts, and contribute.
badgr-auto startStart the proxy. Runs guided onboarding on first use.badgr-auto stopStop the running proxy.badgr-auto statusShow whether the proxy is running and which port.badgr-auto stats [1d|7d|all]Print token savings and routing breakdown for the given period.badgr-auto modelsList models available through the proxy.badgr-auto loginConnect your AI Badgr account to unlock cloud routing.Install badgr-auto in two minutes. No account needed for local routing.