█

AI/TLDR

Invítame a un café
Invítame un café

LLM Gateway (theopenco)

Una API compatible con OpenAI para enrutar, gestionar y registrar peticiones LLM entre distintos proveedores

Gateways & RoutingCódigo abierto
Idioma
TypeScript
Licencia
AGPL-3.0
$curl -X POST https://api.llmgateway.io/v1/chat/completions \
EN BREVE

What is LLM Gateway (theopenco)?

LLM Gateway (theopenco) is Una API compatible con OpenAI para enrutar, gestionar y registrar peticiones LLM entre distintos proveedores. It sits in the Gateways & Routing category of the Evaluation & Production Ops tools and is open-source, written in TypeScript and licensed AGPL-3.0. To get started: llama a la API alojada.

Resumen

LLM Gateway es un gateway de API de código abierto que se sitúa entre tus aplicaciones y varios proveedores de LLM. En lugar de integrar cada proveedor por separado, envías las peticiones a un único endpoint que usa el formato de la API de OpenAI y las reenvía a OpenAI, Anthropic, Google Vertex AI y otros.

Está pensado para equipos que usan varios proveedores de LLM y quieren un único lugar donde gestionar las claves de API, vigilar el uso de tokens y los costes, y comparar el rendimiento de los modelos. Como la interfaz coincide con el formato de OpenAI, el código cliente de OpenAI que ya tengas puede apuntar al gateway con cambios mínimos.

Como gateway/proxy LLM, añade una capa de enrutamiento y observabilidad a tu stack. Puedes usar la versión alojada en llmgateway.io o auto-alojar la imagen Docker unificada para tener control total sobre tus datos y tu configuración.

Qué hace

  • API compatible con OpenAI, así que los clientes de OpenAI existentes funcionan con pocos cambios
  • Enruta peticiones entre varios proveedores, como OpenAI, Anthropic y Google Vertex AI
  • Gestión centralizada de las claves de API de los proveedores en un solo lugar
  • Analíticas de uso de peticiones, tokens, tiempos de respuesta y costes
  • Monitorización del rendimiento para comparar modelos en velocidad y relación coste-eficacia
  • Auto-aloja con la imagen Docker unificada o usa el servicio alojado

Primeros pasos

Puedes usar el servicio alojado en llmgateway.io o auto-alojarlo con Docker. La vía más rápida es obtener una clave de API y llamar al endpoint de chat completions compatible con OpenAI del gateway.

Llama a la API alojada

Obtén una clave de API en llmgateway.io y envía una petición de chat completion al gateway. El endpoint sigue el formato de OpenAI, así que pasas un model y un array messages.

bashbash
curl -X POST https://api.llmgateway.io/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LLM_GATEWAY_API_KEY" \
  -d '{
  "model": "gpt-4o",
  "messages": [
    {"role": "user", "content": "Hello, how are you?"}
  ]
}'

Auto-aloja con Docker

Genera los secretos necesarios y ejecuta el script del contenedor unificado. Usa volúmenes con nombre gestionados por Docker para Postgres y Redis en lugar de montar un directorio del host.

bashbash
export LLM_GATEWAY_SECRET="$(openssl rand -base64 32 | tr -d '\n')"
export GATEWAY_API_KEY_HASH_SECRET="$(openssl rand -base64 32 | tr -d '\n')"
./scripts/run-unified-container.sh

O ejecuta un contenedor puntual

Si prefieres un único docker run, crea primero los volúmenes con nombre y pasa los secretos de autenticación como variables de entorno.

bashbash
docker volume create llmgateway_postgres
docker volume create llmgateway_redis

docker run -d \
  --name llmgateway \
  --restart unless-stopped \
  -p 3002:3002 -p 3003:3003 -p 3005:3005 \
  -p 3006:3006 -p 4001:4001 -p 4002:4002 \
  -v llmgateway_postgres:/var/lib/postgresql/data \
  -v llmgateway_redis:/var/lib/redis \
  -e AUTH_SECRET="$LLM_GATEWAY_SECRET" \
  -e GATEWAY_API_KEY_HASH_SECRET="$GATEWAY_API_KEY_HASH_SECRET" \
  ghcr.io/theopenco/llmgateway-unified:latest

Commands and code are distilled from the project's own documentation — always check the repositorio oficial para lo último.

Cuándo usarlo

  • Enruta una app entre OpenAI, Anthropic y Google a través de un solo endpoint, sin escribir integraciones por proveedor
  • Registra el uso de tokens y el gasto de todas las llamadas a LLM en un único panel
  • Gestiona y rota las claves de API de los proveedores de forma centralizada, en lugar de repartirlas entre servicios
  • Compara modelos por latencia y coste para decidir cuál usar en producción

How LLM Gateway (theopenco) compares

LLM Gateway (theopenco) alongside other open-source gateways & routing tools AI/TLDR tracks, ranked by GitHub stars.

HerramientaEstrellasQué hace
OmniRoute★ 91.4kA local-first AI gateway that fronts hundreds of model providers with one OpenAI-compatible endpoint, quota-aware auto-fallback, many routing strategies and prompt compression.
Free Claude Code★ 74.7kA local proxy that points Claude Code, Codex, Pi, OpenCode, Cline and other agent CLIs at 50 free, paid, subscription or local model providers, with automatic failover and an admin UI.
LiteLLM★ 64.2kA Python SDK and proxy server that gives one OpenAI-compatible API to 100+ LLM providers, with cost tracking, budgets, fallbacks, rate limiting, and an admin UI.
Kong Gateway★ 44.4kA Lua/NGINX API gateway whose AI Gateway plugins put one universal endpoint in front of OpenAI, Anthropic, Gemini, Bedrock and other providers, with semantic routing, caching and MCP traffic governance.
magpie★ 43.7kMenu bar app and local gateway that lets Claude Code, Codex, Gemini CLI and dozens of other coding agents run on any provider's model, with routing groups that fail over across accounts when a quota runs out.
9Router★ 33kLocal OpenAI-compatible router for coding CLIs that tracks per-provider quota, falls back from subscription to cheap to free models, and compresses tool results to cut tokens.
Experiential★ 20.1kAn open-source gateway that puts hosted, BYOK, local and custom models behind one OpenAI-compatible API, with per-identity model and spend limits and routers fitted from your own traces.
LLM Gateway (theopenco)★ 1.8kUna API compatible con OpenAI para enrutar, gestionar y registrar peticiones LLM entre distintos proveedores