explaingit

llmrelay/relay

Analysis updated 2026-05-18

3GoAudience · developerComplexity · 3/5LicenseSetup · easy

TLDR

A self-hosted, zero-telemetry LLM gateway that lets any OpenAI or Anthropic style tool talk to any AI provider through one local server.

Mindmap

mindmap
  root((relay))
    What it does
      Self-hosted LLM gateway
      OpenAI and Anthropic dialects
      Routes to any provider
    Tech stack
      Go
      OpenAI API
      Anthropic API
    Use cases
      Point coding tools at any model
      Failover between providers
      Test smart routing on real traffic
    Audience
      Developers
      Self-hosters
      AI tool builders

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

Run one local gateway that lets Claude Code, Cursor, or any OpenAI-compatible tool talk to any LLM provider

USE CASE 2

Automatically fail over to a backup provider or API key when one starts erroring

USE CASE 3

Route cheap, high volume requests to a low cost model and hard requests to a stronger one

USE CASE 4

Test whether smart model routing actually beats a strong baseline on your own traffic before turning it on

What is it built with?

GoOpenAI APIAnthropic API

How does it compare?

llmrelay/relay12vault/ravelalexremn/finalizer-doctor
Stars333
LanguageGoGoGo
Setup difficultyeasyeasyeasy
Complexity3/52/53/5
Audiencedeveloperdeveloperops devops

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

How do you get it running?

Difficulty · easy Time to first run · 5min

Single static binary, just set provider API keys as environment variables and run relay serve.

Use, modify, and redistribute the code freely, including for commercial purposes, as long as you keep the copyright and license notices.

In plain English

relay is a self hosted gateway that sits between your applications and a range of AI providers, letting you talk to any of them through one server on your own machine. It accepts requests written in either the OpenAI or Anthropic API formats, so tools built for one of those, such as Claude Code or any OpenAI compatible SDK, can be pointed at relay instead, and it forwards those requests out to whichever provider you have configured, including OpenAI, Anthropic, Gemini, Groq, DeepSeek, Mistral, or a locally running Ollama model. It ships as a single small program with no external dependencies to install, and it does not collect or send any usage data back to its maker. Getting started involves installing the program, setting environment variables for whichever provider API keys you already have, and starting the server, after which any tool that speaks the OpenAI or Anthropic protocol can be redirected to it with a single URL change. A setup command can generate a starter configuration file that documents where to find each provider's key. Routing between providers can be as simple as fixed rules choosing the cheapest, fastest, or a specific model, with built in reliability features like automatic retries, spreading requests across a pool of API keys, and switching away from a failing provider mid stream. There is also an optional smart routing mode that tries to send easy requests to a cheap model and harder requests to a stronger one, but this mode ships turned off by default. The project includes its own built in evaluation tool for testing whether that smart routing genuinely beats simply always using a strong model on real traffic, and its own published results show one of its routing tiers currently failing that bar, which is why it stays off unless a user turns it on deliberately. The project is written in Go, distributed as a single static binary, and released under the Apache 2.0 license, which allows free use, modification, and redistribution including for commercial purposes.

Copy-paste prompts

Prompt 1
Help me install relay and point Claude Code at it through ANTHROPIC_BASE_URL
Prompt 2
Explain how to configure relay to route between Gemini, Anthropic, and a local Ollama model
Prompt 3
Show me how to set up automatic failover and retries in relay's routing config
Prompt 4
Walk me through running relay eval to test whether smart routing beats my baseline model

Frequently asked questions

What is relay?

A self-hosted, zero-telemetry LLM gateway that lets any OpenAI or Anthropic style tool talk to any AI provider through one local server.

What language is relay written in?

Mainly Go. The stack also includes Go, OpenAI API, Anthropic API.

What license does relay use?

Use, modify, and redistribute the code freely, including for commercial purposes, as long as you keep the copyright and license notices.

How hard is relay to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is relay for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.