A self-hosted LLM API gateway for individuals that aggregates multiple provider channels behind one endpoint with failover and cost tracking.
theopenco/llmgateway
An open-source API gateway that routes LLM requests across multiple providers through an OpenAI-compatible interface, with key management and usage analytics.
Open-source alternative to:OpenRouter
- Stars
- 1,729
- Forks
- 201
- Open issues
- 87
- Last commit
- yesterday
What is it?
LLM Gateway sits between your applications and large language model providers such as OpenAI, Anthropic and Google Vertex AI. Applications send requests to one endpoint, and the gateway forwards them to the chosen provider, so you do not need a separate integration for each service.
API keys for different providers are managed in one place. The gateway tracks requests, token usage, response times and costs, and includes performance comparisons across models to help evaluate cost-effectiveness.
It can be used as a hosted service at llmgateway.io or self-hosted with Docker, using a unified container that bundles PostgreSQL and Redis. The codebase is a TypeScript monorepo with a Hono backend, Next.js dashboards and a Drizzle ORM schema. The core is AGPLv3, and certain enterprise features in the ee/ directory are under a separate commercial license.
Key features
- 01Exposes an OpenAI-compatible API for routing to multiple providers
- 02Centralized management of API keys for different providers
- 03Tracks token usage, costs, and response times per request
- 04Compares performance and cost across models
- 05Can be self-hosted with Docker or used as a hosted service
Use cases
- Switching an existing OpenAI-based application to other providers with minimal code changes
- Tracking LLM spending and token usage across a team or multiple projects
- Comparing model cost and latency before choosing a default model
- Running a self-hosted LLM gateway that keeps request data under your own control
Quick start
- 1
Install dependencies and set up the development environment (requires Docker)
pnpm i && pnpm run setup - 2
Start the development servers
pnpm dev
Things to know
- Core code is licensed under AGPLv3, a copyleft license with obligations for networked services.
- Commercial features in the ee/ directory require a paid Enterprise license.
- Development setup depends on Docker services for the database and related components.
In collections
Topics
FAQ
- What is llmgateway?
- An open-source API gateway that routes LLM requests across multiple providers through an OpenAI-compatible interface, with key management and usage analytics. LLM Gateway sits between your applications and large language model providers such as OpenAI, Anthropic and Google Vertex AI. Applications send requests to one endpoint, and the gateway forwards them to the chosen provider, so you do not need a separate integration for each service.
- Is llmgateway free to use? What license does it have?
- llmgateway is open source under the Other license. Check the license terms before using it in commercial products.
- Is llmgateway still maintained?
- Actively maintained. The last commit to llmgateway was on Nov 6, 2026.
- What can I use llmgateway for?
- Switching an existing OpenAI-based application to other providers with minimal code changes Tracking LLM spending and token usage across a team or multiple projects Comparing model cost and latency before choosing a default model Running a self-hosted LLM gateway that keeps request data under your own control
- How do I install llmgateway?
- Install dependencies and set up the development environment (requires Docker): pnpm i && pnpm run setup Start the development servers: pnpm dev
- Where can I get llmgateway?
- The source code and installation instructions are on GitHub: https://github.com/theopenco/llmgateway
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A single Rust binary that gives any AI SDK one endpoint to reach many LLM vendors, with MCP tools, traffic control and request logging.
A self-hosted AI gateway that exposes OpenAI, Claude and Gemini compatible APIs in front of many upstream model providers, with routing, keys, quotas and cost tracking.
Self-hosted AI gateway that puts API keys and subscription accounts from many providers behind one endpoint, with scheduling, failover and usage logs.
Self-hosted Go AI gateway exposing an OpenAI- and Anthropic-compatible API in front of many LLM providers, with cost tracking, failover and guardrails.
An open source control plane built on Envoy that gives apps one OpenAI-compatible API across hosted LLM providers, self-hosted inference and MCP servers.