route-switch

Features

route-switch is a single Go binary that runs as an OpenAI-compatible gateway. It owns the prompt, the routing decision, and the analytics — and closes the loop with an optimizer. Here is the full capability surface.

Gateway

One OpenAI-compatible endpoint in front of every provider you use

OpenAI-compatible endpoint

A drop-in /v1/chat/completions endpoint (streaming and non-streaming). Point any OpenAI client at route-switch by changing the base URL — no SDK rewrite.

Learn more →

Multi-provider fan-out

One gateway fronts OpenAI, Anthropic, Google, Ollama, Cohere, and Mistral through the gollm adapter, using credentials you supply per provider.

Learn more →

Routing & prompts

Strategy-based balancing over registered prompt+model+provider combinations

Routing strategies

Balance registered prompt+model+provider combinations by round_robin, weighted, or performance_based strategy, with fallback when a combination's success rate drops.

Learn more →

Prompt registry

Templates are first-class objects: YAML manifests with variable schemas, addressable by ID, rendered server-side. The gateway owns the prompt, not the request payload.

Learn more →

Prompt optimization

A closed loop between captured production traffic and prompt quality

MIPROv2 optimization

A background optimizer reruns MIPROv2 — instruction + few-shot search via goptuna's Bayesian optimizer — against captured traces, scores candidates, and ships the winner.

Learn more →

Operations

Local analytics, portable packages, and single-binary self-hosting

DuckDB trace analytics

Every call is logged to a per-prompt SQLite dataset and a DuckDB analytics store: success rate, latency, and cost per prompt and globally, queryable locally.

Learn more →

Portable prompt packages

Bundle a template plus its dataset snapshot and recent logs into a tarball and move it between environments. The prompt, its data, and its history travel together.

Learn more →

Self-hosted, single binary

One Go binary runs as CLI or gateway. No managed cloud, no daemon zoo. You keep the SQLite and DuckDB files, and your traffic never leaves your infrastructure.

Learn more →

See how route-switch compares

Grounded comparisons against OpenRouter and Portkey.