Skip to content
FossShelf
Home / Categories / For AI Engineers

Switchyard

LLM proxy with API translation and multi-backend routing

Replaces Portkey, Openrouter, Merge Gateway

3.61K starsApache-2.0reviewed 13 Aug 2026last commit 14 Nov 2026
Screenshot of Switchyard

Who it's for

AI engineers routing Claude Code or Codex to open-source models

Switchyard's launcher mode wraps Claude Code or Codex CLI invocations, translating their API calls to an Ollama, vLLM, or NVIDIA NIM backend. The agent keeps its native API; only the routing config changes. This lets a team evaluate open-source model quality on real coding tasks without modifying the agent's configuration.

Skip if the open-source models available to you cannot match the quality bar your workflow requires, or if Switchyard's pre-alpha stability is unacceptable for your team's development environment.

Research teams benchmarking multiple LLMs on identical traffic

Switchyard's random routing splits traffic across multiple model backends at a configured ratio. A team can send 50% of requests to one model and 50% to another, collecting Prometheus metrics on latency, token usage, and error rates. This produces controlled, repeatable benchmark data without building custom splitting infrastructure.

Skip if your benchmark requires frontier models accessible only via commercial APIs that cannot be self-hosted.

Platform engineers embedding custom routing logic in Rust services

The switchyard-libsy crate lets a platform team embed routing algorithms in an existing Rust proxy or agent runtime without adopting a new HTTP server. The library makes the routing decision and hands the model call back to the caller, so it integrates without displacing existing infrastructure.

Skip if your platform is not Rust-based. The library path requires a Rust application; the launcher and server paths do not, but they add an external service dependency.

Teams using escalation routing to reduce strong-model API calls

Switchyard's escalation routing runs every request on a weak (cheaper) model first, then uses a judge to decide whether the response quality is sufficient or the request must be escalated to a strong model. This reduces expensive model calls to the subset that actually needs them.

Skip if your workload requires the strong model for every request, or if the latency added by running a first-pass weak model is unacceptable in your pipeline.

The problem

Coding agents speak one LLM API format, but model backends speak another. An agent built for the Anthropic Messages API cannot directly call a vLLM endpoint, which serves the OpenAI Chat format. The translation layer is custom code that teams must write and maintain per deployment, and it breaks whenever either side updates its API. The pain deepens when you want to compare multiple models or route requests intelligently. Running all traffic through a single commercial API provider means you cannot A/B benchmark open-source models at realistic traffic levels without building your own routing infrastructure. Teams either stay on expensive commercial APIs or invest significant engineering time building a proxy from scratch.

How it works

Protocol translation between OpenAI and Anthropic formats

Converts requests between OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages formats. A client that speaks the Anthropic Messages API can reach an Ollama or vLLM backend that serves OpenAI Chat Completions, with no changes to the client. The translation covers requests, responses, and streaming.

Four configurable routing strategies

Supports random splitting for A/B tests and baselines, LLM-as-classifier routing where request content selects the model tier, signal-driven stage routing based on conversation signals like tool results and errors, and escalation routing that runs a weak model first and escalates based on answer quality. Each strategy is configured via route type in routes.toml.

Prometheus operational metrics

Exposes Prometheus metrics covering request counts, error rates, latency, token usage, and routing overhead. Standard Prometheus scrape endpoint means the metrics plug directly into Grafana or any existing observability stack without custom instrumentation.

Launcher mode for coding agents

Wraps coding agent invocations (Claude Code, Codex CLI, OpenClaw) to redirect their API calls through the Switchyard proxy. The agent keeps its native API format; Switchyard translates and routes to whatever open-source model backend you configure. Installed as a Python tool via uv with no changes to the agent itself.

Embeddable routing library (switchyard-libsy)

The switchyard-libsy crate embeds routing algorithms in a Rust application without owning an HTTP stack. An algorithm decides which backend to use and hands every model call back to the caller, so it drops into an existing proxy, gateway, or agent runtime. Pair with switchyard-llm-client when you want the HTTP calls handled automatically.

Features

  • Protocol translation between OpenAI and Anthropic formats
  • Four configurable routing strategies
  • Prometheus operational metrics
  • Launcher mode for coding agents
  • Embeddable routing library (switchyard-libsy)

How to install

Install via the Python CLI (requires uv) or as a standalone server (requires Cargo).

uv tool install --python 3.10 "nemo-switchyard[cli]"
cargo install --locked switchyard-server

Recommended for this setup

Strengths

  • Apache-2.0 license with permissive commercial use: Apache-2.0 allows use in commercial products and services without copyleft requirements. Unlike AGPL (which requires distributing source changes when running a modified version as a service), Apache-2.0 lets teams embed or deploy Switchyard internally without open-sourcing their modifications.
  • Active development under NVIDIA NeMo: Switchyard is maintained by the NVIDIA NeMo team and receives regular pushes. The repository was created in May 2026 and has seen continuous commits since then, with NVIDIA NIM listed as a supported backend, making it a natural fit for teams already using the NVIDIA AI ecosystem.
  • Three deployment modes for different integration depths: Teams can adopt Switchyard at different integration depths: the launcher path wraps an agent invocation without running a persistent server; the server path runs a standalone Rust proxy with a TOML config; and the library path embeds routing algorithms directly into a Rust application. One project, three entry points.
  • Agents require no reconfiguration to use open-source backends: Because Switchyard translates between API formats transparently, a coding agent like Claude Code keeps calling the Anthropic Messages API, and Switchyard routes those calls to an open-source model backend. There is no agent-side code change or API key swap; only the proxy config changes.

Trade-offs

  • Pre-alpha: not for production use: The README explicitly labels Switchyard experimental and not for production use. The API and routing algorithms are expected to change significantly before v1.0. Teams with stability requirements should treat this as a development and benchmarking tool only, not a production infrastructure component.
  • Server path requires the Rust toolchain: Installing switchyard-server requires a working Rust toolchain with Cargo, which adds setup overhead compared to tools distributed as Docker images or prebuilt binaries. Teams without Rust experience will need to install the toolchain before they can run the standalone server. No Docker path is documented in the README.
  • Client-side format support limited to OpenAI and Anthropic schemas: The server accepts three client-side formats: OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages. The README does not document support for other LLM API schemas. Teams whose tooling targets other provider formats cannot use Switchyard as-is without additional translation.

Tech stack

Languages
Rust, Python, Shell, JavaScript, Go, CSS, TypeScript, HTML, Dockerfile, C, Mermaid
Frameworks
—
Databases
—
Tooling
—

FAQ

Is Switchyard production-ready?

No. The project README explicitly marks Switchyard as pre-alpha, experimental software not for production use. The API and routing algorithms are expected to change significantly before v1.0. Use it for development environments, research, and benchmarking only.

Which LLM backends does Switchyard support?

Switchyard routes to any OpenAI-compatible endpoint. The README specifically names vLLM, NVIDIA NIM, and Ollama as supported backends. Each backend is configured in a routes.toml file as a target. You can configure multiple backends and let Switchyard's routing algorithms choose between them at request time.

Which coding agents work with Switchyard's launcher mode?

The README names three: Claude Code, Codex CLI, and OpenClaw. Any agent that calls the OpenAI Chat Completions or Anthropic Messages API can be routed through Switchyard without code changes, since Switchyard presents itself as a compatible API endpoint to the agent.

What routing strategies does Switchyard support?

Four strategies: random routing for traffic splits and A/B tests; LLM classifier routing where request content selects the model tier via an LLM call; signal-driven stage routing that routes based on conversation signals such as tool results and error responses; and escalation routing that runs a weak model first and escalates to a strong model when the judge deems the first response insufficient.

How do I install Switchyard?

Two paths are documented. For the Python CLI launcher: install uv, then run `uv tool install --python 3.10 "nemo-switchyard[cli]"`. For the standalone Rust server: install the Rust toolchain with Cargo, then run `cargo install --locked switchyard-server`. The library path adds switchyard-libsy as a Cargo dependency in your own Rust project.

Similar tools

More in AI Engineers