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.

Checked · Sources

Downloads
6,019
Dependents
2
Stars
3,501
Forks
358
Contributors
70
Commits
722
Latest release
0.3.0 ·

About

From the project README ·

Switchyard

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

  1. Configure the models an agent can use and choose a routing algorithm.
  2. The algorithm examines the request or the agent's recent tool activity. Some algorithms call a model to judge the task.
  3. 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
GatewayStart hereDeployment and limits
OpenRouterUse Switchyard through OpenRouterHosted by OpenRouter. Set model to nvidia/switchyard in API requests.
LiteLLMRun the Switchyard routing-plugin exampleExperimental 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 RelayBuild and configure the native pluginRequires 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.

ChoiceHow it choosesTOML configuration
AutoUses the current default: Execution (Stage), efficient-first, with a confidence threshold of 0.5 and no classifier call.type = "auto"
TaskA model judges whether the efficient model can handle the task.type = "llm_classifier", mode = "capability"
ExecutionUses recent tool activity and outcome signals to choose a model as the agent runs.type = "stage_router"
CompositeCombines 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

Components

Pre-1.0 software. APIs, configuration, and routing behavior can change between releases. Pin the version you integrate.

ComponentStabilityUse it forGuidance
switchyard-libsyBetaRouting embedded in your own gateway or harness. You own model calls, credentials, and retries.Trial integrations. API will change before v1.0.
switchyard-llm-clientAlphaHTTP model calls and protocol translation alongside libsy.Experiments and pilots.
switchyard-runnerAlphaRunning configured routes inside another runtime, such as NeMo Relay.Integration work and supervised pilots.
switchyard-serverDemoA standalone OpenAI- and Anthropic-compatible proxy.Demos and local evaluation only; not a supported production path.

Switchyard Components

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.

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.

switchyard beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
switchyard This page 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.

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
aichat App Featured

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
oatmeal App Listed Dormant

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

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
blazr App Listed

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 days
  • dormancy: last activity 2026-11-07, 2 days ago, E = 365: active
  • new: 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
Adoption2 active dependents, 2 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents1.6667crates.io database dumpYes
New dependents (365 days)1.6667crates.io database dumpYes
Peak active dependents1.6667crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 2 days ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-11-07GitHub repositoryYes
Latest release2026-09-22crates.io database dumpYes
First release2026-07-15crates.io database dumpYes
Latest version0.3.0crates.io database dumpYes
Days the oldest outside issue waits for a reply60GitHub repositoryYes
Maintainer replies over 365 days3GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution3 releases, 6,019 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases3crates.io database dumpYes
Downloads over 30 days6019crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository3,501 stars, 358 forks, 70 contributors, 722 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars3501GitHub repositoryYes — one part of the repository route
GitHub forks358GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account70GitHub contributorsYes — one part of the repository route
Commits on the default branch722GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0crates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesHas Python bindings: prefill-router needs Pythoncrates.io database dumpNo
Crates that depend on a listed crate directly2crates.io database dumpNo

Corrections and review history

Report a correction

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.