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.1.tar.gz (596.6 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.1-py3-none-any.whl (563.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uncommon_route-0.5.1.tar.gz
  • Upload date:
  • Size: 596.6 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.1.tar.gz
Algorithm Hash digest
SHA256 ab99279aa1412eeed09ef349740b68a11ddfca71ab2df0037d0b536d2371cde9
MD5 5706698d6eff1d898cb0d0e1945c0562
BLAKE2b-256 73ffdf51c73695e44d23a76c02dd456b4e50ec0eaa93a119c3716c7ed7b551bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: uncommon_route-0.5.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2705bcc98a1c299d41b8e4e8fd5a7aaa29cc50a0fc983d7b60b7568323358f2f
MD5 69b53ed4ae6f9bb4ce48ea8e4e0de7db
BLAKE2b-256 fcdd281552aaad888534e200544239c05ce270fdda28631e3c37b8a40c91c157

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