SuperAPIAI Directory

sabi

github.com · AI developer platforms

Sabi is an adaptive inference scheduling layer for AI agents, positioned between a coding host (Claude Code, Codex, OpenCode, Command Code, etc.) and the models it can call, deciding the model, reasoning effort, and provider needed for the next turn based on each turn's trajectory evidence (tool calls, results, failures, context pressure, capabilities, and provider status). It offers two forms: an in-process mod for Command Code, and a local OpenAI-compatible proxy; it also provides controller hooks for three types of task handoff: continue, delegate, and spawn. The project is MIT-licensed, installs at the user level, and supports borrowed authentication of the host's own credentials, route receipts, a local dashboard, and update self-checks.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

  1. Positioning and Purpose Sabi is an adaptive inference scheduling layer for coding agents, with the repository at https://github.com/vizuh/sabi,采用 MIT License. It does not replace the host; instead, it sits between the coding host (harness) and the models the host can call: the host retains its own loop, tools, permissions, history, and approval flow, while Sabi decides, based on trajectory evidence (tool calls, results, failures, context pressure, capabilities, and provider status), what should handle the next inference or task handoff. It is officially described as a "host-agnostic routing layer"—that is, a routing layer independent of the host—rather than yet another agent host or editor; adapters are merely optional bridges to the execution seams exposed by each host.

Sabi explicitly draws two boundaries: first, inference routing (the model and provider for each turn); second, controller handoff (continue / delegate / spawn). It also states several boundary clarifications: installing hooks does not equal switching models, appearing in the model catalog does not equal plan entitlement, and passing a mock does not equal a savings benchmark.

  1. Main Capabilities
  2. Per-turn routing: Sabi does not fix a single model for the entire task; instead, it selects the capacity needed for the "next turn." A deterministic policy first classifies the current state, then applies hard constraints, and only then selects a tier.
  3. Trajectory-level judgment: most routing tools decide based only on a single request, whereas Sabi can decide based on the trajectory the task actually follows. For proxy clients, the first request is classified as first-turn and routed to the configured tier (mid by default); only Command Code's continuing-turn hook keeps turn 1 on the session model.
  4. Route receipts: every served turn records a route receipt, including the planned tier and model, the actual server, and the reason for any difference between the two. When the planned provider refuses, Sabi explains why and handles it according to the refusal type; to switch to another tier after a refusal, "transportFallback": { "enabled": true } must be enabled—when disabled, the provider's refusal is returned to the host as-is (a missing key still returns 502).
  5. Borrowed authentication: the host retains and continues to send its own credentials, Sabi decides which model serves that turn, and forwards using the received credentials to the provider those credentials belong to. On this path Sabi does not hold credentials, does not open credential files, does not write to disk, and the only external destination is the provider the host would have called on its own. At the protocol level, it directly accepts POST /v1/messages (Anthropic Messages), POST /v1/responses (OpenAI Responses), and POST /v1/chat/completions, rewriting only the model field, with streaming responses forwarded frame by frame. Upstreams that declare auth: passthrough must not also declare apiKey; rounds without credentials, or tiers where the upstream brings its own key, are rejected with a typed error rather than silently rerouted.
  6. Residual reasoning and shadow QA: a configured zero-cost fixed channel can be used to try to find problems without changing the main work content. The first slice is explicit, read-only, and shadow-only: only a bounded, tracked diff passes through the local Sabi proxy; key paths, key-like tokens, tools, environment variable values, and absolute paths are rejected; receipts store only hashes and counts, not the diff or model assertions. Until a deterministic validator proves otherwise, conclusions given by the model are advisory only.
  7. Optional semantic judgment Jev: used for highly ambiguous agent rounds; it is a judge, not a working model; on timeout, invalid answer, or unavailable credentials it falls back to a deterministic policy.
  8. Local dashboard: sabi serve also provides http://127.0.0.1:8787/dashboard(英文与 pt-BR; statistics for the last 24 hours, 48 hours, or 7 days), showing free-channel hit rate, success rate, rounds recovered by fallback, known cost and pricing coverage, latency, and per-model health. Data is read from the local decision log; when there is no log, rounds in memory are read.

III. Installation and Usage

  1. User-level installation: Sabi is installed at user scope, not per worktree, and no host needs to be selected first during installation. setup is idempotent: it keeps the daemon and state at user level, detects supported hosts, installs only Sabi-owned and supported hooks, and preserves the host's original paths when Sabi is unavailable. Use sabi setup --no-hooks to install only the daemon without modifying host configuration.
  2. Controller package: for Claude Code, Codex, and controller-supported OpenCode workflows, install the published controller @vizuh/sabi-controller (current version controller-v0.1.8), which bundles the proxy, hooks, and daemon; the server run by sabi serve is the same as running npm start in the code checkout directory, with no need to clone the repository. Generating Hermes or OpenCode configuration still requires consulting the installation guide, because that involves writing host configuration rather than running the server. The materials do not give the complete installation command line for the controller.
  3. Skill installation: it can be installed with the open skills CLI using the command npx skills add vizuh/sabi --skill sabi; SKILL.md and the machine index can also be handed directly to the agent performing the installation. setup accepts --language=en|pt-BR|zh-CN|ja|ko; prompts other than EN/PT-BR fall back to English.
  4. Integration one: Command Code native mod. Use only when you want Sabi to change the model and reasoning effort within a Command Code trajectory; it does not need Sabi's provider keys or a local proxy, and the mod uses the Command Code subscription already bound to the session.
  5. Integration two: local OpenAI-compatible proxy. Use when the client accepts a baseURL and you want Sabi to route its own OpenRouter, Ollama, or other provider credentials; this is an optional BYOK inference surface; its models and proProvider routing does not provide a native reasoning-effort signal like the Command Code mod. To enable the currently zero-priced OpenRouter quality channel, set OPENROUTER_API_KEY (or use an already configured Sabi key file) and run sabi setup --free-quality; Sabi will refresh the online catalog, add a fixed sabi-quality alias, and route validation turns to that channel, with paid tiers remaining unchanged. A catalog refresh is only availability evidence and does not constitute a guarantee of model quality or privacy.
  6. Controller hooks: The aforementioned user-level controller can coordinate supported Claude Code, Codex, OpenCode, and Orca workflows; it is a task- and session-level interface, not a general means of rewriting the model within an existing host session. Claude Code and Codex run on their respective subscriptions: Sabi only installs hooks into them and never writes provider base URLs, API keys, or model overrides, so delegating to them costs no more than the existing subscriptions, and Sabi does not turn either into token-billed API overhead.
  7. Update maintenance: sabi updates is an agent-runnable preflight check that reports the installed version and the most recent npm result, and preflights the Node version, project configuration, and installed hook paths; cache reads are offline, only sabi updates --check accesses the registry, and one check covers the following 24 hours; scripts can use --json. The daemon performs at most one registry check per day and writes the result to the cache for other interfaces to read offline; SABI_UPDATE_CHECK=off can completely disable this request. When the registry version updates, the installed Claude and Codex hooks will display a one-line notice in each check window, and sabi status will also report it. sabi upgrade installs the new controller, verifies the registry signature, refreshes its own adapter copies (the OpenCode plugin is a copy in the state directory, not a link to the package), and restarts the daemon.

IV. Use Cases Suitable for those already using programming hosts such as Claude Code, Codex, OpenCode, and Command Code, and who want to dynamically allocate model capacity across different turns of the same task, route among multiple providers, or, without handing over credentials, changeDevelopers and teams changing service models; also suitable for scenarios that need local observability (routing receipts, dashboards, cost and latency statistics), and for workflows that want to use a zero-cost channel for read-only shadow quality checks.

V. Example results and limitations The official examples are transparent illustrative estimates, not a promise of universal savings. The example uses the rates in the repository configuration (USD per million tokens, verified 2026-09-18), ignoring cache discounts, provider minimum charges, retries, and output produced by the optional judge: for an eight-round task, with cheap at $0.06/$0.12, mid at $0.20/$1.20, and strong at $2/$10, the adaptive mix is about $0.0605, all-strong is about $0.2140, and the illustrative reduction relative to all-strong is about $0.1535 / 71.7%; all-mid is about $0.0242, so Sabi does not claim to outperform a fixed mid model on all tasks; its goal is to reserve strong-model capacity for rounds supported by evidence. The example token count remains 51k; what Sabi changes is the price and capability assigned to those tokens, and it does not eliminate context or tool output; the strong tier's share falls from 100% to 21.6% of tokens, which is a routing-allocation estimate, not a quality conclusion. A 6k-token Jev input adds about $0.00025 at the configured $0.042/M judge rate, not yet counting judge output and network costs. Officials emphasize that the production metrics that actually need proving should be measured on a fixed set of completed tasks: cost per completed task, success rate, escalation accuracy, latency, and routing/judge overhead.

The level of support is reported in evidence tiers: source code and tests prove the adapter exists and its contract is tested; protocol tests prove that a real client reaches the local Sabi endpoint or host seam under bounded fixtures; live smoke tests prove that an approved and authenticated upstream is reached under a spending cap; completed-task evaluations measure quality and cost against a fixed baseline. See Harness compatibility and the individual adapter pages for specific evidence and limitations.

For maintainers, the design constraints are: the host owns the agent loop, tools, approvals, compaction, retry policy, and user-visible model pinning; the adapter is responsible for detection, session identification, receiving events or requests, dispatching through supported seams, observing results, and cleanly unloading; unknown capabilities remain unknown, and Sabi would rather refuse an unsafe route than drop tools, files, images, reasoning fields, or structured output; routing metadata is only local attribution, not an authorization mechanism, and loopback is the default.

The materials do not provide Sabi's own billing plan or pricing information, nor a complete controller installation command line; the README provides English, Portuguese (Brazil), Chinese, Japanese, and Korean versions, with English being the authoritative version for rate and support statements.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools