Router

Ask for a model, or ask for a budget.

The router speaks the OpenAI chat-completions protocol and forwards each request to the cheapest live route for the model you named. Name an alias instead and it picks the model from the leaderboard's own numbers, then tells you which one it chose.

base url
http://127.0.0.1:8080/v1
uv run sommelier serve
models
14
74 routes
aliases
5 + ∞
named, bare, and parametric

Alias grammar

owner/nameAn exact Hugging Face repo id from the registry, case-insensitive.
bestHighest index. Ties go to the cheaper model.
cheapestLowest blended price (3:1 input to output). Ties go to the higher index.
fastestHighest measured output tokens per second.
<metric>-under-<usd>Constrain to blended price at most that many dollars per million tokens. best-under-0.25, best-under-$1, fastest-under-0.5.
<metric>-over-<index>Constrain to index at least that value. cheapest-over-80 is the frugal pick that still clears the bar.
default, frugal, …Named aliases from aliases.yaml; each points at a repo id or another expression.

A model without a benchmark never wins best or an -over-constraint; one without a priced route never wins cheapest or an-under- constraint. An unsatisfiable alias returns a 404 that says which constraint emptied the pool.

What the aliases resolve to now

Snapshot from the last data refresh; the running router recomputes on every request.

default
zai-org/GLM-5.3-Flash · $0.14/Mbest-under-0.25: highest index with blended price <= $0.25/M tokens -> zai-org/GLM-5.3-Flash
frugal
openai/gpt-oss-20b · $0.055/Mcheapest-over-50: lowest blended price with index >= 50 -> openai/gpt-oss-20b
best
google/gemini-3.5-flash-lite · $0.85/Mhighest index -> google/gemini-3.5-flash-lite
cheapest
openai/gpt-oss-20b · $0.055/Mlowest blended price -> openai/gpt-oss-20b
fastest
google/gemini-3.5-flash-lite · $0.85/Mhighest output tokens/s -> google/gemini-3.5-flash-lite

Frontier steps

Where best-under-$X changes its answer.

From pricebest-under-$X picksIndex
$0.055/M and upopenai/gpt-oss-20b88.0
$0.070/M and upopenai/gpt-oss-120b88.3
$0.14/M and upzai-org/GLM-5.3-Flash91.0
$0.85/M and upgoogle/gemini-3.5-flash-lite92.0

Using it

Start the router from the repo root. It reads models.yaml, the catalog and the benchmark results, and needs the upstream credentials for the routes it will use: HF_TOKEN for Hugging Face inference providers, OPENROUTER_API_KEY for OpenRouter, and whatever api_key_env a custom endpoint names. Set SOMMELIER_API_KEY to require a bearer token from clients.

uv run sommelier serve --host 0.0.0.0 --port 8080

Then point any OpenAI client at it. The response's model field is the resolved repo id and a sommelier block explains the choice; the same facts travel in the x-sommelier-model and x-sommelier-route headers, so streaming responses carry them too.

curl -s http://127.0.0.1:8080/v1/chat/completions \
  -H 'content-type: application/json' \
  -d '{"model": "best-under-$0.25",
       "messages": [{"role": "user", "content": "Name three dry white grapes."}]}'

# → "model": "google/gemini-3.5-flash-lite",
#   "sommelier": {"requested": "best-under-$0.25", "reason": "…", "route": "…"}
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8080/v1", api_key="unused")
client.chat.completions.create(model="cheapest-over-80", messages=[...])

Other endpoints: GET /v1/models lists every model with its index, price and speed plus the aliases and what each resolves to; GET /v1/resolve/<alias> explains a resolution without spending tokens; GET /api/scoreboard is the leaderboard as JSON.

Adding a model

One line naming the Hugging Face repo. The catalog fetches parameters and licence from the hub and every live route with its price from Hugging Face inference providers and OpenRouter; the benchmark grades it and measures speed on the cheapest route.

uv run sommelier add google/gemini-3.5-flash-lite
uv run sommelier bench google/gemini-3.5-flash-lite

A model the hosted upstreams do not carry, such as a private fine-tune on your own vLLM, takes a mapping entry in models.yaml with an endpoint; everything else stays the same.