git404hub

what is llm-gateway fr?

aaronrzh/llm-gateway — explained in plain English

Analysis updated 2026-05-18

12GoAudience · developerComplexity · 4/5Setup · moderate

tl;dr

A self-hosted router that lets you call OpenAI, Anthropic, and other AI providers through one consistent API, with automatic failover and usage tracking.

vibe map

mindmap
  root((llm-gateway))
    What it does
      Routes to providers
      Converts request format
      Streams responses
    Tech stack
      Go
      Gin
      PostgreSQL
      Redis
    Use cases
      Multi provider apps
      Cost tracking
      Failover setups
    Audience
      Backend developers
      Small AI teams

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 make with this?

VIBE 1

Route chat requests across OpenAI, Anthropic, and DeepSeek with one API call.

VIBE 2

Automatically fall back to a backup provider if the primary one fails.

VIBE 3

Track token usage and cost across every AI provider from one dashboard.

VIBE 4

Manage API keys for a team through a web admin panel instead of config files.

what's the stack?

GoGinPostgreSQLRedisDocker

how it stacks up fr

aaronrzh/llm-gatewaycraftingcodegig/datamaticizzzzzi/agent-assh
Stars121212
LanguageGoGoGo
Setup difficultymoderatemoderateeasy
Complexity4/53/53/5
Audiencedeveloperdeveloperdeveloper

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

how do i run it?

Difficulty · moderate time til it works · 30min

Needs Docker for PostgreSQL and Redis plus API keys for each provider you want to route to.

in plain english

LLM Gateway is a traffic router that sits between your application and multiple AI providers such as OpenAI, Anthropic, DeepSeek, and a few Chinese providers. Instead of writing separate code for each provider's API format, you send requests in either OpenAI or Anthropic style, and the gateway automatically translates the request to whatever format the chosen upstream provider expects, including streaming responses. The gateway picks which provider and model to use through configurable routing strategies: by priority order, round robin, lowest latency, or lowest cost. Models can also be grouped into tiers like premium, standard, or economy, so a request can automatically fall back to a similar tier if the first choice is unavailable. If a provider starts failing repeatedly, a circuit breaker temporarily stops sending it traffic and reroutes to healthy alternatives, then tests it again after a cooldown period. Other built-in features include rate limiting to control how many requests go through per second, token usage estimation and logging so you can track spend across providers, and API key management with support for both keys stored in config files and keys added dynamically through Redis. A web-based admin panel lets you manage providers, API keys, and model settings without editing configuration files directly, protected by login authentication. Under the hood it is built in Go using the Gin web framework, with PostgreSQL for storing usage data (with a file-based fallback if the database is unavailable), Redis for caching and dynamic key storage, and separate libraries for token counting and circuit breaking. Getting started involves copying an example environment file with your provider API keys, starting PostgreSQL and Redis with Docker, and running the gateway with a single command. This project would suit developers or small teams who call multiple AI providers and want one consistent endpoint, automatic failover, and centralized cost tracking, rather than building that plumbing themselves for every provider they use.

prompts (copy fr)

prompt 1
Help me set up llm-gateway locally with Docker and connect it to my OpenAI and Anthropic API keys.
prompt 2
Show me how to configure priority-based routing in llm-gateway so requests fall back from Claude to GPT-4 on failure.
prompt 3
Explain how llm-gateway's circuit breaker works and how to tune its failure threshold.
prompt 4
Write a config for llm-gateway that groups my models into premium and economy tiers.

Frequently asked questions

what is llm-gateway fr?

A self-hosted router that lets you call OpenAI, Anthropic, and other AI providers through one consistent API, with automatic failover and usage tracking.

What language is llm-gateway written in?

Mainly Go. The stack also includes Go, Gin, PostgreSQL.

How hard is llm-gateway to set up?

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

Who is llm-gateway for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.