PromptRouter 🧠🚀
Stop burning API dollars on simple prompts. The ultra-intelligent, cost-slashing AI prompt router & autonomous coding agent for VS Code Copilot Chat — save up to 65% on your monthly AI bill with zero drop in answer quality.
💸 Why PromptRouter?
If you use GitHub Copilot Business or Enterprise, your prompts default to expensive heavyweight models (like Claude 3.5 Sonnet or GPT-4o) whether you're asking how to center a div or designing a distributed microservice.
PromptRouter changes the game. It acts as an autonomous neural traffic controller & direct coding agent inside VS Code:
- Simple question? ("How do I format a date in TS?") ⚡ Routed instantly to fast, ultra-cheap models (
gpt-4o-mini).
- Hard architecture problem? ("Debug this race condition in Rust") 🚀 Escalated dynamically to elite reasoning engines (
claude-3.5-sonnet, gpt-4o).
- Need code changes? 🛠️ Direct Agent Mode automatically generates full code implementations and writes them directly into your workspace files — no manual copy/pasting needed.
📊 Proven ROI: PromptRouter cuts total token spend by over 60% while preserving top-tier response accuracy.
🧠 The 6-Layer Intelligence Pipeline
PromptRouter evaluates every prompt in real-time across a 6-layer cognitive pipeline to compute a precision Complexity Score (0-100):
- 🔍 Local Heuristic Classifier: Real-time regex & keyword scanning for technical depth, syntax density, and architectural complexity.
- 🤖 Meta-Model Router: Queries a lightweight sub-agent (
gpt-4o-mini) for an instantaneous difficulty score.
- 📈 Conversation Escalation Engine: Detects thread depth and developer frustration signals ("still failing", "stack overflow") to auto-upgrade model tiers mid-session.
- 💻 Language Context Sensor: Bumps complexity automatically for high-tier languages (e.g. C++, Rust, Assembly vs HTML/CSS).
- 🔁 Adaptive Feedback Memory: Learns from your
/feedback-up and /feedback-down ratings. If a cheaper model struggled with a specific topic, PromptRouter remembers and upgrades next time.
- 🛡️ Budget Guardrail Enforcer: Tracks monthly token usage against your target budget and throttles model tiers before overages occur.
Every response from @promptrouter includes a live visual breakdown of how your request was routed:
> 🔮 **PromptRouter Intelligence Pipeline**
> ├─ 🔍 **Local Heuristics:** Keyword & Code Analysis Active
> ├─ ⚡ **Meta-Router (gpt-4o-mini):** Complexity Rated **45/100**
> ├─ 📂 **File Context:** rag_agent.py (python)
> └─ 🎯 **Final Route:** **GPT-4o** *(Score: 65/100 | Tier: Advanced | Mode: Agent 🛠️)*
🛠️ Direct Workspace Agent Mode
When you ask PromptRouter to modify or create files (e.g., @promptrouter make changes in rag_agent.py and create a new agent):
- Auto File Discovery: PromptRouter automatically locates
rag_agent.py in your workspace and loads its code context.
- Direct Code Mutation: PromptRouter generates the complete implementation and automatically writes the code directly into your workspace files via
vscode.workspace.applyEdit.
- Multi-File Updates: Handles multiple file edits in a single turn, opening updated files side-by-side in your editor.
📊 Detailed Analytics & Financial Dashboard (/stats)
Run @promptrouter /stats at any time to open your live financial dashboard:
- 💸 Unrouted Baseline Cost: What your prompts would have cost on default premium models ($5.00/1M).
- ⚡ Routed Actual Cost: What you actually paid using PromptRouter.
- 💰 Net Dollars Saved ($): Exact savings calculated across all sessions.
- 📈 Tier Progress Bars: Visual ASCII charts showing
gpt-4o-mini vs gpt-4o/claude usage ratio.
- 🔋 Monthly Quota Health: Real-time tracking of your monthly token allowance.
🎮 Slash Commands
| Command |
Action |
@promptrouter /stats |
Open the detailed financial dashboard, savings breakdown, and visual progress bars |
@promptrouter /budget |
Inspect monthly token budget and remaining quota |
@promptrouter /models |
Print active 10-tier model routing hierarchy & supported model registry |
@promptrouter /feedback-up |
Train PromptRouter that the last routing was accurate |
@promptrouter /feedback-down |
Flag poor routing so PromptRouter auto-escalates next time |
⚙️ Model Hierarchy & Configuration
Customize your routing hierarchy via VS Code Settings (Cmd/Ctrl + , -> search "PromptRouter"), models.config.json, or a workspace .promptrouter.json file:
| Tier |
Default LLM |
Ideal Target Use Case |
| Trivial |
gpt-4o-mini |
Syntax lookups, docstring generation |
| Basic |
gpt-4o-mini |
Simple how-tos & formatting |
| Simple |
gpt-4o-mini |
Standard helper function generation |
| Moderate |
gpt-4o-mini |
Component scaffolding |
| Intermediate |
gpt-4o-mini |
Multi-file standard logic |
| Standard |
gpt-4o-mini |
Moderate refactoring & unit tests |
| Advanced |
gpt-4o |
Complex algorithms & edge case handling |
| Complex |
gpt-4o |
Heavy debugging & concurrency analysis |
| Expert |
claude-3.5-sonnet |
High-level system architecture design |
| Master |
claude-3.5-sonnet |
Deep theoretical & distributed systems problems |
🔒 Privacy & Security First
PromptRouter runs 100% locally in your VS Code editor. Your prompts, code snippets, and workspace files never touch any third-party telemetry servers.
Made with ❤️ by Madhav Anand.