Architecture
Switchyard is an LLM traffic proxy that sits between clients and model backends. It keeps the client-facing API stable while applying routing policy, translating provider formats, and handling configured fallbacks.
System Context
Clients connect using supported OpenAI or Anthropic API formats. Switchyard can route a request to a backend with a different native format and still return the response shape expected by the client.
Request Lifecycle
Routing policy determines which model or endpoint receives a request. Depending on the selected strategy, that decision can use fixed weights, a classifier, request signals, or conversation affinity. See the Routing Overview for the available strategies.
Backend Wire Format
BackendFormat controls the upstream endpoint Switchyard calls. Explicit
formats select an endpoint directly and do not run capability probes.
AUTO Decision Tree
Supported inbound and response formats are handled automatically.
TranslationEngine converts the client’s request to the resolved backend
format and translates the backend response back to the client’s expected
format. When a cross-format conversion is required, both directions decode to
and re-encode from the neutral conversation IR. This lets Claude Code, Codex,
OpenClaw, and SDK clients use their native wire format with any supported
upstream format.
Prefer an explicit format for controlled deployments. It skips capability probes and makes the upstream contract clear. Use
AUTOwhen provider capabilities are unknown or vary across deployments.
AUTOcosts startup latency. Each probe is a live request to the upstream, so a slow endpoint adds a round-trip per probe, with up to three tried in order. Setformat:explicitly to remove probing.
Related Documentation
- Getting Started: install Switchyard and run a first request
- Routing Overview: choose and configure a routing strategy
- CLI Reference: configure and operate Switchyard from the command line