whatisgithub

What is ai-gateway?

vaalacat/ai-gateway — explained in plain English

Analysis updated 2026-05-18

10GoAudience · ops devopsComplexity · 4/5LicenseSetup · moderate

In one sentence

A self hosted gateway that sits in front of OpenAI, Claude, and other AI providers, adding token management, routing, quotas, and billing on top.

Mindmap

mindmap
  root((ai gateway))
    What it does
      Proxies AI API requests
      Adds auth and quotas
      Tracks usage and billing
    Tech stack
      Go
      Docker Compose
      Kubernetes
    Use cases
      Team wide AI API gateway
      Multi region agent routing
      Model aggregation and retries
    Audience
      DevOps and platform teams
      Self hosted AI operators

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Give a team a single internal API endpoint that routes to multiple AI providers with per-user quotas.

USE CASE 2

Aggregate several upstream models under one name with load balancing and automatic retries.

USE CASE 3

Run AI proxy agents across multiple regions synced from one central control plane.

USE CASE 4

Track and bill AI API usage per user and channel with daily rollups.

What is it built with?

GoDocker ComposeKubernetesWebSocketNode.js

How does it compare?

vaalacat/ai-gatewayaaklon/akinatoradguardteam/go-webext
Stars10911
LanguageGoGoGo
Last pushed2026-06-25
MaintenanceActive
Setup difficultymoderatemoderatemoderate
Complexity4/53/52/5
Audienceops devopsdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Needs Docker Compose plus a config.yaml with a JWT secret and admin password set before first run.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

So what is it?

ai-gateway is a self hosted proxy server for AI API requests, designed to sit in front of AI model providers like OpenAI and Claude and add management, routing, and billing features on top of them. The core idea is that instead of pointing your applications directly at an AI provider's API, you point them at this gateway instead. The gateway exposes OpenAI and Claude compatible endpoints and handles the rest: authenticating requests with your own tokens, routing them to the right upstream provider, tracking usage, and enforcing per user quotas. The architecture splits into two parts. The control plane, called the master, handles administration: managing users, tokens, channels, models, and routing rules through a web UI and admin API. The data plane, called an agent, handles the actual request traffic, relaying calls to upstream providers and reporting usage back. In the simplest setup, both run together in one process on a single machine. For larger deployments, you can run multiple agents across different locations or regions, kept in sync with the master over a WebSocket connection. Model routing lets you group several upstream providers or model variants under one name, with priority and weight settings so traffic spreads across them and failed requests retry automatically. A cross region routing feature can also send requests from one region to agents in another, which helps balance load or route around regional restrictions. A built in billing module tracks usage per request and rolls it up daily by user and channel. The project is written in Go, with the web frontend embedded directly into the compiled binary so no separate web server is needed. Deployment is via Docker Compose, or Kubernetes for larger setups. Building from source requires Go 1.25 and Node.js 20. It is licensed under MIT.

Copy-paste prompts

Prompt 1
Help me set up ai-gateway with Docker Compose using a config.example.yaml template.
Prompt 2
Explain how to configure a multi-node ai-gateway deployment with external agents and an enrollment token.
Prompt 3
Show me how to set up model routing in ai-gateway to load balance across multiple upstream providers.
Prompt 4
Help me deploy ai-gateway to Kubernetes following the docs/k8s-deployment.md guide.

Frequently asked questions

What is ai-gateway?

A self hosted gateway that sits in front of OpenAI, Claude, and other AI providers, adding token management, routing, quotas, and billing on top.

What language is ai-gateway written in?

Mainly Go. The stack also includes Go, Docker Compose, Kubernetes.

What license does ai-gateway use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is ai-gateway to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is ai-gateway for?

Mainly ops devops.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.