YX Smart Route
100% local. Configurable routing for YX AI gateway traffic.
YX Smart Route is a VS Code extension that runs a local proxy in front of YX's AI gateway. When the client model is auto, it picks a model by task complexity. Any other model name is forwarded unchanged.
Default behavior:
- Gateway base URL has a default value.
- Plugin API key is empty by default.
- If the plugin API key is empty, requests use the incoming user
Authorization header.
- Classifier model, routing strategy, and
auto model mapping are configurable.
What It Does
YX Smart Route sits between your AI client and the configured gateway and only does smart routing.
Everything runs on localhost. No extra cloud service is introduced by the plugin itself.
Quick Start
- Install YX Smart Route
- (Optional) Open Settings →
@ext:YX.yx-smart-route and tweak gatewayRoute.* (gateway address, model map, pricing, etc.)
- Click the YX Smart Route icon in the activity bar to open the dashboard — the proxy + dashboard start automatically.
- In your AI client (Cursor / Continue / etc.), set your OpenAI-compatible
baseUrl to:
http://127.0.0.1:8787/v1
🛡️ Transparent-intercept safety net (VS Code extension host only). By default, any request from within the VS Code / Cursor Node.js extension process to aiapi.yxrobot.com is silently rewritten to 127.0.0.1:8787, so the routing pipeline still applies even if you accidentally point the client at the company gateway directly. To change or disable this list, edit gatewayRoute.interceptHosts.
Scope of interception: It only affects Node.js code running inside the VS Code extension host (fetch / undici / https.request). For standalone clients (a separate Continue server, curl, Postman, a remote AI agent, etc.), you must still configure baseUrl = http://127.0.0.1:8787/v1 on that client.
The default gateway address is already filled in. If you leave the plugin API key empty, the proxy forwards the incoming request key.
How it works
AI Client → localhost:8787 (YX Smart Route) → YX AI Gateway
A chat completion whose model is auto is classified locally and sent to the configured simple, moderate, or complex model. The prompt is not cached, compressed, or redacted.
Features
🔒 Local proxy
- Routing runs on
localhost
- Request traces stay in the local dashboard
- No analytics, no telemetry, no cloud sync
⚡ Model Router — Route Requests to the Right Model
The router classifies requests locally (no classifier API call needed for common patterns):
- Short messages under 80 characters with no code-write keywords → simple
- "Explain", "describe", "list", "show me", "what is", "summarize" questions → simple
- Git/bash/terminal one-liners → simple
- "Write", "implement", "fix", "refactor", "create" → moderate / complex
For ambiguous requests, a background classifier can run and cache the result for next time. Zero latency on the current request.
Modes: balanced (default) · aggressive (moderate tasks also → Haiku) · conservative (no routing)
📊 Live Dashboard
- Open: status bar click, or
Ctrl+Shift+P → YX Smart Route: Show Dashboard
- Shows: estimated savings from routing, model routes, per-request trace table
- Real-time updates via SSE
- Route all windows ↺: restarts the VS Code extension host so existing Claude Code windows start routing through the proxy
- Export all traces to CSV
- Proxy status: 🟢 connected / 🔴 offline
Configuration
Ctrl+, → search YX Smart Route
| Setting |
Default |
Description |
gatewayRoute.proxyPort |
8787 |
Local proxy port |
gatewayRoute.modelRouterStrategy |
balanced |
balanced / aggressive / conservative |
Commands
Ctrl+Shift+P → type YX Smart Route
| Command |
Description |
YX Smart Route: Show Dashboard |
Open the live savings dashboard |
YX Smart Route: Toggle ON/OFF |
Pause or resume the proxy |
YX Smart Route: Start Proxy Server |
Start the local proxy |
YX Smart Route: Stop Proxy Server |
Stop the local proxy |
Cost Estimates
Savings shown in the dashboard are estimates based on Anthropic's public per-token pricing and the token delta between the original request and what was actually sent. Verify against your Anthropic console.
Troubleshooting
Dashboard shows "Proxy offline"
Proxy failed to start. Output panel → YX Smart Route for errors.
All requests still going to Sonnet
Check whether your AI client base URL points to the local proxy, and whether the gateway accepts the forwarded model.
No data in the dashboard
Send at least one request through the local proxy after installing.
Technical Notes
- The extension patches
https.request, globalThis.fetch, and the undici dispatcher in the VS Code extension host at startup
- Internal classifier and compaction calls use an internal header so they bypass the optimization pipeline and do not loop
- The proxy captures the original
https.request before patching, so forwarding to the gateway remains direct
Contributing
Issues and PRs are welcome in your repository for YX Smart Route.
- One thing per PR
- No speculative abstractions
- Open an issue before fixing a bug