经 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 profile edit claude # configure providers, models, routing, and thinking
brick start claude # start the router and wire Claude Code
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 stop claude # stop the router and restore future Claude Code launches
brick clear claude # remove the router runtime while preserving the profile
Brick runs one profile at a time. Stop or clear the active profile before starting another one.
brick profile edit codex # configure the official Codex profile
brick start codex # start the router and connect Codex
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 stop codex # detaches future Codex launches from Brick, keeps the current thread's Responses bridge
brick clear codex # remove the runtime and terminate that bridge
Codex exposes the same routing modes as Claude Code. Configure the model pool, model routing, autonomous reasoning_effort, and cache-aware routing in the profile editor; restart an already-running router to apply changes:
brick profile edit codex
brick restart codex
brick status codex # live dashboard in an interactive terminal
brick status codex --static # one static snapshot
brick status codex reports wiring, router reachability, and per-model routing and thinking-mode counts. It does not run inference or probe upstream authentication.
The native Codex Responses integration keeps tools in the original session and isolates provider credentials. Official Codex tool cycles have passed against both the subscription upstream and Regolo's Chat Completions endpoint.
---
The fastest working path today is the CLI, which self-hosts the router and wires it into Claude Code for you. Requires Node 20 or 22+ 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 profile edit claude # configure the official Claude profile
brick start claude # start the router and connect Claude Code
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 status claude 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.2.0
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 start <profile> (from the CLI above) runs the same router locally, syncing skill vectors, starting the container, and connecting the harness for official profiles.
</details>
---
brick profile edit claude opens the unified editor for the Claude profile.
brick profile edit claude
brick restart claude # apply changes when the router is already running
The interactive menu has five top-level entries; each one shows its current value inline. When the router is running, apply edits with `brick restart claude`; no Claude Code session restart is required:
- Providers — backend endpoints in the pool (Regolo, Anthropic, local servers, ...) and their credentials. Secrets are stored in the profile .env, never in the YAML. - Models — the Claude models Brick may route to, plus the allowed thinking modes per model. Pick which of haiku / sonnet / opus (and the Anthropic point releases you have access to) are in play. The skill-vector router only ever picks from this pool; a difficulty fallback map covers the case where the skill router is off. - Thinking modes — the per-model allowed reasoning efforts (off / low / medium / high / xhigh / max). - Cache-aware routing — how Brick handles the prompt-cache invalidation that follows a mid-conversation model switch (see below). - Advanced — server port, complexity service, legacy classifier, multimodal preprocessing, and plugins.
Use the editor to configure context-awareness (the last K turns, default `K = 8`), the local or hosted complexity classifier, Claude Code subagent routing, cache-aware routing, providers, models, and allowed thinking modes. Restart the profile after changes made while it is running.
Switching models mid-conversation invalidates the prompt cache: each provider's KV cache is per-model and opaque, so the new model has to reprocess the whole context at full input price. This setting picks how Brick handles that:
- off — per-request routing, no cross-turn memory. The default. - sticky — keep a conversation on its current model unless switching is actually worth it: downswitching to a cheaper model is always free, upswitching only happens when the estimated quality gain clears the cost of re-priming the cache. See docs/proof/sticky-savings.md for measured savings on real traffic. - smartsqueeze — the opposite tack: instead of avoiding switches, make them cheap. Same cache-aware hysteresis as sticky, but when a switch is taken it compacts the forwarded context (clearing older tool_result blocks, keeping recent turns raw) so the new model reprocesses a small prefix instead of the full one. Deterministic and model-agnostic (works across providers, not just Anthropic), never touches the system prompt or first user turn, and only fires on a switch (a warm cache is never disturbed). Ships shadow-first (compact_shadow_only: true measures the saving without changing what is served) so you can quantify the win before turning it on.
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 3.0 stores independent profiles under ~/.brick/profiles. Profile names are explicit for every lifecycle operation.
brick profile create work
brick profile edit work
brick profile show work
brick profile list
brick start work
brick restart work
brick stop work
brick clear work
brick update
clear removes containers and runtime state while preserving profile configuration, .env, managed harness assets, and volumes. For Codex, `brick stop codex` restores future launches to vanilla Codex while preserving the current thread's local Responses bridge; brick clear codex also terminates that bridge. update --cli, update --router, update --profile <name>, and -y are available for targeted or unattended updates.
skill_vectors.csv is the only authoritative skill-vector source. Brick refreshes it during profile lifecycle commands and caches a private copy at ~/.brick/cache/skill_vectors.csv for network outages. The six canonical capabilities are coding, creative_synthesis, instruction_following, math_reasoning, planning_agentic, and world_knowledge.
The official claude and codex profiles are materialized automatically. They begin dormant, without bundled vectors; select models with `brick profile edit claude or brick profile edit codex` before starting them. Starting an official profile connects its corresponding harness after the router becomes healthy.
---
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 不对第三方内容的准确性作法律背书。