Skip to content
| Marketplace
Sign in
Visual Studio Code>Machine Learning>YX Smart RouteNew to Visual Studio Code? Get it now.
YX Smart Route

YX Smart Route

JackXu

|
2 installs
| (0) | Free
100% local transparent proxy for YX's AI gateway. Routes requests by complexity, supports configurable classifier and model mapping, and includes caching, compression, context compaction, PII redaction, and a live dashboard.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

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. It supports configurable model routing, semantic cache, prompt compression, context compaction, PII redaction, and a live dashboard for observing request savings.

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:

  • Cache answers to repeated or similar questions — pay once, reuse forever
  • Compress prompts by removing filler and whitespace — 5–20% fewer tokens every request
  • Route requests by complexity using configurable models
  • Compact long conversations so old context can be summarized instead of always replayed
  • Mask PII before anything leaves your machine

Everything runs on localhost. No extra cloud service is introduced by the plugin itself.


Quick Start

  1. Install YX Smart Route
  2. (Optional) Open Settings → @ext:YX.yx-smart-route and tweak gatewayRoute.* (gateway address, model map, pricing, etc.)
  3. Click the YX Smart Route icon in the activity bar to open the dashboard — the proxy + dashboard start automatically.
  4. 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

Every request passes through a 5-stage local pipeline before reaching the configured gateway:

Stage What it does Typical saving
PII Filter Detects emails, phone numbers, credit cards, API keys, IBANs. Replaces them with safe tokens before sending. Reversed in the response. Privacy
Semantic Cache Embeds each question and compares against a local cache (cosine ≥ 0.92). Identical or near-identical questions get the cached response instantly — no API call. 100% on hits
Prompt Compression Strips filler phrases ("Sure!", "Of course!"), collapses whitespace, trims oversized tool results and repeated content. 5–20% per request
Context Compaction When conversations exceed ~20 turns, the configured summarizer model condenses older turns into a compact block. Old turns dropped, recent turns kept. Shorter context = fewer tokens on every subsequent message. 30–60% on long sessions
Model Router Classifies request complexity locally and maps simple / moderate / complex to your configured models. Zero added latency for recognized patterns. Up to 10× on simple tasks

Features

🔒 100% Local — No Data Leaves Your Machine

  • All processing happens on localhost
  • The semantic cache, conversation summaries, and traces are stored only in VS Code workspace state
  • The dashboard polls localhost:8787 — no external calls
  • PII masking runs before any data is sent to the gateway
  • 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)

💾 Semantic Cache — Ask Once, Pay Once

  • Compares each question against cached answers using cosine similarity
  • Threshold: 0.92 by default (configurable)
  • Cache size: 500 entries with LRU eviction
  • Works across VS Code sessions

✂️ Prompt Compression

  • Removes conversational filler
  • Collapses blank lines and redundant whitespace
  • Trims oversized tool results and duplicate file contents
  • Never modifies code blocks or technical content

📝 Context Compaction — Long Conversations, Short Bills

  • Triggers automatically after ~20 message turns
  • The configured summarizer model extracts variables, file paths, decisions, task state, constraints, and resolved errors
  • Summary injected into system prompt; old turns dropped
  • Background execution: current request unaffected; compaction applied from next request
  • Cached by content hash — old turns are never summarized twice

🛡️ PII Filter

  • Detects: email addresses, phone numbers, credit card numbers, IBANs, API keys, SSNs
  • Replaces with readable tokens: [EMAIL_1], [PHONE_1], [API_KEY_1]
  • Reversed in the response so your output reads normally
  • VS Code warning notification on detection (throttled to once per 30 seconds)

📊 Live Dashboard

  • Open: status bar click, or Ctrl+Shift+P → YX Smart Route: Show Dashboard
  • Shows: tokens saved, cost saved (estimated), cache hit rate, 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.profile object Unified gateway, routing, and feature configuration
gatewayRoute.enableCache true Semantic response cache
gatewayRoute.cacheThreshold 0.92 Similarity cutoff (0–1)
gatewayRoute.enableModelRouter true Route requests by complexity
gatewayRoute.modelRouterStrategy balanced balanced / aggressive / conservative
gatewayRoute.enablePromptCompression false Strip filler and whitespace
gatewayRoute.enablePiiRedaction false Detect and mask PII

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
YX Smart Route: Clear Semantic Cache Wipe the semantic cache

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
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft