route-switch

Quickstart

From a fresh checkout to your first routed, logged request. route-switch is a single Go binary — no daemon, no managed cloud.

  1. 1

    Build the binary

    Clone github.com/Skelf-Research/route-switch and build with Go 1.24+ using `go build ./...`, producing a single route-switch binary.

  2. 2

    Write config.yaml

    Declare a provider block with your API keys, a strategy (round_robin, weighted, or performance_based), and one or more prompt+model+provider combinations.

  3. 3

    Register a prompt template

    Use the CLI to register a YAML prompt manifest with a variable schema, so it is addressable by ID from request metadata.

  4. 4

    Run the gateway

    Start the binary with --gateway pointed at config.yaml; it exposes /v1/chat/completions plus /health, /status, and /v1/system/analytics.

  5. 5

    Point your OpenAI client at it

    Set the base URL of your existing OpenAI client to the gateway address. No SDK rewrite is needed.

  6. 6

    Enable the optimizer

    Set gateway.optimization.enabled: true with an interval; the background MIPROv2 optimizer replays captured traces and rewrites templates.

# build
git clone https://github.com/Skelf-Research/route-switch && cd route-switch
go build -o route-switch ./...

# run the gateway
./route-switch --gateway --config config.yaml

# send a request with your existing OpenAI client
curl http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4","messages":[{"role":"user","content":"hi"}]}'

Exact flags and config keys may still move — see the documentation for the authoritative reference, and pin a tagged release.

Related