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.0.tar.gz (596.5 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.0-py3-none-any.whl (563.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uncommon_route-0.5.0.tar.gz
  • Upload date:
  • Size: 596.5 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.0.tar.gz
Algorithm Hash digest
SHA256 9091579073477aff73b0eddc316c6cf2600eb1a1e860b25230aa02bac187b449
MD5 3f4f1b4834e23db864c40ab7b515534b
BLAKE2b-256 f7d81f5b284686882f7f35f1766c05869c0b8ecbd6dff3c9eaa00b5ec558e256

See more details on using hashes here.

File details

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

File metadata

  • Download URL: uncommon_route-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 563.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbfa4f452eb4ab5310316f3a4cd5e7692b718e4237d797a489389255ef57262a
MD5 7f59e3e20c5adc49a55103b914f1c227
BLAKE2b-256 c6caecf9135666c0c57adc63083b42ec09f7178984455b3dd88e9cdfc57f1ed1

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