Open-source AI gateway giving one OpenAI-compatible API across 23+ LLM providers, with failover, load balancing, semantic caching and virtual keys.
ferro-labs/ai-gateway
Open-source Go gateway that routes LLM requests across 30 providers through one OpenAI-compatible API, with caching, guardrails and cost controls.
Open-source alternative to:LiteLLM
- Stars
- 279
- Forks
- 40
- Open issues
- 67
- Last commit
- 5 days ago
What is it?
Ferro Labs AI Gateway is a self-hosted proxy that sits between your application and LLM providers such as OpenAI, Anthropic and AWS Bedrock. Clients send standard OpenAI-format requests to one endpoint, and the gateway forwards them to the configured provider, with routing strategies including fallback, load balancing, least latency, cost-optimized and A/B testing.
The gateway ships as a single static Go binary with no external services required. It includes built-in plugins for word filtering, PII redaction, secret scanning, prompt-injection detection, response caching, rate limiting and per-key budgets, and it can connect to MCP tool servers and run the tool-call loop. OpenTelemetry tracing and Prometheus metrics are available when enabled, and a web dashboard is embedded in the release binaries.
Configuration is a single YAML or JSON file, and the CLI provides init, validate and doctor commands. Deployment options include Docker, Helm on Kubernetes, Railway and Render, with SQLite or PostgreSQL storage.
Key features
- 01Routes requests to 30 LLM providers through a single OpenAI-compatible API.
- 02Offers eight routing strategies, including fallback, load balancing and A/B testing.
- 03Includes built-in guardrails for PII redaction, secret scanning and prompt-injection detection.
- 04Provides response caching, rate limiting and per-key budget controls.
- 05Connects to MCP tool servers over stdio and Streamable HTTP.
- 06Exposes OpenTelemetry tracing and Prometheus metrics, disabled until turned on.
Use cases
- Giving internal teams one endpoint for several LLM providers with failover between them.
- Enforcing PII redaction or content filters before prompts reach external model APIs.
- Tracking token spend and setting per-key budgets across applications.
- Running a self-hosted gateway in Kubernetes or Docker with existing OpenAI SDK clients.
Quick start
- 1
Install the ferrogw CLI with npm
npm install -g ferrogw - 2
Set your upstream provider API key (here OpenAI)
export OPENAI_API_KEY=sk-your-key - 3
Run ferrogw init to write config.yaml and print your master key; save the key, as it is shown only once
ferrogw init - 4
Start the server on port 8080 (set GATEWAY_CONFIG and MASTER_KEY first, as described in the README)
ferrogw serve
Things to know
- Routing requests requires at least one upstream provider API key, such as OPENAI_API_KEY.
In collections
Topics
FAQ
- What is ai-gateway?
- Open-source Go gateway that routes LLM requests across 30 providers through one OpenAI-compatible API, with caching, guardrails and cost controls. Ferro Labs AI Gateway is a self-hosted proxy that sits between your application and LLM providers such as OpenAI, Anthropic and AWS Bedrock. Clients send standard OpenAI-format requests to one endpoint, and the gateway forwards them to the configured provider, with routing strategies including fallback, load balancing, least latency, cost-optimized and A/B testing.
- Is ai-gateway free to use? What license does it have?
- ai-gateway is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is ai-gateway still maintained?
- Actively maintained. The last commit to ai-gateway was on Nov 2, 2026.
- What can I use ai-gateway for?
- Giving internal teams one endpoint for several LLM providers with failover between them. Enforcing PII redaction or content filters before prompts reach external model APIs. Tracking token spend and setting per-key budgets across applications. Running a self-hosted gateway in Kubernetes or Docker with existing OpenAI SDK clients.
- How do I install ai-gateway?
- Install the ferrogw CLI with npm: npm install -g ferrogw Set your upstream provider API key (here OpenAI): export OPENAI_API_KEY=sk-your-key Run ferrogw init to write config.yaml and print your master key; save the key, as it is shown only once: ferrogw init Start the server on port 8080 (set GATEWAY_CONFIG and MASTER_KEY first, as described in the README): ferrogw serve
- Where can I get ai-gateway?
- The source code and installation instructions are on GitHub: https://github.com/ferro-labs/ai-gateway
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.
Self-hosted, OpenAI-compatible LLM gateway that routes one endpoint to 40+ providers with virtual keys, budgets, and usage tracking.
A Go-based AI gateway that exposes OpenAI, Claude and Gemini compatible endpoints and routes requests across multiple upstream model channels.
Self-hosted Go AI gateway exposing an OpenAI- and Anthropic-compatible API in front of many LLM providers, with cost tracking, failover and guardrails.
Self-hostable MIT AI gateway that exposes one OpenAI-compatible endpoint to hundreds of model providers, with quota-aware auto-fallback and token compression.