switchback — part of the aimock family private · pre-launch

One endpoint.
Every provider.
No single point of failure.

Automatic failover across providers, hard budget caps you can't blow through, and a full record of every call, on infrastructure you run.

Six things an LLM edge has to get right

Every one of these is a decision you write down in config, not a heuristic you inherit.

You pay your providers directly. switchback takes no per-token fee of its own.

Five dialects, one request shape

A dialect is a full round trip: request translation, response parsing, stream normalization. Chains mix them freely, and fourteen bundled host profiles layer per-vendor quirks on top.

One file describes the whole edge

Upstreams, models, routes, caps, and what each one makes the router do.

switchback.config.json

excerpt json
{ "route": {
  "listen": { "host": "127.0.0.1", "port": 8787 },
  "upstreams": {
    "openai-primary": {
      "baseURL": "https://api.openai.com/v1",
      "dialect": "openai-compat",
      "auth": { "env": "OPENAI_API_KEY" }
    },
    "anthropic-main": {
      "baseURL": "https://api.anthropic.com",
      "dialect": "anthropic-messages",
      "auth": { "env": "ANTHROPIC_API_KEY" }
    }
  },
  "models": {
    "mux/fast": {
      "openai-primary": "gpt-4o",
      "anthropic-main": "claude-sonnet-4-5"
    }
  },
  "routes": {
    "chat-default": {
      "match": { "models": ["mux/fast"] },
      "chain": ["mux/fast"],
      "policy": {
        "advanceOn": ["rate_limited", "server_error"]
      }
    }
  },
  "budget": {
    "backend": { "kind": "redis" },
    "global": { "dollars": "250.00", "window": "daily" }
  }
} }

What the router then does

  • Binds loopback

    Nothing is exposed off-box until you change listen.host yourself.
  • Resolves two keys

    Separately, at startup. An unset variable is a startup failure naming it, not a 500 during the incident you're already having.
  • Matches, then chains

    mux/fast expands to two legs. The first tries openai-primary; on a class listed in advanceOn the same request is translated into the Anthropic Messages dialect for anthropic-main.
  • Reserves, then settles

    Against a shared Redis counter, so a fleet of replicas shares one daily ceiling instead of each enforcing its own.

The full key-by-key reference lives in Configuration, and the matching and failover rules in Routing.

Where this actually stands

Private, pre-launch
The repository is private and nothing is published to a registry. No release, no support commitment, no pricing.
There is nothing to install
No registry package exists, so no npx or npm install line here will work. You build from a checkout and run node dist/switchback-cli.js. See Install.
The config shape can change
The router is under active development and its config shape and behavior may change without notice. The CLI prints the same warning when it starts.

Kin to aimock

aimock mocks LLM traffic; switchback routes it. Same team, same reading of provider wire formats, two separate tools. You can run either without the other.

Write the failover policy down. Then read it back at 3am.

One file you own, on a box you own, with the keys you already have.

Or start from the concern you have: Install · OpenRouter migration · Security · Observability · Deploy