Switchyard vocabulary, mapped to this kit.
| Surface | Role |
|---|---|
switchyard-server |
Standalone HTTP proxy. TOML deployment. OpenAI Chat, OpenAI Responses, Anthropic Messages. |
switchyard-libsy |
Embeddable Rust library. Picks targets; host makes HTTP calls. |
switchyard launch |
Starts the native server via PyO3 and points Claude Code / Codex / OpenClaw at it. |
| This kit’s Python routers | Educational offline stand-ins for demos and labs. |
- Client sends OpenAI or Anthropic shaped request.
- Switchyard decodes into provider-neutral protocol types.
- Route algorithm selects a target.
- Target’s LLM client encodes into the upstream format and calls the backend.
- Response is translated back to the client’s API.
[llm_clients.openrouter] # transport + credentials env
[targets.weak] # model id + client
[routes.smart] # client-visible id + algorithm| Layer | Defines |
|---|---|
| LLM client | base_url, format (openai_chat | openai_responses | anthropic_messages), api_key_env |
| Target | Upstream model ID + which client to use |
| Route | Model name clients put in model field + routing type |
Table keys (routes.smart) are local names. Only id is exposed on GET /v1/models.
Strong / weak / capable / efficient are roles inside an algorithm, not fixed properties of a vendor model. The same GPT-4o-mini can be weak in one route and the only target of a passthrough in another.
switchyard-translation converts requests, buffered responses, and streams across:
- OpenAI Chat Completions
- OpenAI Responses
- Anthropic Messages
That is why Claude Code can speak Anthropic while the backend is OpenAI-compatible vLLM.
Production Switchyard exposes Prometheus metrics (requests, errors, latency, tokens, routing overhead). This kit simulates tokenomics offline via examples/lib/metrics.py.
- Upstream Core concepts
- Upstream Architecture
- routing-strategies.md