About this project

Switchboard is a local-first AI gateway that runs entirely on your machine, offering one OpenAI-compatible endpoint to route requests across 16 different AI providers including Groq, Cerebras, Google, OpenRouter, DeepSeek, Mistral, OpenAI, and Anthropic. It intelligently selects the optimal provider per request based on real-time factors like health, latency, cost, and tier — prioritizing free tiers and automatically falling back if a provider fails. Every routing decision is stored and explained in detail, showing why each candidate was chosen or excluded, including cost breakdowns and failure reasons. The system requires no cloud account or telemetry; credentials are encrypted locally using AES-256-GCM and never leave your device except for upstream API calls. It supports streaming and non-streaming chat completions, embeddings, image generation, audio speech and transcription, reranking, and moderation endpoints. All responses include routing metadata headers such as provider used, model, tier, cost, latency, and fallback reason when applicable. Switchboard includes a dashboard accessible at http://localhost:7272 and a CLI tool (sb) for managing providers, keys, models, and policies. You can simulate routing decisions without sending traffic, tune strategies like 'auto' (free-first), 'fast', 'quality', or 'failover', and view detailed logs and usage reports. It’s built with Node.js 22.13+, uses SQLite for persistence without native modules, and works identically across Windows, macOS, and Linux. Resilience features include circuit breakers per connection, model lockouts after rate limits, and fallback walks up to maxAttempts. Streaming responses are never retried once started. Configuration is optional with sane defaults, and CORS is disabled by default for security. The desktop app builds via Electron and runs in the system tray with start-at-login support. Still pre-1.0, it has addressed major audit findings including test coverage (now ~1035 tests), structured logging with redaction, persisted rate limiting, and secure credential handling. Known limitations include no npm release yet (install via git clone), no end-to-end tests, no audit log for admin actions, and no graceful shutdown. Not intended for public internet exposure without reverse proxy and authentication.