█

AI/TLDR

Buy me a coffee
Buy me a coffee

Weave Router

One endpoint that picks the right model for every request

Gateways & RoutingOpen core
Latest
router-v0.2.24
Updated
24 Sep 2026
Language
Go
License
Apache-2.0 (from router-v0.2.24; earlier releases shipped under the Elastic License 2.0)
Coverage
1 story
$npx @weave-os/router

What's new

router-v0.2.2424 Sep 2026

The router moved from the Elastic License 2.0 to the Apache License 2.0, starting with router-v0.2.24 (npm @weave-os/router and @workweave/router 0.2.24). Earlier tags and packages keep the licenses they shipped with.

Latest news

IN SHORT

What is Weave Router?

Weave Router is a drop-in proxy that speaks the Anthropic Messages, OpenAI Chat Completions and Gemini native APIs, including streaming, tools and vision. It sits in the Gateways & Routing category of the Evaluation & Production Ops tools and is open-source, written in Go and licensed Apache-2.0 (from router-v0.2.24; earlier releases shipped under the Elastic License 2.0).

Updated Markdown version ↗

Overview

Weave Router is a drop-in proxy that speaks the Anthropic Messages, OpenAI Chat Completions and Gemini native APIs, including streaming, tools and vision. You point Claude Code, Codex, opencode, pi, Cursor or your own application at it instead of the provider, and it decides which model should answer each individual request rather than making you pick one model for a whole session.

The decision is made by a cluster scorer derived from the Avengers-Pro routing paper, running as an in-process ONNX embedder on the same box — not by asking another model to guess. The project's terminology is that it routes per action, not per turn, so a single agent run can mix a cheap model for routine steps with a frontier model for the hard ones. Alongside the hosted providers it can reach open-weight models such as DeepSeek, Kimi, GLM, Qwen, Llama and Mistral through OpenRouter or any OpenAI-compatible endpoint. An optional HMM policy sidecar can run next to the router as an alternative strategy.

In a self-hosted deployment the router, the scorer, Postgres and your provider keys all stay on your machine, with BYOK keys encrypted at rest; prompts go from the router straight to the configured provider, never to Weave. The router emits OTLP traces, shows routing decisions in a bundled dashboard, and returns per-request cost headers. Weave also runs a hosted router that the npm installer points at by default. The code is published by Workweave under the Apache License 2.0 starting with the router-v0.2.24 release line (September 2026); earlier tags keep the Elastic License 2.0 they shipped with.

What it does

  • Per-action routing driven by an on-box cluster scorer derived from Avengers-Pro, not a prompt-based heuristic
  • Speaks Anthropic Messages, OpenAI Chat Completions and Gemini native, with streaming, tools and vision supported
  • Reaches open-weight models — DeepSeek, Kimi, GLM, Qwen, Llama, Mistral — via OpenRouter or any OpenAI-compatible endpoint
  • Bring-your-own-key by default: provider keys stay on your box and are encrypted at rest
  • A /v1/route endpoint that returns the routing decision without calling upstream, plus per-session cost and savings and an NDJSON export of raw routing decisions
  • OTLP traces out of the box, viewable in the built-in dashboard or exported to Honeycomb, Datadog or Grafana
  • An npm installer that wires up Claude Code, the Codex CLI, opencode or pi at user or project scope, with on/off/status switches and model enable/disable from the terminal

Getting started

The npm installer is the fastest path: with no flags it opens the hosted setup page, and flags pick a client, a scope or a self-hosted router. Self-hosting boots the router and dashboard on your own machine.

Wire up your agent

Requires Node 18 or newer (the Claude Code, opencode and pi paths also need jq). The bare command opens the hosted setup page; the flags install directly from the terminal. Project scope commits the settings file to the repo, and --local targets a self-hosted router on localhost:8080.

bashbash
npx @weave-os/router
npx @weave-os/router --claude
npx @weave-os/router --codex
npx @weave-os/router --scope project
npx @weave-os/router --local

Or self-host the stack

Drop a provider key into .env.local — OpenRouter is the recommended baseline — and set a dashboard password (without one, inference still runs but dashboard administration is disabled). Then bring up Postgres and the router on port 8080; the setup seeds an rk_ router key and prints it in the logs.

bashbash
echo "OPENROUTER_API_KEY=sk-or-v1-..." >> .env.local
echo "ROUTER_ADMIN_PASSWORD=replace-with-a-strong-password" >> .env.local
make full-setup

Call it like your usual provider

The same endpoint answers Anthropic-shaped and OpenAI-shaped requests; the router chooses the model behind it. Clients send the rk_ key as a Bearer token — your upstream provider key stays in .env.local.

bashbash
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"}]}'

curl -sS http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer rk_..." \
  -d '{"model":"gpt-4o-mini",
       "messages":[{"role":"user","content":"hi"}]}'

Inspect and toggle routing

Peek at a routing decision without proxying, watch traffic in the dashboard at http://localhost:8080/ui/, and switch a client back to its normal provider without losing the router config.

bashbash
curl -sS http://localhost:8080/v1/route -H "Authorization: Bearer rk_..." -d '...'

npx @weave-os/router off --claude
npx @weave-os/router status --claude
npx @weave-os/router models --claude

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Cut the cost of an agentic coding session by sending routine steps to a cheap model and only the hard ones to a frontier model
  • Give a team one endpoint that fronts several providers, so model choice is a server-side policy rather than a per-developer setting
  • Mix hosted and open-weight models behind a single API without changing application code
  • Trace which model answered which request, and at what cost, from the bundled dashboard, the analytics export or an existing OTLP backend

Version history

Every verified update to Weave Router that AI/TLDR tracked, newest first — each links to our coverage and the official changeset.

  1. 2026-09-24router-v0.2.24

    The router moved from the Elastic License 2.0 to the Apache License 2.0, starting with router-v0.2.24 (npm @weave-os/router and @workweave/router 0.2.24). Earlier tags and packages keep the licenses they shipped with.

  2. 2026-06-27

    Weave open-sourced the router: a proxy for Claude Code, Codex and Cursor that scores each prompt with an on-box embedder and forwards it to the best model across Anthropic, OpenAI, Gemini and OpenRouter providers. The repository has since moved from workweave/router to weave-os/router, and the npm package from @workweave/router to @weave-os/router (the old name stays as a compatibility alias).

How Weave Router compares

Weave Router alongside other open-source gateways & routing tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
OmniRoute★ 91.4kA local-first AI gateway that fronts hundreds of model providers with one OpenAI-compatible endpoint, quota-aware auto-fallback, many routing strategies and prompt compression.
Free Claude Code★ 74.7kA local proxy that points Claude Code, Codex, Pi, OpenCode, Cline and other agent CLIs at 50 free, paid, subscription or local model providers, with automatic failover and an admin UI.
LiteLLM★ 64.2kA Python SDK and proxy server that gives one OpenAI-compatible API to 100+ LLM providers, with cost tracking, budgets, fallbacks, rate limiting, and an admin UI.
Kong Gateway★ 44.4kA Lua/NGINX API gateway whose AI Gateway plugins put one universal endpoint in front of OpenAI, Anthropic, Gemini, Bedrock and other providers, with semantic routing, caching and MCP traffic governance.
magpie★ 43.7kMenu bar app and local gateway that lets Claude Code, Codex, Gemini CLI and dozens of other coding agents run on any provider's model, with routing groups that fail over across accounts when a quota runs out.
9Router★ 33kLocal OpenAI-compatible router for coding CLIs that tracks per-provider quota, falls back from subscription to cheap to free models, and compresses tool results to cut tokens.
Experiential★ 20.1kAn open-source gateway that puts hosted, BYOK, local and custom models behind one OpenAI-compatible API, with per-identity model and spend limits and routers fitted from your own traces.
Weave Router★ 5.6kOne endpoint that picks the right model for every request