router README

The project's README from github.com/weave-os/router. As one markdown file: README.md.

Group 1(1)

One endpoint. Every model. Always the right one.

A drop-in proxy for Anthropic, OpenAI, and Gemini that picks the best model for every request: using a tiny on-box embedder, not a vibes-based prompt.

Weave Badge Go Tests License: ELv2 Managed deployment

Built by Weave: The #1 engineering intelligence platform, loved by Robinhood, PostHog, Reducto, and hundreds of others.


What it does

Point Claude Code, Codex, Cursor, or your own app at localhost:8080. The router:

30-second quickstart

The fastest way: point Claude Code, Codex, opencode, or pi at the hosted Weave Router with one command. No clone, no Docker, no Postgres.

npx @weave-os/router

That's it. The installer asks which tool (Claude Code, Codex, opencode, or pi), walks you through scope (user vs. project), grabs a router key, and wires the right config file. Other flavors:

npx @weave-os/router --claude              # skip the picker, Claude Code
npx @weave-os/router --codex               # skip the picker, OpenAI Codex CLI
npx @weave-os/router --opencode            # skip the picker, opencode
npx @weave-os/router --pi                  # skip the picker, pi + Loom UI
npx @weave-os/router --scope project       # per-repo, commits settings.json (or .codex/ / opencode.json)
npx @weave-os/router --local               # self-hosted localhost:8080
npx @weave-os/router --base-url https://router.acme.internal
npx @weave-os/[email protected]                 # pin a version

Requires Node ≥ 18 (Claude Code, opencode, and pi paths also need jq). Full flag reference: install/npm/README.md.

The npm package is published as @weave-os/router. The former @workweave/router package remains available as a compatibility alias and continues to receive the same releases.

Or: self-host the whole stack

If you want the router (and dashboard) running on your own box:

# 1. Drop a provider key in. OpenRouter is the recommended baseline.
echo "OPENROUTER_API_KEY=sk-or-v1-..." >> .env.local

# 2. Set a dashboard password. Without one, inference still runs but
# dashboard a

router (weave-os/router)

Searching Database…

5.6K ·GitHub
这是什么?一个即插即用的代理,会把你的编程智能体或应用发出的每条提示,通过 OpenRouter 路由到 Anthropic、OpenAI、Gemini 以及开源模型中当前最合适的可用模型。只需替换 API 端点,推理成本就能降低 40-70%。
这是我要导入的库,还是我要指向的服务器?它是一个用 Go 编写的独立代理服务器。你只需把 Claude Code、Codex、Cursor 或你自己的应用指向 localhost:8080(或托管端点),而不必把它嵌入为库。
我该怎么把它跑起来?最快的方式是使用一条命令的安装程序,把 Claude Code、Codex、opencode 或 pi 指向托管的 Weave Router,无需克隆代码、Docker 或 Postgres。若想改为自行部署完整服务,把一个提供商密钥写入 .env.local,再用 Docker Compose 运行即可。
安装前我需要准备什么?快速安装程序需要 Node >=18(如果使用 Claude Code、opencode 和 pi 的安装路径,还需要 jq);如果改为自行部署,则需要一个提供商 API 密钥,推荐以 OpenRouter 作为基础。
自己部署它有什么不足之处?自行部署意味着你要自己设置提供商密钥和控制台密码。即使没有设置密码,推理功能仍可正常工作,但这样控制台就没有防护。
我的提供商 API 密钥最终存放在哪里?密钥保存在你自己的机器上,默认进行静态加密(BYOK),不会被发送给 Weave,也不会由 Weave 存储。
路由器究竟如何决定使用哪个模型?一个源自 Avengers-Pro 方法的集群评分器会对每个上游 API 请求进行分类,并为其挑选最合适的已启用提供商,取代了靠感觉判断的提示词分类器。它按操作进行路由,而不是按对话轮次进行路由。
它支持 DeepSeek 或 Qwen 等开源模型吗?支持。它可以通过 OpenRouter 或任何兼容 OpenAI 的端点路由到 DeepSeek、Kimi、GLM、Qwen、Llama 和 Mistral,同时也支持 Anthropic、OpenAI 和 Gemini。
我能看到路由器发出的请求吗?它开箱即用地输出 OTLP 追踪数据,可以在 Weave 控制台中查看,也可以导入 Honeycomb、Datadog、Grafana 或其他任何兼容 OTLP 的工具。
Creator
weave-os
Size
29 MB
Stars
5.6K
Updated
CommitOct 18
Age
5mo
Commits · 90 Days