explaingit

nasan-duodushu/gateapi

16HTMLAudience · developerComplexity · 4/5ActiveLicenseSetup · moderate

TLDR

Self-hosted gateway that aggregates multiple LLM API providers behind one OpenAI-compatible endpoint, with smart routing, protocol translation, and a model functional detection engine.

Mindmap

mindmap
  root((GateAPI))
    Inputs
      OpenAI requests
      Anthropic requests
      Multiple API keys
    Outputs
      Unified endpoint
      SSE streaming
      Detection reports
    Use Cases
      Aggregate resellers
      Detect fake models
      Failover routing
    Tech Stack
      Node.js
      SQLite
      Docker
      Web admin panel

Things people build with this

USE CASE 1

Aggregate API keys from several LLM resellers behind one endpoint

USE CASE 2

Auto-failover between providers when one returns 429 or empty responses

USE CASE 3

Detect whether a reseller is silently serving a cheaper model than advertised

USE CASE 4

Run scheduled health checks and get Telegram or Discord alerts

Tech stack

Node.jsSQLiteDockerHTML

Getting it running

Difficulty · moderate Time to first run · 30min

Default admin password is admin123 and must be changed on first login; needs Node.js 18+ or Docker.

Apache 2.0 lets you use, modify, and distribute the code commercially as long as you keep the license notice.

In plain English

GateAPI is a gateway that sits in front of multiple large language model providers and turns them into a single endpoint. The README describes the situation it is built for: a user who has accumulated API keys from several different LLM resellers, where some keys speak OpenAI's protocol, some speak Anthropic's, and each one supports a different set of models. GateAPI aggregates all of those upstream sources so the downstream caller only needs to talk to one address, normally /v1/chat/completions, and the gateway figures out where the request actually goes. The routing layer does more than dispatch. It tracks rolling latency and error rates per channel over the last fifty calls, and downweights channels that are slow or returning too many errors. A 429 rate-limit response triggers an exponential cooldown from thirty seconds up to five minutes. If an upstream returns an empty response, the gateway detects that and retries on another channel. Both OpenAI and Anthropic protocols are accepted as input and translated to whichever format the upstream expects, including SSE streaming in both directions. The second main feature is a detection engine. It can batch-test every model on every channel for basic reachability and latency, and it can also run thirteen functional probes that check things like math, logic, response length, token accounting, and tokenizer fingerprints. The README explains there is a database of more than fifty tokenizer fingerprints used to guess which model family a channel is actually serving, which is meant to catch resellers that swap a cheaper model in behind a premium name. Management happens through a built-in web admin panel with a dashboard, channel CRUD, key management, request logs, scheduled re-detection, response caching, and Telegram, Discord, or HTTP webhook alerts. The panel supports Chinese and English and has a dark mode. Storage is SQLite. There is also a prompt engine that can inject a system prompt and compress conversation history. Deployment targets are Linux and Docker, Node.js 18 or higher. The default admin password is admin123 and the README warns to change it on first login. License is Apache 2.0.

Copy-paste prompts

Prompt 1
Walk me through deploying GateAPI on a Linux VPS with Docker and changing the admin123 default password
Prompt 2
Show me how to add an OpenAI-protocol channel and an Anthropic-protocol channel to GateAPI and route both through /v1/chat/completions
Prompt 3
Explain how GateAPI's 50+ tokenizer fingerprint database identifies which model family a channel is actually serving
Prompt 4
Configure the 13 functional probes in GateAPI to flag a channel when math or logic accuracy drops below a threshold
Prompt 5
Set up Telegram webhook alerts in GateAPI for when a channel's error rate crosses 30 percent
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.