经 AI Skill Hub 精选评估,brick-SR1开源AI工具 获评「推荐使用」。这款AI工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.5 分,适合有一定技术背景的用户使用。
brick是一款基于复杂性和能力提取的智能AI模型路由器,开源且易于使用,突出其在AI模型管理方面的价值。
brick-SR1开源AI工具 是一款基于 Jupyter Notebook 开发的开源工具,专注于 installable、claude-code、codex 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
brick是一款基于复杂性和能力提取的智能AI模型路由器,开源且易于使用,突出其在AI模型管理方面的价值。
brick-SR1开源AI工具 是一款基于 Jupyter Notebook 开发的开源工具,专注于 installable、claude-code、codex 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 克隆仓库 git clone https://github.com/regolo-ai/brick-SR1 cd brick-SR1 # 查看安装说明 cat README.md # 按 README 完成环境依赖安装后即可使用
# 查看帮助 brick-sr1 --help # 基本运行 brick-sr1 [options] <input> # 详细使用说明请查阅文档 # https://github.com/regolo-ai/brick-SR1
# brick-sr1 配置说明 # 查看配置选项 brick-sr1 --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export BRICK_SR1_CONFIG="/path/to/config.yml"
<img width="1640" height="393" alt="Brick (6)" src="https://github.com/user-attachments/assets/4b9dc94a-4767-4d0c-80e7-73f77517d8ce" />
A monorepo to run, use, and reproduce every result in the Brick paper.
| Component | Path | Purpose |
|---|---|---|
| **Router** (Go + Rust) | [apps/router/](apps/router/) | OpenAI-format gateway: capability + complexity classifiers, dispatch to the best backend |
**CLI** (brick) | [apps/cli/](apps/cli/) | TypeScript/oclif companion to self-host in one command |
| **Training** | [packages/training/](packages/training/) | ModernBERT capability sweep + complexity LoRA recipes |
| **Evaluation** | [packages/evals/](packages/evals/) | Dataset A pipeline + 3-judge majority-vote panel |
| **Baselines** | [packages/evals/baselines/](packages/evals/baselines/) | Zero-shot RouteLLM, FrugalGPT, Cascade comparisons |
| **Paper** | [docs/paper/](docs/paper/) | LaTeX source, figures, compiled PDF |
<details> <summary>Full directory tree</summary>
brick-SR1/
├── apps/
│ ├── router/ # Go + Rust gateway (was vLLM Spatial Router fork)
│ │ ├── src/spatial-router/ # Go (HTTP proxy, routing pipeline)
│ │ ├── candle-binding/ # Rust (ML embeddings via candle)
│ │ ├── ml-binding/ # Rust (Linfa classical ML)
│ │ ├── nlp-binding/ # Rust (BM25 + n-gram)
│ │ └── Dockerfile
│ └── cli/ # @regolo-ai/brick CLI (TypeScript + oclif + ink)
├── packages/
│ ├── training/ # Dataset B pipeline + ModernBERT/complexity training
│ ├── evals/ # Dataset A graders + 00..140 pipeline + baselines/
│ └── datasets/ # HF download recipes (no data in git)
├── docs/
│ ├── paper/ # paper.tex + figures + compiled PDF
│ └── quickstart/ # quick.md, serve.md, eval.md
├── deploy/ # docker-compose, addons, Windows installer
├── config.yaml # router runtime config
├── package.json / pyproject.toml # npm + uv workspace roots
└── Makefile # build / test / lint / docker-build / release
</details>
---
brick claude on # wires ANTHROPIC_BASE_URL in ~/.claude/settings.json, auto-starts the router
Then: 1. Open a new Claude Code session (your current session is unaffected). 2. In the /model picker, select brick-claude (it sits alongside the built-in opus/sonnet/haiku aliases, which it does not replace).
To revert:
brick claude off # restores ANTHROPIC_BASE_URL, optionally stops the router
Use brick claude on --no-start to require an already-healthy router instead of auto-starting one, and brick claude off --stop / --keep to control the router without a prompt.
brick codex on # sets model/model_provider to brick in ~/.codex/config.toml, auto-starts the router
This materializes a dedicated Codex profile (the OpenAI-pool skill router) and adds a managed provider pointing at the local router. Start a new Codex session and it now routes through Brick.
To revert:
brick codex off # restores your previous Codex model/provider
Codex exposes the same 5 modes and status view as Claude Code:
brick codex mode # or: brick codex eco | lite | mid | pro | max
brick codex status # live routing dashboard
Use brick codex on --no-start to require an already-healthy router instead of auto-starting one. The Claude and Codex router stacks share host port 8000, so only one can serve at a time; stop the other before wiring.
---
The fastest working path today is the CLI, which self-hosts the router and wires it into Claude Code for you. Requires Node >= 18 and Docker.
git clone https://github.com/regolo-ai/brick-SR1.git
cd brick-SR1/apps/cli && npm install && npm run build && npm link
brick claude on # starts the router + wires ANTHROPIC_BASE_URL in ~/.claude/settings.json
Then open a new Claude Code session and pick brick-claude in the /model picker. Every request now routes to haiku / sonnet / opus by capability and complexity. See Brick + Claude Code for modes, the effort picker, and the live brick claude status dashboard.
<details> <summary><b>Prefer a raw OpenAI-compatible gateway (no CLI)?</b></summary>
The image is published on Docker Hub (public, no login required). Run the gateway directly:
docker run --rm -p 18000:18000 \
-e REGOLO_API_KEY=$REGOLO_API_KEY \
docker.io/regolo/brick:latest # or pin a version: docker.io/regolo/brick:2.1.2
Then call it like any OpenAI endpoint, just set "model": "brick":
curl http://localhost:18000/v1/chat/completions \
-H "Authorization: Bearer $REGOLO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"brick","messages":[{"role":"user","content":"Prove that sqrt(2) is irrational"}]}'
The x-selected-model response header tells you which backend Brick picked. That math prompt routes to a reasoning model; "Hello" routes to the cheapest one.
Until then, brick serve (from the CLI above) runs the same router locally from source.
</details>
---
Everything Brick decides comes from config.yaml. The core block is skill_router, where you declare the pool, each model's skill vector, and its cost weight:
skill_router:
enabled: true
capabilities: # the 6 dimensions every query and model live in
- coding
- creative_synthesis
- instruction_following
- math_reasoning
- planning_agentic
- world_knowledge
models:
- model: "qwen3.5-9b"
skill_vector: [0.71, 0.51, 0.81, 0.91, 0.58, 0.18] # capability per dimension
use_reasoning: false
cost_weight: 0.10 # relative price, drives the cost bias
- model: "deepseek-v4-flash"
skill_vector: [0.82, 0.66, 0.86, 0.93, 0.62, 0.49]
use_reasoning: false
cost_weight: 0.40
- model: "kimi2.6"
skill_vector: [0.90, 0.75, 0.87, 0.94, 0.64, 0.34]
use_reasoning: true
reasoning_effort: "medium"
cost_weight: 0.60
Add or swap any OpenAI-compatible backend here; the backends themselves are declared under provider_profiles / model_config (the shipped config points them all at Regolo). Two more blocks let you nudge routing without touching the math:
keyword_rules:
- name: "force_coder" # hard override: send these prompts to a specific model
mode: "override"
model: "kimi2.6"
operator: "OR"
keywords: ["debug", "refactor", "compile", "write a function"]
- name: "coding_bias" # soft nudge: push one capability dimension up
mode: "bias"
capability: "coding"
operator: "OR"
keywords: ["python", "rust", "sql", "async"]
Other useful sections: brick (multimodal preprocessing: STT, OCR, vision), the r preference knob in r ∈ [-1, 1] (max-saving to max-quality), and the classifier endpoints. The CLI can edit most of this for you (brick add model, brick config edit), or edit the YAML directly. Full field reference: apps/router/README.md.
---
Brick is a Mixture-of-Models (MoM) routing gateway. It reads each prompt's capability and complexity, then routes it to the best backend in a pool of open- and closed-weight LLMs, matching the strongest single model's quality at a fraction of its cost. No cascades. No wasted calls. Drop-in model: "brick".
When to use Brick · Quickstart · Why Brick · Claude Code · Codex · FAQ · Benchmarks · How it works · Paper
</div>
---
Brick routing is per request. In Claude Code workflows and subagents, each agent's call is routed independently as long as that agent uses brick-claude, so a cheap subagent task can land on haiku while a hard one escalates to opus in the same run.
---
<details> <summary><b>How is Brick different from a cascade router like FrugalGPT?</b></summary>
A cascade calls models in sequence (cheap first, escalate on low confidence) and pays for every miss in tokens and latency. Brick makes a single forward decision per query from a capability vector and a complexity score, so there is no wasted call. See Why Brick. </details>
<details> <summary><b>Which backend did Brick pick for my request?</b></summary>
Read the x-selected-model response header. Every /v1/chat/completions and /v1/messages response carries it. </details>
<details> <summary><b>How do I trade cost against quality?</b></summary>
Slide the r knob in r ∈ [-1, 1]. At r = -1 Brick favors the cheapest capable model (max-saving), at r = 1 it favors the strongest (max-quality). For Claude Code the same idea is exposed as 5 named modes, see the 5 modes. </details>
<details> <summary><b>Do I need GPUs to run the gateway?</b></summary>
No. The router and both classifiers run on CPU. GPUs only matter if you self-host the backend LLMs; with a hosted pool (Regolo, Anthropic, etc.) a CPU box is enough. </details>
<details> <summary><b>Can I use my own model pool?</b></summary>
Yes. The pool, per-model skill vectors, costs, and the model_map live in config.yaml (skill_router.models). Add or swap any OpenAI-compatible backend. See apps/router/README.md. </details>
<details> <summary><b>What is the upstream for the OpenAI-compatible endpoint failing with 401/insufficient_quota?</b></summary>
That error comes from the backend provider, not Brick. Check the credential you forward (REGOLO_API_KEY or your own key); Brick passes Authorization through unchanged. </details>
---
brick-SR1 是一个 Monorepo 项目,旨在完整实现并复现 Brick 论文中的所有实验结果。通过该项目,开发者可以运行、使用并验证 Brick 提出的模型路由机制,确保研究成果的可落地性与可重复性。
本项目包含多个核心组件:Router 部分采用 Go 和 Rust 开发,作为一个兼容 OpenAI 格式的网关,能够对请求的 Capability(能力)和 Complexity(复杂度)进行分类,并将其���发至最合适的后端模型;CLI 工具基于 TypeScript/oclif 构建,支持通过单条命令实现自托管;此外还包含用于模型训练的相关模块。
安装过程非常便捷。首先需要确保环境已安装 Node.js (>= 18) 和 Docker。通过克隆仓库并进入 apps/cli 目录进行安装、构建与链接后,运行 `brick claude on` 命令,系统会自动配置 ~/.claude/settings.json 中的 ANTHROPIC_BASE_URL 并启动 Router。若需恢复原状,只需执行 `brick claude off` 即可。
目前最快速的使用路径是通过 CLI 工具。在完成安装并执行 `brick claude on` 后,请开启一个新的 Claude Code 会话(当前会话不受影响)。在 `/model` 选择器中,你会看到一个名为 `brick-claude` 的新选项,它与原有的 opus/sonnet/haiku 别名并列存在,通过它即可直接调用 Brick 路由能力。
Brick 的所有决策逻辑均由 `config.yaml` 文件驱动。核心配置位于 `skill_router` 模块,开发者可以在此处声明模型池(Pool),并为每个模型定义其 Skill Vector(能力向量)以及对应的 Cost Weight(成本权重)。配置涵盖了 coding、math_reasoning 等 6 个维度的能力评估。
Brick 是一个 Mixture-of-Models (MoM) 路由网关。它通过解析每个 Prompt 的 Capability 和 Complexity,从包含开源与闭源 LLM 的模型池中精准路由至最匹配的后端。这种设计旨在匹配最强单体模型的质量,同时仅消耗极小的成本,避免了传统的级联调用(Cascade)带来的 Token 浪费和延迟问题。
Brick 的路由决策是基于单次请求(Per-request)进行的。在 Claude Code 的工作流(Workflows)或子代理(Subagents)场景中,只要 Agent 使用的是 `brick-claude` 接口,每个 Agent 的调用都会被独立路由。这意味着在同一次运行中,简单的子任务可以路由到 haiku,而复杂的任务则会自动升级到 opus。
针对常见问题,Brick 与 FrugalGPT 等级联路由器的主要区别在于:级联路由通过顺序调用模型(先廉价后升级)来工作,若判断失误会产生额外的 Token 成本和延迟;而 Brick 基于能力向量进行单次前向决策(Single Forward Decision),确保每次请求都能在一次调用中精准命中目标模型。
brick是一款基于复杂性和能力提取的智能AI模型路由器,开源且易于使用,突出其在AI模型管理方面的价值,但其稳定性和扩展性需要进一步优化。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
AI Skill Hub 点评:brick-SR1开源AI工具 的核心功能完整,质量良好。对于AI 技术爱好者来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | brick-SR1 |
| 原始描述 | 开源AI工具:brick is a smart AI Models router, based on complexity & capabilities extraction。⭐62 · Jupyter Notebook |
| Topics | installableclaude-codecodexllmopen-modelsroutingjupyter notebook |
| GitHub | https://github.com/regolo-ai/brick-SR1 |
| License | Apache-2.0 |
| 语言 | Jupyter Notebook |
收录时间:2026-07-07 · 更新时间:2026-07-07 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。