bandit-router

BYOKzero-persistencesplit-plane

What is bandit-router?

A bring-your-own-key (BYOK) routing gateway. It sits between your editor (/v1/chat/completions and /v1/messages) and your providers, and uses empirical-Bayes Thompson sampling over a vetted Pareto frontier of (model, provider) arms to maximize quality per dollar. Each session is pinned to a single arm: the router never switches models mid-thread, which preserves 90–98% KV-cache hit rates while steering traffic away from hosts that evict cache or serve degraded models.

Virtual model slugs

SlugRole
bandit/builderHeavy lifting: multi-file edits, refactors, code generation.
bandit/scoutFast, cheap reads: search, summarize, and report back distilled facts.
bandit/fastUltra-cheap utility lane: titles, labels, embeddings-class tasks.
bandit/zdr-builderBuilder role restricted to zero-data-retention (ZDR) hosts.
bandit/zdr-scoutScout role restricted to zero-data-retention (ZDR) hosts.

Why does my agent behave differently?

Session-sticky KV caching

One (model, provider) arm is drawn per session and never switched mid-thread, so your provider's KV cache stays warm (90–98% hit rate). Your prompts, tool schemas, reasoning effort, and output budgets are never modified.

Capability-aware cost physics

When your client exposes sub-agent delegation tools (spawn_agent/Task), the gateway adds backpressure: read-spiral counters nudge the parent to delegate, oversized tool outputs are capped at 48k characters, and child edits are verified against the workspace with git diff -U3 so the parent never re-reads files to check them.

Disabling Exocortex hints

Want 100% raw pass-through? Send X-Bandit-Raw-Passthrough: 1 per request, restart the gateway with --raw-passthrough, or set BANDIT_EXOCORTEX_MODE=0. No nudges, no counters, no diff checks — just routing.

Quickstart

Claude Code

export ANTHROPIC_BASE_URL="https://api.banditrouter.com/v1/messages"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
claude --model bandit/builder

Zed

{
  "language_models": {
    "openai": {
      "api_url": "https://api.banditrouter.com/v1",
      "available_models": [
        {"name": "bandit/builder", "display_name": "bandit/builder"},
        {"name": "bandit/scout", "display_name": "bandit/scout"},
        {"name": "bandit/fast", "display_name": "bandit/fast"}
      ]
    }
  }
}

Privacy & split-plane mode

/v1/chat/completions and /v1/messages are RAM-only: prompts and completions are never persisted, and your API key passes straight through to the upstream provider. For maximum privacy, the split-plane /v1/route control endpoint plus the MIT-licensed shim/local_forwarder.py keep prompts on your machine: the router receives zero prompt bytes and only quantized blind receipts.

Explore

/v1/radar · /v1/models