Find your next open-source project

Search by name, purpose, or keyword, or paste a GitHub URL. Start with / to search agent skills (e.g. /pdf)

weave-os/router

AI Engineering

A self-hostable proxy that routes each LLM API request to a suitable model across Anthropic, OpenAI and Gemini.

This project ships 29 agent skillsSkill list and install →
5,703
197
Go
Apache-2.0
7 months old

What it does

Weave Router is a Go proxy that sits in front of model providers and picks a model for every API request. It speaks the Anthropic Messages, OpenAI Chat Completions and Gemini request formats, so coding tools such as Claude Code, Codex, Copilot, opencode, pi and Cursor — or your own application — can point at one endpoint instead of managing model choice themselves. Streaming, tool calls and vision are supported.

Selection is driven by an HMM classifier policy over the enabled models. A POST /v1/route endpoint exposes the routing decision without actually calling a model, which is useful for inspecting behavior. The project ships both a hosted service and a self-hosted stack (router, HMM sidecar, Postgres, dashboard), with OpenTelemetry tracing for observability.

Quick start

For the hosted router, Node 18+ is required:

npx @weave-os/router

Follow the setup prompts, then obtain a router key from the hosted setup page or from the Weave dashboard under Settings → API keys. To configure a specific tool directly, add its flag, e.g. npx @weave-os/router --codex; the installation guide lists what changes per tool and how to switch back (off), re-enable (on) or uninstall. Cursor needs a publicly reachable base URL because it calls from its own servers, not localhost.

To self-host, you need Docker, Go 1.26+, a provider API key and a local checkout:

git clone https://github.com/weave-os/router.git
cd router
echo 'OPENROUTER_API_KEY=sk-or-v1-...' >> .env.local
echo 'ROUTER_ADMIN_PASSWORD=replace-with-a-strong-password' >> .env.local
make full-setup

This starts the router and Postgres, creates a router key (rk_...) and offers to set up Claude Code. The router listens on :8080 and the dashboard on /ui/. A request looks like:

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

See the endpoint reference for health checks and other routes, and the configuration reference for provider options.

Constraints

  • The self-hosted HMM sidecar is a frozen, barebones version of the policy and lacks the managed service's training, online learning and registry. The local compose stack defaults to a stub classifier that puts every turn in one routing group; make up-hmm swaps in the real sidecar, and its default embedding service calls Google's embedding API.
  • Cursor routes Agent and Ask chats through the router but calls the base URL from its servers, so localhost is unreachable; Tab completion and Apply stay on Cursor's own models, and BYOK requires a paid Cursor seat.
  • Without ROUTER_ADMIN_PASSWORD, inference works but dashboard administration is disabled. Multi-replica deployments also need Pub/Sub for cache invalidation.
  • Provider keys either come from environment variables or are stored encrypted as BYOK in Postgres.
  • Licensed Apache-2.0 from router-v0.2.24 onward; earlier releases keep their original licenses.

HotRepo's take

The repository was recorded on the Go daily list on 2026-12-04 at position 2 with 15 stars gained, against a total of 5,696 stars and 197 forks. That places it well inside the language leaderboard on that day, which fits a project whose problem — one endpoint and automatic model choice for agentic tools — is broadly shared across coding-agent users. The repo carries 17 skill folders under install/codex-skills, so the Codex integration is more than a thin config shim. The README's 40–70% cost-reduction figure is a product claim, not something the repository materials independently measure; the routing behavior itself remains inspectable through /v1/route.

Written by AI from the project's public information and HotRepo's records, updated . The project's own docs are the source of truth.

You might also like

  1. lidge-jun/opencodexA local proxy that routes Codex, Claude Code, and other coding tools to any LLM provider.TypeScript18,469
  2. experientiallabs/experientialA self-hostable gateway that routes agent traffic across providers, then turns collected traces into custom routers or models.Python12,389
  3. vllm-project/semantic-routerGives an agent harness one API endpoint that picks or combines models per call according to your policy.Go6,310
  4. NVIDIA-NeMo/SwitchyardA Rust routing library that lets AI agents and LLM gateways pick a model per request.Rust3,615
  5. llm-d/llm-d-routerRoutes LLM inference requests across model servers using cache and load awareness, deployed on Kubernetes.Go436