← Back to Leaderboard
NQuantumNous

QuantumNous/new-api

Self-hosted Go API gateway for multi-provider model routing, access, and costs

Open-Source AI AppQuickstart ↓
Engineering Health (Methodology)
A+ · 91/100
Maintenance Activity
● Updated yesterday
Latest Release
v1.0.0-rc.52
Commercial License Check
AGPL-3.0 · Copyleft Warning

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption25/25
Release Cadence20/20
License Clarity11/20
DockerSelf-HostedAPI1 README badge views (30d)
Total Stars
★ 52,989
24h Growth
+21
7d Growth
+343
Forks
12,992

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

QuantumNous/new-api Star History (2023-11-09 - 2026-12-04) ALL-TIME STAR HISTORY (2023-11 – 2026-12) +53k in 1121d · avg +47/day 56k 28k 0 2023-11-09: ★ 12024-01-20: ★ 3292024-03-30: ★ 1,2772024-06-08: ★ 1,9392024-08-17: ★ 2,4702024-10-26: ★ 3,1032025-01-04: ★ 4,1302025-03-15: ★ 5,6492025-05-24: ★ 7,2172025-08-02: ★ 8,8252025-10-11: ★ 10,7862025-12-20: ★ 13,3502026-02-28: ★ 18,0452026-05-09: ★ 31,3222026-07-18: ★ 42,0012026-09-26: ★ 48,5412026-12-04: ★ 52,989 ★ 53k 2023-11 2025-05 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

New API is a self-hosted Go/Gin gateway, not an inference engine. Requests enter through router/, middleware/, and controller/ for endpoint handling and access checks. The relay/ layer selects configured channels and adapts traffic to upstream providers; service/ and model/ separate business logic from persistence. The Go backend embeds the built React 19 and TypeScript console from web/dist, so frontend build tooling is not a production service dependency.

RelayKit is an independently buildable Go module for protocol data types and request, response, and streaming conversion. Plugins extend different parts of the gateway: provider plugins introduce upstream channel types, request-processing plugins can act on requests and replies by global, group, channel, or model scope, and JavaScript task plugins handle asynchronous submission, status, and output retrieval.

Key Capabilities & Differentiators

Clients can use OpenAI Chat Completions and Responses, Anthropic Messages, or Gemini endpoints. Upstream choices include OpenAI, Anthropic, Google Gemini, Azure OpenAI, AWS Bedrock, Vertex AI, DeepSeek, and Qwen. Model mappings, priorities, weights, retries, channel affinity, and multiple upstream keys let operators change provider selection without changing every client. Separate endpoints cover embeddings, reranking, images, and audio; Realtime and Responses WebSocket routes need a compatible channel and upstream.

The console manages models, channels, group access, key restrictions, and audit and usage logs. Quotas, subscriptions, cache accounting, and expression-based pricing help allocate costs across users and usage tiers. Streaming, tool calls, reasoning, and multimodal input depend on the model and conversion path. An endpoint being available is not evidence that every provider-specific field or tool behaves identically.

Trade-offs & Limitations

Compared with direct provider SDKs, New API centralizes routing, access, and accounting, but inserts another hop and a shared point of failure. A thin reverse proxy is simpler if the goal is only a stable URL or transparent forwarding. New API earns its operational cost when clients need model-aware routing and shared governance. Validate streaming, tool schemas, and usage accounting for each conversion path you depend on before treating providers as interchangeable.

Self-hosting gives operators control of the gateway and its records, not offline inference or guaranteed local data residency: requests still go to the configured upstreams. The AGPLv3 and additional Section 7 terms matter for modified deployments, including source availability for network users and preservation of attribution and the visible project link in modified UIs. Adding community plugins also expands what operators must review before granting code access to request or response data.

Hardware & Deployment Guide

For a local trial, run the container on Linux amd64 or arm64, bind 127.0.0.1:3000, and mount /data for SQLite. The supplied Compose stack uses PostgreSQL and Redis by default; MySQL is a main-store alternative, and LOG_SQL_DSN can separate logs, including to ClickHouse. For production, replace example passwords, pin a tested image instead of relying on latest, and serve the console over HTTPS with SESSION_COOKIE_SECURE, the exact trusted HTTPS origin, and explicit TRUSTED_PROXIES. Cluster nodes need the same persistent SESSION_SECRET; nodes sharing Redis also need the same effective CRYPTO_SECRET. Use shared Redis when rate limits must span nodes.

A source build requires Bun to produce web/dist before building the backend with the Go version specified in go.mod. For release selection, rc.50 introduced provider and request-processing plugins and migrated legacy sensitive-word settings to a request-filter instance. Rolling back that migration requires re-entering the legacy settings to restore filtering. rc.51 fixed rc.50 request-time crashes on x86-64 machines with AES-NI but without AVX. rc.52 added per-channel provider plugin route switches and a Responses-to-Anthropic Messages conversion path for advanced custom channels and provider plugins.

Protocol conversion: RelayKit handles requests, responses, and streams across OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Gemini.
Model-aware routing: Model mappings, weighted channel priorities, retries, affinity, and multiple upstream keys give operators control over upstream selection.
Access controls: Group and model permissions and API-key restrictions sit alongside OAuth/OIDC, passkeys, two-factor authentication, and session management.
Cost accounting: Usage logs, quotas, subscriptions, cache accounting, and expression-based prices support usage-based cost allocation.
Plugin scopes: Provider plugins add channel types, request-processing plugins can apply at several scopes, and JavaScript task plugins expose submission and status APIs.
Storage choices: SQLite supports a single-container trial; PostgreSQL or MySQL can back the main store, shared Redis can coordinate rate limits, and ClickHouse is an option for separate logs.
Best For

Teams operating several authorized model APIs that want a stable client endpoint, centrally managed keys and quotas, and usage-based cost allocation.

Skip If

You need local or offline inference, depend on exact provider-native behavior across every feature, or have one upstream and no need for shared access controls or accounting.

Reviewed on 2026-12-03 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

DockerSelf-HostedAPI
mkdir -p data
docker run --name new-api -d --restart unless-stopped \
  -p 127.0.0.1:3000:3000 \
  -e TZ=Asia/Shanghai \
  -v "$(pwd)/data:/data" \
  calciumion/new-api:latest

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
new-api ★53k+343GoAGPL-3.0Self-hosted Go API gateway for multi-provider model routing, access, and costs
gpt-load7.2k+6GoMITSelf-hosted Go gateway for routing LLM traffic across providers and credentials
bifrost10.2k+125GoApache-2.0Self-hosted Go gateway for routing and governing multi-provider LLM traffic
one-api37.5k+56JavaScriptMITSelf-hosted OpenAI-compatible gateway for LLM routing and API key management

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/QuantumNous/new-api.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

QuantumNous/new-api Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about new-api

How do I connect an existing client without sharing the upstream API key?

Create and test a channel with an authorized upstream key, enable the models for the intended group, configure pricing, and give the user quota or a valid subscription. Point an OpenAI-compatible client at http://localhost:3000/v1 for a local deployment and authenticate with a New API-issued key, not the provider key. Check /v1/models, then test the endpoint and features the client actually uses.

Does the gateway need a GPU, and what should I size for?

The Go gateway forwards requests to upstream inference services; it does not require a GPU to load model weights. Start with one container and SQLite for evaluation. For production sizing, measure CPU and memory under representative concurrent streams, check network throughput and latency to upstreams, and size database storage and write capacity for usage and audit logs. There is no verified capacity figure to size from.

Can we self-host New API for commercial use?

Yes, subject to the AGPLv3 and the project's additional Section 7 terms. If you modify the program and let users interact with it over a network, the AGPLv3 requires offering those users access to the corresponding source of the modified version. Modified versions must retain the specified attribution, and modified versions with a UI must retain a visible link to the original project. For a public or resale service, separately verify upstream authorization and applicable regulatory obligations; the software license does not grant redistribution rights to upstream API access.

When is New API preferable to direct SDK calls or a thin reverse proxy?

Use a direct provider SDK when one provider is sufficient and access to its native fields and features is the priority. A thin reverse proxy can be enough if you only need a stable URL or transport-level forwarding. New API is a better fit when you need model-aware routing, group and key controls, and usage accounting at the same endpoint. It adds configuration and an operational dependency, so test compatibility on the actual channels before migrating.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining QuantumNous/new-api? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature QuantumNous/new-api on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare