switchyard
Library New
Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.
- Downloads
- 6,019
- Dependents
- 2
- Stars
- 3,501
- Forks
- 358
- Contributors
- 70
- Commits
- 722
- Latest release
- 0.3.0 ·
About

NVIDIA NeMo Switchyard
Switchyard is an open-source library that helps an AI agent choose which model handles each request. It combines efficient models with more capable models so you can balance task success, cost, and latency on your workload.
Adopt Switchyard by embedding its Rust core, libsy, in your gateway or agent harness. You own the model clients, credentials, and service. Switchyard supplies the routing decision.
Quickstart · Documentation · Benchmarks · What’s new · Roadmap · Releases · Contributing
How it works
- Configure the models an agent can use and choose a routing algorithm.
- The algorithm examines the request or the agent's recent tool activity. Some algorithms call a model to judge the task.
- A gateway or agent sends the request to the selected model. Routing can change as the agent continues its work.
Evaluate the complete agent, model pool, and routing configuration against your single-model baseline. A cheaper model call does not guarantee a cheaper successfully completed task. The tuning loop gives the steps for that evaluation, and Troubleshooting lists the settings that disable routing without an error.
Read the full README
How to use it
- Through an existing gateway: Use an available gateway integration.
- Embed libsy in your harness: Add libsy to a service you operate.
- Evaluate Switchyard locally: Compare routing configurations with your own model pool using the demo server.
Through an existing gateway
| Gateway | Start here | Deployment and limits |
|---|---|---|
| OpenRouter | Use Switchyard through OpenRouter | Hosted by OpenRouter. Set model to nvidia/switchyard in API requests. |
| LiteLLM | Run the Switchyard routing-plugin example | Experimental and checkout-only. The example pins LiteLLM 1.102.0 and supports Stage routing based on request history, plus Random routing. It cannot service intermediate model calls required by classifier or escalation algorithms. |
| NeMo Relay | Build and configure the native plugin | Requires Relay >=0.10.0, <1.0.0. The source-build path requires a Rust toolchain and Python 3. |
Relay 0.8.x and 0.9.0 can lose upstream error status and details when the plugin is enabled, even for models outside its routes. Review the upstream error compatibility note before enabling the plugin.
LiteLLM and NeMo Relay run in your own deployment. Follow each gateway's guidance for credentials and service operation.
Embed libsy in your harness
Algorithm::run_stream hands model calls and the final routing outcome back to your application. In this development-API outline, comments mark the work your code supplies:
let mut steps = algorithm.run_stream(request, models, state);
while let Some(step) = steps.next().await {
match step? {
Step::CallModel(call) => {
// Send call.request through your LLM client.
// Give the call future to call.respond(...).await.
}
Step::CallDecision(call) => {
// Send call.request through your decision-model client.
// Give its typed response future to call.respond(...).await.
}
Step::Done(outcome) => {
match outcome.response {
Some(response) => {
// Return this answer; no final LLM call is needed.
}
None => {
// Send outcome.request through your client for the final answer,
// or pass it to your gateway to make that call later.
}
}
}
}
}
- Inputs: supply an algorithm, model pool, request, and state.
- Calls: your clients handle model calls. Stage returns a selection; other algorithms may return an answer.
- Start here: Rust quickstart · Python bindings.
Evaluate Switchyard locally
The standalone server is provided only for demos and local evaluation. It is not a supported production deployment path.
Evaluate routing locally with the standalone server and your own model pool, then verify routing is active.
The experimental desktop and terminal quickstart covers local installation, coding-tool connections, sessions, usage, recovery, and uninstall.
Agent-specific guides are available for pi and Oh My Pi.
Routing algorithms
Start with Auto. Choose Task, Execution, or Composite when you need more control. These names describe routing choices. The configuration keys are unchanged.
| Choice | How it chooses | TOML configuration |
|---|---|---|
| Auto | Uses the current default: Execution (Stage), efficient-first, with a confidence threshold of 0.5 and no classifier call. | type = "auto" |
| Task | A model judges whether the efficient model can handle the task. | type = "llm_classifier", mode = "capability" |
| Execution | Uses recent tool activity and outcome signals to choose a model as the agent runs. | type = "stage_router" |
| Composite | Combines Task and Execution: a classifier sets the default model tier when execution signals are uncertain. | type = "composite" |
Auto is a fixed preset in v0.3.0. It does not compare strategies at runtime. The TOML runner supports type = "auto". In Rust, use StageRouterConfig::new(PickerMode::EfficientFirst, 0.5) for the same preset.
The routing overview lists all strategies, including the Plan/Execute configuration for Stage, escalation, advisor, sub-agent, and random. Integration support varies: check the gateway guide before choosing an algorithm.
Prefill routing is designed for fast, efficient model selection using a model's prefill activations and a classifier trained on your own evaluation data.
Evaluation and reference
Compare benchmark results and configs for Terminal-Bench 2.1 and DeepSWE. For latency and routing overhead testing, see Soak Testing.
Further reading
- Benchmark setup and profiles: run your own baseline and routing comparisons.
- Mechanics of Libsy: steps, model calls, and routing outcomes.
- TOML schema: configuration fields and defaults.
- Rust crate reference: core and optional integration crates.
- Installation: package and platform requirements.
Components
Pre-1.0 software. APIs, configuration, and routing behavior can change between releases. Pin the version you integrate.
| Component | Stability | Use it for | Guidance |
|---|---|---|---|
switchyard-libsy | Beta | Routing embedded in your own gateway or harness. You own model calls, credentials, and retries. | Trial integrations. API will change before v1.0. |
switchyard-llm-client | Alpha | HTTP model calls and protocol translation alongside libsy. | Experiments and pilots. |
switchyard-runner | Alpha | Running configured routes inside another runtime, such as NeMo Relay. | Integration work and supervised pilots. |
switchyard-server | Demo | A standalone OpenAI- and Anthropic-compatible proxy. | Demos and local evaluation only; not a supported production path. |

What’s new
Features and integrations recently merged into main.
2026-10-16 · Route between Sonnet and Opus in Claude Code
Use your Claude login for automatic routing on Linux x86_64 and see the selected model in the status line. Setup guide →2026-10-15 · Use decision models in composite routing
Use Mercury Decide to judge tasks and Stage routing to adjust model selection as tools run. Example configuration →2026-10-13 · Use Jev to choose between models
Configure Jev as a task judge with candidate descriptions and a probability cutoff. Configuration guide →2026-10-12 · Bring Switchyard to TypeScript and Pi
Select models in Node.js or try automatic routing through Pi’s virtual models. TypeScript bindings → · Pi example →
Community and license
Report an issue · Contribute · Code of conduct
Apache 2.0. Copyright NVIDIA Corporation.
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- None found
- No native code found
- Python bindings
- Has Python bindings
- prefill-router needs Python
- License
- Apache-2.0
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization. Python bindings |
6,019 downloads over 30 days | 2 | 3,501 | 0.3.0 | GPU support unknown | No native code found | Apache-2.0 |
|
rust-genai Featured
Multi-AI Providers Library for Rust. (OpenAI, Gemini, Anthropic, DeepSeek, Ollama, OMLX, AWS Bedrock, Vertex, Xai, Groq, Kimi, GLM and many more) |
118,643 downloads over 30 days | 81 | 938 | 0.7.3 | GPU support unknown | No native code found | Apache-2.0 OR MIT |
|
All-in-one LLM CLI tool featuring Shell Assistant, Chat-REPL, RAG, AI Tools & Agents, with access to OpenAI, Claude, Gemini, Ollama, Groq, and more. |
28,422 binary downloads per release | Not applicable | 10,556 | 0.30.0 | GPU support unknown | No native code found | Apache-2.0 OR MIT |
|
Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors! |
5,642 binary downloads per release | Not applicable | 772 | 0.13.0 | GPU support unknown | No native code found | MIT |
|
rstructor Listed
Get structured, validated data out of LLMs as native Rust structs and enums. Derive a type and rstructor generates the JSON Schema, prompts the model, parses the reply, and retries on validation errors — across OpenAI, Anthropic Claude, Google Gemini, and xAI Grok. |
1,269 downloads over 30 days | 3 | 34 | 0.6.0 | GPU support unknown | No native code found | MIT |
|
llm_providers Listed
A unified source of truth for LLM providers, models, pricing, and capabilities. |
604 downloads over 30 days | 4 | 2 | 0.14.4 | GPU support unknown | No native code found | MIT |
|
Inference server for LLMs, speech and embeddings: OpenAI-compatible routes with streaming, plus speech synthesis (TTS) and transcription (ASR). Serves Llama, Mistral, Qwen, Mamba2, MLA+MoE and hybrid models from SafeTensors, AWQ, GPTQ and GGUF. |
8 binary downloads per release | Not applicable | 7 | 0.7.1 | CUDA, WebGPU | Binds native code: ring (feature distributed) | Apache-2.0 |
Why NewIts first release on 15 Jul 2026 is under 180 days old.
The check tests the Featured gates once the first release passes this age limit.
What else the check found
- The last activity is on 7 Nov 2026, 2 days ago. The rules expect an update within 365 days. Dormancy rule
Exact rules: New. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.3.0 base 80, raised to the 365-day floor: E = 365 daysdormancy: last activity 2026-11-07, 2 days ago, E = 365: activenew: new: first release 2026-07-15 is under 180 days old
Crates7 crates
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the GitHub repository description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption2 active dependents, 2 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 1.6667 | crates.io database dump | Yes | |
| New dependents (365 days) | 1.6667 | crates.io database dump | Yes | |
| Peak active dependents | 1.6667 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 2 days ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-11-07 | GitHub repository | Yes | |
| Latest release | 2026-09-22 | crates.io database dump | Yes | |
| First release | 2026-07-15 | crates.io database dump | Yes | |
| Latest version | 0.3.0 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 60 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 3 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution3 releases, 6,019 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 3 | crates.io database dump | Yes | |
| Downloads over 30 days | 6019 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository3,501 stars, 358 forks, 70 contributors, 722 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 3501 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 358 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 70 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 722 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | Apache-2.0 | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | No native code found | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | Has Python bindings: prefill-router needs Python | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 2 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.