Skip to main content

Local LLM router that cuts premium-model spend with adaptive 3-tier routing, OpenAI + Anthropic compatible

Project description

English | 简体中文

UncommonRoute

Cut your LLM costs by 77% with automatic model routing.

Most of your LLM budget goes to simple tasks that don't need a premium model. UncommonRoute picks the cheapest model that still gets the job done — automatically.


Python 3.11+ MIT 2-min setup


UncommonRoute Dashboard


Quick Start

pip install uncommon-route
export UNCOMMON_ROUTE_UPSTREAM="https://api.openai.com/v1"  # or any OpenAI-compatible API
export UNCOMMON_ROUTE_API_KEY="your-key"
uncommon-route serve

Point your client at the proxy — one line change:

client = OpenAI(base_url="http://localhost:8403/v1")
resp = client.chat.completions.create(model="uncommon-route/auto", messages=msgs)
# → simple tasks → cheap model, complex tasks → premium model

Works with Codex, Claude Code, Cursor, the OpenAI SDK, and OpenClaw.

Client-specific setup
Client Change
Codex / Cursor / OpenAI SDK export OPENAI_BASE_URL="http://localhost:8403/v1"
Claude Code export ANTHROPIC_BASE_URL="http://localhost:8403"
OpenClaw Plugin — see openclaw.ai

How It Works

Every request is analyzed by three independent signals, then routed to the cheapest capable model:

"hello"                              → 🟢 nano         $0.0008
"fix the typo on line 3"             → 🟢 deepseek     $0.0012
"refactor this 500-line module"      → 🟠 sonnet       $0.0337
"design a distributed scheduler"     → 🔴 opus         $0.0562
Signal What it does Speed
Metadata Conversation structure, tool usage, depth <1ms
Embedding Semantic similarity to known task patterns ~10ms
Structural Text complexity features (shadow mode) <1ms

Signals vote. The ensemble picks the tier. The router selects the cheapest model in that tier. If uncertain, it leans conservative — better to spend a little more than to fail the task.

It gets smarter over time. Signal weights adjust from routing outcomes. The embedding index grows with usage. Low-confidence predictions automatically escalate.


Why v2

Our v1 classifier hit 88.5% accuracy on clean benchmark data. We shipped it.

Then we tested on real agent conversations — multi-turn, tool-calling, messy context — and accuracy dropped to 43%. More than half the routing decisions were wrong.

We didn't patch it. We rebuilt from scratch.

v1 v2
Accuracy 43% 72.7%
Task pass rate 100% (cheated — always chose most expensive) 90.3% (real routing)
Cost savings 0% 77%

We're telling you this because we'd rather you trust our numbers than be impressed by them.


Benchmarks

Tested on CommonRouterBench — 762 real agent task traces. All numbers measured end-to-end through the production code path.

Metric Value
Cost savings 77% vs always-premium
Task pass rate 90.3%
Routing overhead <10ms
Accuracy 72.7% tier match
python scripts/eval_v2.py  # reproduce it yourself

Dashboard

uncommon-route serve
# → http://localhost:8403/dashboard/

Real-time monitoring, interactive playground, cost tracking, and model routing configuration — all in a Nothing Design-inspired interface.


Configuration

Routing modes

Mode Model ID Behavior
auto uncommon-route/auto Balanced — best quality-per-dollar
fast uncommon-route/fast Cost-first — cheapest acceptable
best uncommon-route/best Quality-first — strongest available

Spend limits

uncommon-route spend set daily 20.00
uncommon-route spend status

BYOK (Bring Your Own Key)

uncommon-route provider add openai sk-your-key
uncommon-route provider add anthropic sk-ant-your-key
All environment variables
Variable Meaning
UNCOMMON_ROUTE_UPSTREAM Upstream OpenAI-compatible API URL
UNCOMMON_ROUTE_API_KEY API key for the upstream
UNCOMMON_ROUTE_PORT Local proxy port (default 8403)

Privacy

Runs entirely on your machine. No data leaves unless you opt in.

uncommon-route telemetry status

Development

git clone https://github.com/CommonstackAI/UncommonRoute.git
cd UncommonRoute && pip install -e ".[dev]"
python -m pytest tests -v

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uncommon_route-0.5.2.tar.gz (596.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uncommon_route-0.5.2-py3-none-any.whl (563.4 kB view details)

Uploaded Python 3

File details

Details for the file uncommon_route-0.5.2.tar.gz.

File metadata

  • Download URL: uncommon_route-0.5.2.tar.gz
  • Upload date:
  • Size: 596.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for uncommon_route-0.5.2.tar.gz
Algorithm Hash digest
SHA256 934266af077daa6b3d5634355910c93593715b60a6bd4ff52df918394e56a2ae
MD5 7173ef588f8a2a1b89882391704c0d00
BLAKE2b-256 3ea728aa6aa5d2ed06ea8826fc8a9b27935aa1eb3cb3c6c4b05cea15d1a7f990

See more details on using hashes here.

File details

Details for the file uncommon_route-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: uncommon_route-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 563.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for uncommon_route-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fd1b13546584f9863232ec170bc7a895947507b8710ff0ace7497da1865b1f9d
MD5 552d0c9f69deb90c989f6a90f6eee42d
BLAKE2b-256 6d2a4b50f889ce5fb8f0cb86fef8ba008e79c3614219c2cb75e548a2239d64d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page