weave-os/router
Go API gateway for per-request model selection across LLM providers
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Weave Router is a Go API gateway, not a model-serving runtime. It authenticates clients with rk_ bearer keys, calls a separate HMM policy sidecar to classify each turn, then selects an enabled model and forwards the request using an environment-provided or BYOK provider key. The sidecar depends on a compatible embedding service and defaults to Google's embedding API.
PostgreSQL holds installation records, router keys, encrypted BYOK credentials and usage data; it also backs the self-hosted dashboard at /ui. The Go manifest includes Gin, pgx/v5, Tink and Google Cloud Pub/Sub v2. Multiple replicas need Pub/Sub for cache invalidation, and an optional OTLP collector receives traces and usage logs. Client protocol entrypoints and configurable model endpoints are the main integration boundaries.
Key Capabilities & Differentiators
The router exposes Anthropic Messages at /v1/messages, OpenAI Chat Completions at /v1/chat/completions, and Gemini requests at /v1beta/models/:action. Upstreams include Anthropic, OpenAI, Gemini, OpenRouter and OpenAI-compatible endpoints. Streaming, tool calls and vision are supported, but test the exact client and upstream pair before assuming feature parity or broader API compatibility.
POST /v1/route lets you inspect the policy's choice without dispatching a generation request. Usage reporting, routing-decision exports and session cost tracking support a rollout against a direct-provider baseline. The installer covers Claude Code, Codex, Copilot, opencode and pi, with --local available for local setup. Cursor's override applies to Agent and Ask, not Tab completion or Apply; it needs a paid BYOK seat and a URL reachable from Cursor's servers.
Trade-offs & Limitations
Compared with calling OpenAI directly, Weave centralizes model choice and usage tracking across providers, but adds a proxy hop, policy classification and a database to operate. With a remote embedding service, routing also depends on another network call. If one provider and a static model policy suffice, direct integration has fewer moving parts. For a multi-provider rollout, compare end-to-end latency, cost and task success with your direct baseline rather than using routing-only timing or headline savings as deployment targets.
The self-hosted policy is frozen and lacks the managed service's training, online learning and registry. The Compose stub sends every turn to one routing group, so it validates plumbing, not selection quality. Apache-2.0 covers the router code, not upstream API access. Self-hosting puts router configuration and usage records under your control, but your providers still process generation requests, and Google supplies embeddings by default.
Hardware & Deployment Guide
The local bootstrap uses Docker, a checkout, Go 1.26 or later and an upstream API key; go.mod specifies Go 1.26.0 and toolchain go1.26.10. make full-setup starts the router and PostgreSQL and creates a router key. The development Compose stack applies migrations but uses default credentials and a single PostgreSQL instance with no resource limits. Keep it on localhost. Dashboard administration requires ROUTER_ADMIN_PASSWORD; requests can still be routed without it.
The default hmm_embedding policy needs a sidecar to boot. Compose supplies a smoke stub; make up-hmm swaps in the real sidecar for local development, not production. The hmm-model-v1 release packages hmm-router-frozen-v1 as a portable frozen policy artifact, with a published SHA-256 and a google/gemini-embedding-2 contract of 3,072 dimensions. Hosted client setup through npx @weave-os/router requires Node 18 or later. Self-hosting does not make the default stack offline: generation and embedding calls still leave it.
Teams running coding agents or applications across several model providers that want shared routing, separate provider credentials and centralized usage tracking, and can validate the policy on their own traffic.
One provider and a fixed model already meet your needs, you need offline inference out of the box, or you expect the self-hosted policy to learn online like the managed service.
Quick Start & Installation
npx @weave-os/routerComparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| router ★ | 5.7k | +79 | Go | Apache-2.0 | Go API gateway for per-request model selection across LLM providers |
| OmniRoute | 92.1k | +1.5k | TypeScript | MIT | Self-hosted OpenAI-compatible gateway for multi-provider routing and fallback |
| gpt-load | 7.2k | +6 | Go | MIT | Self-hosted Go gateway for routing LLM traffic across providers and credentials |
| bifrost | 10.2k | +125 | Go | Apache-2.0 | Self-hosted Go gateway for routing and governing multi-provider LLM traffic |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/weave-os/router.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about router
How do I connect an existing client and test routing without invoking a generation model?
Does self-hosting require a GPU, and what should I size for?
Can I self-host commercially, and does that keep prompts on my infrastructure?
When is Weave Router preferable to calling the OpenAI API directly?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy