explaingit

sipc/relayapi

11TypeScriptAudience · ops devopsComplexity · 3/5ActiveSetup · moderate

TLDR

Self-hosted Next.js relay that sits between OpenAI-compatible clients and the Codex API, tracking keys, OAuth credentials, channel routing, logs, and quotas in two local SQLite files.

Mindmap

mindmap
  root((RelayAPI))
    Inputs
      OpenAI format requests
      Codex OAuth credentials
      Channel rules
    Outputs
      Proxied responses
      Usage counters
      Audit logs
    Use Cases
      Self-host an OpenAI relay
      Manage Codex credentials
      Route across channels
    Tech Stack
      Next.js
      TypeScript
      Node 24
      SQLite
      Docker

Things people build with this

USE CASE 1

Self-host a relay so multiple tools share one set of Codex OAuth credentials

USE CASE 2

Route requests across channels automatically without the client choosing a key

USE CASE 3

Inspect per-channel usage and audit logs from a Next.js admin UI

USE CASE 4

Run the whole stack from a Docker Compose file with persistent SQLite volumes

Tech stack

Next.jsTypeScriptNode.jsSQLiteDocker

Getting it running

Difficulty · moderate Time to first run · 30min

Needs Node.js 24 for the experimental node:sqlite module or a Docker Compose deploy, and the web admin key is shown in logs only once on first launch.

In plain English

RelayAPI is a self hosted relay service for managing OpenAI compatible and Codex API traffic in one place. The README is written in Chinese and describes the project as a one stop manager for Codex OAuth credentials. It sits between client tools that speak the OpenAI API format and the upstream Codex service, so requests pass through RelayAPI rather than going directly to the provider. The service is built on Next.js using the App Router, and it tracks several things at once: API keys, Codex OAuth credentials, channel routing rules, request logs, and per channel usage data. The README lists automatic channel routing as a feature, meaning the front end does not have to pick which credential to use for each call. Quota refresh for Codex credentials is also handled inside the service. Data is kept in two local SQLite database files, one for configuration and runtime state and one for logs, audit records, and usage counters. The project uses the built in node:sqlite module that ships with Node.js 24, so there is no need to compile a native SQLite binding. The README notes that node:sqlite is still marked experimental in Node, so an experimental warning at startup is expected. The minimum runtime is Node.js 24, and pnpm is listed as the package manager. Image generation requests are explicitly called out as not yet supported. The quick start section shows a Docker Compose file that pulls the sipcink/relay-api:latest image, exposes port 3000, and mounts a named volume at /app/data so the SQLite databases survive container restarts. On first launch RelayAPI prints a generated web access key in the container logs, prefixed with relay_web_. This key is required to open the web admin pages, and once entered the server sets an HTTP only session cookie. The plain key is shown only once. A hashed copy is stored at data/.relay-web-access-key, and if the file is deleted and the service restarted a new key is issued. A fixed key can be supplied through the RELAY_WEB_ACCESS_KEY or WEB_ACCESS_KEY environment variable, in which case the file is not auto created.

Copy-paste prompts

Prompt 1
Spin up RelayAPI with Docker Compose on port 3000 and find the relay_web_ key in the container logs
Prompt 2
Set RELAY_WEB_ACCESS_KEY through an env var so RelayAPI uses a fixed admin key instead of auto generating one
Prompt 3
Add a new channel routing rule in RelayAPI that splits traffic across two Codex credentials by weight
Prompt 4
Inspect the two SQLite databases RelayAPI ships and document the configuration versus logs schema
Prompt 5
Compare RelayAPI to LiteLLM proxy for self-hosted OpenAI-compatible request management
Open on GitHub → Explain another repo

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