Point Claude Code, Codex CLI, or OpenClaw at open models without rewriting the agent.
Coding agents speak a fixed API (often Anthropic Messages or OpenAI). Your best execute model might be NIM / vLLM / Ollama. Switchyard:
- Accepts the agent’s native protocol
- Routes plan vs tool-heavy turns (stage router)
- Translates to the backend wire format
- Streams the response back
uv tool install --python 3.12 "nemo-switchyard[cli,server]"
export OPENROUTER_API_KEY=... # or local-only config
# Packaged deployment
switchyard launch claude --model switchyard
# Custom Lightning + frontier split
switchyard launch claude \
--model agent-route \
--config configs/routes.lightning_frontier.tomlFor PR-fix / test-fix agents, prefer stage_router:
- File reads, greps, patches → efficient (Lightning / mini)
- Test failures, retries, architecture questions → capable (frontier)
See configs/routes.stage_router.toml and the offline simulation in examples/02_stage_router.py.
- Start vLLM / Ollama / NIM with an OpenAI-compatible
/v1. - Add an
llm_clientsblock withoutapi_key_envif none is needed. - Point a target at that model ID.
- Use
passthroughor stageefficient_target→ local.
Snippet in configs/routes.lightning_frontier.toml.
# After server is up
export SWITCHYARD_URL=http://127.0.0.1:4000
export SWITCHYARD_MODEL=agent-route
python examples/07_proxy_client.pyExport Prometheus metrics from the real server. In your harness (or this kit’s summarize_run), log:
- route id / target / model
- tokens, latency, success
- whether the step was an escalate
Optimize $ / green CI not tokens in isolation.