SwitchyardAI coding gateway

Every AI coding call, metered and on the right model.

Your engineers run several AI coding tools, and every one asks for the biggest model, autocomplete included. Switchyard sits between every tool and every model.

Switchyard's By tool panel on the projected month: Claude Code, Codex, Cursor, Devin and Antigravity, each routed cost against unrouted

Engineering teams run five AI coding tools, and every one sends every call to the biggest model, autocomplete included. Nobody could say which tool, engineer or team the bill came from.

One gateway every tool points at. It meters every call's tokens and cost by tool, engineer and team, routes each call to the cheapest model that can do it, and holds teams to their budgets.

How it works

  1. Point every tool at one gateway

    Claude Code, Codex, Cursor, Devin and Antigravity each take a custom base URL and key, so they route through Switchyard without changing how anyone works. Its policy file names all five.

    README.md
     Claude Code ─┐                        ┌─▶ frontier   (planning, long context)
     Codex ───────┤                        │
     Cursor ──────┼──▶  SWITCHYARD  ──route─┼─▶ standard   (agentic edits with tools)
     Devin ───────┤    meter · policy      │
     Antigravity ─┘    budget · audit      └─▶ small      (autocomplete, commit messages, lint fixes)
    
  2. Each call onto the right track

    Plans go to a frontier model, agentic edits to a standard one, autocomplete and commit messages to a small one. The rules are a file you can read.

    config/policy.json
    "tiers": {
      "frontier": { "anthropic": "claude-opus-5-5",   "openai": "gpt-5" },
      "standard": { "anthropic": "claude-sonnet-5-5", "openai": "gpt-5-mini" },
      "small":    { "anthropic": "claude-haiku-4-5",  "openai": "gpt-5-nano" }
    },
    "routing": {
      "smallMaxInputTokens": 2000,
      "frontierMinInputTokens": 60000,
      "smallTasks": ["autocomplete", "commit_message", "summarize", "rename",
                     "docstring", "lint_fix", "explain"],
      "frontierTasks": ["plan", "architecture", "debug_hard", "migration"],
      "honourPinnedModels": true
    }
    
  3. Every token, by tool, engineer and team

    The dashboard streams each call as it is routed: the model asked for, the model used, and what it cost.

    Switchyard on the projected month: $6,004.83 saved, 39% cheaper than unrouted, $9,486.78 spent after routing
  4. Teams held to their budgets

    Each team has a monthly budget on the dashboard, and spend per ticket and PR can be posted back to GitHub, Jira, Linear or ClickUp.

    Switchyard's team budgets on the projected month: Platform $2,366.83 of $40,000, Product $2,382.73 of $32,000, Data $2,383.76 of $24,000, Mobile $2,353.46 of $18,000

The last calls of the month, as they were routed

Thirteen calls from the projected month the dashboard opens on: which tool sent each one, the model it asked for, the model it got, and the rule that decided.

UTCToolTeamTaskAsked for → routed toRuleTokensCostUnrouted
17:59:55CursorProductautocompletegpt-5routed togpt-5-nanotask "autocomplete" is routine1.6k$0.0003$0.0072
17:59:51CursorPlatform·gpt-5routed togpt-5-miniagentic edit with tools47.7k$0.0130$0.0652
17:59:46Claude CodePlatform·claude-opus-5-5routed toclaude-haiku-4-5small edit (32,530 tokens), aggressive policy33.4k$0.0371$0.1853
17:59:42Claude CodeMobile·claude-opus-5-5routed toclaude-haiku-4-5small edit (32,006 tokens), aggressive policy32.5k$0.0345$0.1726
17:59:37CursorMobileautocompletegpt-5routed togpt-5-nanotask "autocomplete" is routine1.2k$0.0003$0.0075
17:59:33DevinMobile·claude-opus-5-5keptlong context (87,520 tokens)88.5k$0.4611·
17:59:28Claude CodeProductplanclaude-opus-5-5kepttask "plan" needs frontier reasoning23.6k$0.1200·
17:59:24Claude CodeProduct·claude-opus-5-5routed toclaude-sonnet-5-5agentic edit with tools48.8k$0.1490$0.2483
17:59:19CursorPlatform·gpt-5routed togpt-5-minigeneral request3.7k$0.0020$0.0102
17:59:15Claude CodeProductsummarizeclaude-opus-5-5routed toclaude-haiku-4-5task "summarize" is routine8.5k$0.0105$0.0527
17:59:10AntigravityMobilelint_fixclaude-opus-5-5routed toclaude-haiku-4-5task "lint_fix" is routine2.6k$0.0028$0.0141
17:59:06CursorPlatformautocompletegpt-5routed togpt-5-nanotask "autocomplete" is routine1.6k$0.0003$0.0072
17:59:01CodexPlatform·gpt-5routed togpt-5-miniagentic edit with tools43.1k$0.0117$0.0587

The 17:59:46 Claude Code call, through route() in src/router.ts

  1. 1Team over budget?Platform: $2,366.83 of $40,000 this monthno
  2. 2Model pinned by the caller?no x-switchyard-pin headerno
  3. 3A frontier task?plan, architecture, debug_hard, migration: no task sentno
  4. 4Long context?32,530 input tokens, under 60,000no
  5. 5A routine task?autocomplete, commit_message, summarize…: no task sentno
  6. 6A small edit with tools?32,530 tokens, within 40,000 (aggressive policy)yes
Routed to
claude-haiku-4-5 (small)
Cost
32,530 × $1/M + 905 × $5/M = $0.0371
On the model it asked for
32,530 × $5/M + 905 × $25/M = $0.1853
Ticket
jira:PLAT-1440, stored on the call as its ref
npm run report -- --ref jira:PLAT-1440 --post
AI spend for jira:PLAT-1440 (Switchyard)
19,702 calls · 456.57M tokens · $1182.46 after routing ($1918.54 unrouted, $736.07 saved)
- claude-code: $690.00
- devin: $305.36
- antigravity: $143.35
- codex: $24.32
- cursor: $19.44

The comment it posts to the ticket, for every call on it this month.

In numbers

For a team of 24 engineers making about 158,000 calls a month, at standard model prices. Routing small edits to small models too saves $6,005 (38.8%) a month; the default rules save $5,051 (32.6%).

Built with

  • TypeScript
  • Node.js
  • SQLite
  • MCP
  • OpenTelemetry
  • Docker
  • Kubernetes

Connects to

  • Claude Code
  • Cursor
  • Codex
  • Devin
  • Antigravity
  • Anthropic
  • OpenAI
  • GitHub
  • Jira
  • Linear
  • ClickUp
How Switchyard is built: the problem, the counted results and the architecture

The film

Switchyard

One gateway for every coding agent. It meters each call by tool, engineer and team, and routes it to the cheapest model that can do it.