经 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/ # @regoloai/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.
npm install -g @regoloai/brick
brick codex on # wires ~/.codex/config.toml and 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.
Both Codex authentication modes are supported: ChatGPT sign-in is forwarded in native Responses format to the ChatGPT Codex backend, while API-key sign-in uses the profile's configured OpenAI-compatible endpoints.
To revert:
brick codex off # restores your previous Codex model/provider
The default Codex profile classifies the last 8 conversation turns and enables cache-aware Smartsqueeze routing. On the Codex/OpenAI path, Smartsqueeze applies model-continuity hysteresis so a marginal router score change does not needlessly move a warm conversation to another model. Deterministic tool-result compaction remains available on the Claude/Anthropic path.
Codex exposes the same five cost/quality modes and status view as Claude Code:
brick codex mode # or: brick codex eco | lite | mid | pro | max
brick codex status # live routing dashboard
Configure context, classifier compute, model/thinking routing, and cache-aware behavior from one menu:
brick codex settings
brick codex settings show
brick codex settings mode smartsqueeze # off | sticky | smartsqueeze | orchestrator
The cost/quality mode (eco through max) controls how much capability Brick buys. The cache-aware setting controls whether a multi-turn conversation stays on its warm model when the quality gain from switching is too small to justify reprocessing the prompt.
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 path is the published CLI, which self-hosts the router and wires it into OpenAI Codex or Claude Code. Requires Node 20 or >= 22 and Docker.
```bash npm install -g @regoloai/brick brick init
The exact YAML can contain more fields, but these are the blocks that matter for a standalone setup:
model:
name: brick
description: Virtual multimodal routing model
server_port: 8000
default_model: qwen3.5-122b
providers:
regolo:
type: openai_compatible
base_url: https://api.regolo.ai/v1
provider_profiles:
regolo:
type: openai_compatible
base_url: https://api.regolo.ai/v1
provider_endpoints:
- name: regolo
provider_profile: regolo
weight: 1
model_config:
qwen3.5-122b:
preferred_endpoints: [regolo]
param_size: 122b
reasoning_family: qwen3
complexity_service:
enabled: true
protocol: openai
base_url: https://api.regolo.ai
model_name: brick-complexity-pro
bearer_token: ${REGOLO_API_KEY}
timeout_seconds: 8
auto_spawn: false
skill_router:
enabled: true
dynamic_effort: true
capabilities: [coding, creative_synthesis, instruction_following, math_reasoning, planning_agentic, world_knowledge]
capability_model:
model_id: models/modernbert-capability-classifier
repo_id: regolo/modernbert-capability-classifier
use_cpu: true
complexity_model:
model_id: brick-complexity-pro
base_model_id: brick-complexity-pro
base_url: https://api.regolo.ai
timeout_seconds: 8
auto_spawn: false
math:
routing_preference: 0
models:
- model: qwen3.5-122b
skill_vector: [0.62, 0.48, 0.70, 0.58, 0.66, 0.78]
skill_source: benchmark
skill_confidence: [medium, low, medium, low, medium, high]
cost_weight: 0.6
use_reasoning: true
active_models: [qwen3.5-122b]
keyword_rules: []
brick:
enabled: true
stt_model: faster-whisper-large-v3
stt_endpoint: https://api.regolo.ai/v1/audio/transcriptions
ocr_model: deepseek-ocr-2
ocr_endpoint: https://api.regolo.ai/v1/chat/completions
vision_model: qwen3.5-122b
vision_endpoint: https://api.regolo.ai/v1/chat/completions
ocr_min_text_length: 10
providers describes a backend in the simplest form. provider_profiles gives it a reusable named profile, while provider_endpoints attaches that profile to the router with a weight. A model's model_config.<id>.preferred_endpoints determines where Brick may send it.
For a custom OpenAI-compatible server:
providers:
local:
type: openai_compatible
base_url: http://host.docker.internal:11434/v1
provider_profiles:
local:
type: openai_compatible
base_url: http://host.docker.internal:11434/v1
provider_endpoints:
- name: local
provider_profile: local
weight: 1
model_config:
llama3.1:
preferred_endpoints: [local]
param_size: 8b
The API key belongs in .env (for example OPENAI_API_KEY=...), not in config.yaml. brick add provider <id> and brick add model <id> --provider <id> are convenient for adding these entries after initialization.
skill_router: the routing poolThis is the local Brick router. capabilities fixes the six dimensions used for both prompts and models. Each models entry must keep the same vector order. skill_vector is the measured capability vector; cost_weight is relative cost and controls the cost penalty; use_reasoning and reasoning_effort describe how to request reasoning from that backend. skill_source and skill_confidence record provenance, so a hand-edited or measured vector remains auditable.
active_models is the eligible subset. Removing a model from it does not delete its model_config or skill-card. default_model is the fallback model and should belong to this pool.
math.routing_preference is the continuous cost/quality knob from -1 to 1: negative values favor economy, positive values favor quality, and 0 is balanced. The wizard exposes the same idea as eco, lite, mid, pro, and max.
dynamic_effort: true lets Brick derive reasoning effort from the request's complexity. Set it to false when the client should control effort itself. The separate brick.use_model_routing flag can disable model selection and pin traffic to brick.fixed_model.
Keyword rules are evaluated before the normal skill-distance decision:
skill_router:
keyword_rules:
- name: force_coder
mode: override
model: qwen3.5-122b
importance: 10
operator: OR
keywords: [debug, refactor, compile]
case_sensitive: false
- name: coding_bias
mode: bias
capability: coding
importance: 8
operator: OR
keywords: [python, rust, sql]
case_sensitive: false
override forces a model when the keywords match (subject to that model being available). bias nudges the capability score without pinning a model. importance resolves competing rules; higher values win.
With api, complexity_service points to Regolo's hosted brick-complexity-pro, .env contains REGOLO_API_KEY, and Compose runs only the router. With local, the YAML points to the classifier service and Compose adds the Qwen3.5-0.8B sidecar plus BRICK_CLASSIFIER_TOKEN. Local mode avoids hosted classifier calls but needs more memory and is slower on CPU.
The capability classifier (capability_model) is separate: it maps the prompt into the six capability dimensions. The complexity classifier (complexity_service / complexity_model) labels the request easy, medium, or hard. If either service is unavailable, Brick keeps the gateway alive and falls back conservatively rather than turning the endpoint into a second client API.
The brick block is the fallback path for images and audio. If a selected model advertises native support, Brick forwards the raw modality. Otherwise it uses the configured STT, OCR, or vision endpoint to turn the input into text before routing. ocr_min_text_length controls when OCR output is considered sufficient.
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>
---
Use the virtual model name brick; the selected backend is returned in the x-selected-model response header.
curl http://127.0.0.1:8000/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"}]}'
For scripts and quick checks:
brick generate "Summarize the trade-offs between REST and GraphQL"
brick route "Prove that sqrt(2) is irrational" # route and make a small completion
brick route "..." --no-generate --json # routing/latency data as JSON
brick chat # interactive terminal chat
generate prints only the assistant answer. chat is an interactive TUI. route is useful when tuning the pool: it reports the selected model, applied thinking mode, HTTP status, and latency; --repeat N shows min/median/max.
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 不对第三方内容的准确性作法律背书。