One Endpoint, Every Model: Routing Your AI Coding Agents Through a Local Proxy
Weave's open-source router picks a model per request using an on-box embedder, not a prompt. Setup, a routing histogram hack, and the trade-offs.
A router sits between your editor and the model. It reads the request, scores it, and sends it to whichever model is actually good at that turn. The Weave Router — published as workweave/router on GitHub and surfaced on Hacker News this week — does exactly that for Claude Code, OpenAI’s Codex CLI, opencode, and (in early beta) Cursor. One local endpoint at localhost:8080, three provider APIs spoken natively (Anthropic Messages, OpenAI Chat Completions, Gemini generateContent), and a decision made per request rather than per session.
The interesting part is not the proxy. Proxies are old. The interesting part is how it decides. The README states the mechanism plainly: a cluster scorer running a small on-box embedder, derived from the Avengers-Pro work (Zhang, Y. et al., arXiv:2508.12631, 2025, Beyond GPT-5: Making LLMs Cheaper and Better via Performance–Efficiency Optimized Routing). Not a prompt asking a large model which small model to use. An embedding, a cluster assignment, a table lookup. That is a measurable claim, and it is the one worth your afternoon.
Why an embedder and not a prompt
Routing-by-prompt costs a full inference to decide who does the inference. It also inherits every failure mode of the model doing the judging. Routing-by-embedding costs a forward pass through a model small enough to run on your laptop, and it produces a vector you can cluster offline, once, against benchmark performance per cluster. So the decision becomes: which cluster does this request fall into, and which model historically scored best in that cluster at what price.
PAZ’s concept panel on attention describes the underlying operator — every token sees every other token in one matrix multiplication, at O(n²·d) cost, with the dot products scaled by √d to keep gradients well-behaved. An embedder is that machinery run once and collapsed to a single vector. Cheap, deterministic, no persuasion involved. The router’s POST /v1/route endpoint returns the decision without proxying the call, which means you can inspect the classifier’s judgement before you trust it. Any router that will not show you its reasoning is asking for faith you should not extend.
←TODAY: Your studio pays flat frontier-model rates for turns that a mid-tier model would answer identically.
→3012: Model choice becomes infrastructure — invisible, logged, and audited like electricity metering.
Fulcrum: The moment routing is a measurable decision rather than a habit, cost stops being a subscription and becomes a design variable.
The Tool: workweave/router is an open-source drop-in proxy built by Weave, an engineering-intelligence company whose README names Robinhood, PostHog and Reducto among its users. It speaks all three provider formats with streaming, tools, and vision intact, and reaches DeepSeek, Kimi, GLM, Qwen, Llama and Mistral through OpenRouter or any OpenAI-compatible endpoint. Provider keys stay on your machine, encrypted at rest (BYOK by default), and it emits OTLP traces you can point at Honeycomb, Datadog, Grafana, or its own bundled dashboard. For a computational-design studio that already runs Claude Code against Grasshopper definitions and IFC scripts, this is the difference between an opaque bill and an observable one.
Setup:
# Fastest path: hosted router, no clone, no Docker (Node >= 18, jq for Claude Code)
npx @workweave/router --claude
# Or self-host the whole stack on your own box:
git clone https://github.com/workweave/router
cd router
echo "OPENROUTER_API_KEY=sk-or-v1-..." >> .env.local
make full-setup # boots Postgres + router on :8080, seeds an rk_ key
# Prove it works — call it exactly like the Anthropic API:
curl -sS http://localhost:8080/v1/messages \
-H "Authorization: Bearer rk_..." \
-d '{"model":"claude-sonnet-4-5","max_tokens":256,
"messages":[{"role":"user","content":"hi"}]}'
First steps:
- Run the install command for your client. Choose
--scope projectif you want the routing config committed per repo — it writessettings.json,.codex/config.toml, oropencode.jsonnext to the code rather than into your home directory. For a studio with shared definitions, per-repo is the honest choice. - Open the dashboard at
http://localhost:8080/ui/(default passwordadmin— change it before anyone else is on the network). Every routed request appears with its chosen model. - Send five real requests from your actual work: a Grasshopper Python refactor, an IFC property-set query, a short docstring, a long architectural-decision question, a regex. Then read the dashboard and see which model each one landed on.
- Toggle it off with
npx @workweave/router off --claudeand run the same five again against the provider directly. Compare output quality and cost. That comparison is the whole experiment.
The trade-off, stated plainly
You are inserting a network hop and a third party’s classifier into every model call your studio makes. If the router is down, your agent is down — which is why the README splits liveness (/health) from dependency readiness (/readyz) and a key check (/validate), and why the off command exists as a first-class feature rather than an uninstall. The Cursor path is explicitly labelled early beta with performance that “may not be the best”. And a cluster scorer trained on public benchmarks knows nothing about whether a model is good at GDL or IFC schema work specifically; it knows what the benchmark clusters looked like. Marktechpost’s 14 July 2026 comparison of Mistral Vibe for Code, Claude Code, Cursor and OpenAI Codex — four agents scored on one scaffold-to-PR task — is a reminder that agent quality is task-shaped, and AEC tasks are not in anyone’s benchmark suite.
Atelier: An office adopting AI coding agents usually discovers its spend problem three months in, when someone reads the invoice and nobody can say which work produced it. A router with OTLP traces makes that question answerable before it becomes an argument. Monday move: install the router in --scope project mode on your one repo that sees the most agent traffic, leave it running for a week with no routing changes, and read the dashboard on Friday — you are buying the measurement first, the savings second.
Hack: Ask the router what it would do, without spending a token upstream. The /v1/route endpoint returns the decision only — no proxying, no completion, no cost. Pipe a batch of your real prompts through it and you get a routing histogram for your actual workload in about a minute.
for f in prompts/*.txt; do
jq -Rn --rawfile p "$f" '{model:"claude-sonnet-4-5",messages:[{role:"user",content:$p}]}' |
curl -sS http://localhost:8080/v1/route -H "Authorization: Bearer rk_..." -d @-
done | jq -r '.model' | sort | uniq -c | sort -rn
Run that against thirty prompts from your last sprint. If 80% route to one model, the router is not earning its hop for your workload and you should turn it off. If they spread across three, you have found real headroom. Either way you learned it for free.
Provenance, since this is a routing decision
Two things in this piece are load-bearing and both are checkable: the Avengers-Pro paper the cluster scorer derives from (Zhang et al., arXiv:2508.12631, 2025), and the repository’s own README, which is where every command above comes from. The HMM policy sidecar mentioned in the docs is opt-in, runs as a companion container behind make up-hmm, requires a Google API key, and does not change the default in-process cluster scorer — do not confuse the two when reading the architecture notes. Two keys, likewise, do different jobs: sk-or-…/sk-ant-… is your upstream provider key and lives in .env.local; rk_… is the router key your clients send as a Bearer token. Confidence in the mechanism: high, because it is documented and inspectable. Confidence that it saves your studio money: unknown until you run the histogram above. Publish the doubt alongside the claim; a confident sentence with no source is a future error with a head start.
Learn-it:
- Repo and full docs: github.com/workweave/router — start with the configuration reference for every env var and the BYOK encryption model.
- The routing research: Avengers-Pro — Beyond GPT-5: Making LLMs Cheaper and Better via Performance–Efficiency Optimized Routing.
- Know what you are routing between: Claude models overview — the capability/price table you are implicitly optimising against.
- Agent-quality context: Four agents scored on one scaffold-to-PR task.
- PAZ note: the attention concept panel in the Kaffipedia explains the O(n²·d) operator inside the on-box embedder — read it before you argue about whether embedding-based routing is “real” classification.
Install it in project scope on one repo, run the /v1/route histogram against thirty prompts from your last sprint, and decide from your own numbers — not from this article.
SOURCE · ↗
PAZ Kaffi · multidisciplinary editorial, led by PAZ Academy