About this project

LocalRouter is a self-hosted AI API proxy gateway designed to run entirely on your local machine. It allows developers to unify access to multiple AI providers — including OpenAI, Anthropic, Azure, Ollama, and others — behind a single consistent endpoint. This eliminates the need to modify application code when switching providers or models. Key features include model aliasing (e.g., mapping 'gpt-4o' to any upstream provider), one-click switching between active upstreams, full request/response logging (including streaming SSE content), real-time cost tracking based on configurable per-model pricing, and detailed usage analytics with token trends and breakdowns by source, entry, or model. The tool supports access control via optional authentication tokens and offers both desktop apps (macOS, Windows, Linux) and server modes. All data is stored locally in an SQLite database, ensuring privacy and offline operation. Developers can integrate it seamlessly with existing OpenAI SDKs by simply changing the base URL. The dashboard provides visual management of sources, entries, logs, and statistics, making debugging and monitoring straightforward. Logs are capped at 10,000 entries with automatic trimming of non-starred records, while starred logs are preserved indefinitely. Configuration is simple via a .env file for port and database path. MIT licensed.