llm-gateway logo

llm-gateway

Free

Multi-provider LLM gateway: routing, failover, circuit breakers, caching, per-tenant rate limits, cost tracking (FastAPI, Claude, Bedrock)

Visit Website
generative-aiawsclaudefastapillmaiai assistantautomation

Overview

LLM Gateway is an HTTP API that sits in front of multiple LLM providers. It handles routing, retries, cross-provider failover, circuit breaking, response caching, per-tenant rate limits, and cost tracking, and includes a live usage dashboard and Prometheus metrics. It is intended for teams running LLMs in production that want to switch models without redeploying clients, survive a provider outage, prevent one tenant from using shared quota, and understand spending.

Clients call a route alias such as smart, fast, or balanced instead of a model ID. Routing strategies include ordered fallback, cheapest-first cost, EWMA latency, and weighted canary or A-B splits. The gateway retries transient errors with exponential backoff, moves non-retryable errors to the next target, and uses circuit breakers with half-open probes. It caches exact-match requests using a SHA-256 key, with an in-memory LRU or Redis when REDIS_URL is set, and never caches refusals.

Per-tenant rate limits use two token buckets for requests per minute and tokens per minute, reserving max_tokens up front and reconciling against actual usage. API keys are stored as SHA-256 hashes and compared in constant time. Streaming uses Server-Sent Events, with failover transparent until the first byte. Observability includes Prometheus counters and histograms, an x-request-id header, and a /dashboard page. The project provides a quick start with a mock provider, API endpoints for chat, routes, admin usage, circuits, metrics, and health, and Terraform for AWS App Runner deployment.

Pricing

Free

Detailed plans have not been confirmed in our catalog. Check the official website for current limits and billing terms.

Visit Website

Prices and limits may change. Confirm the currency, billing period, seat minimum and usage caps on the official website.

Use Cases

  • Teams use LLM Gateway to switch models without redeploying clients by calling route aliases instead of model IDs.
  • Teams use LLM Gateway to survive provider outages through retries and cross-provider failover.
  • Teams use LLM Gateway to prevent one tenant from consuming shared quota with per-tenant request and token limits.
  • Teams use LLM Gateway to cache identical requests and reduce upstream calls.
  • Teams use LLM Gateway to monitor usage, cost, and fallbacks through Prometheus metrics and a dashboard.
  • Teams use LLM Gateway to stream responses with Server-Sent Events and transparent failover before the first byte.
  • Teams use LLM Gateway to add new providers by implementing complete() and stream() and registering them.
  • Teams use LLM Gateway to deploy on AWS with Terraform-provisioned App Runner, autoscaling, and Secrets Manager.

Features

Route requests across LLM providers

Fail over between providers

Protect routes with circuit breakers

Cache LLM responses

Apply per tenant rate limits

Track LLM usage costs

Reviews

No reviews yet. Be the first to share your experience!