QuantumNous/new-api
A unified AI model hub for aggregation & distribution. It supports cross-converting various LLMs into OpenAI-compatible, Claude-compatible, or Gemini-compatible formats. A centralized gateway for personal and enterprise model management.
New API – A Self‑Hosted AI Gateway
What it is – New API is an open‑source, self‑hosted gateway that sits between your applications (or AI agents) and various large‑language‑model providers. It presents a single, consistent OpenAI‑compatible HTTP API while handling routing, usage tracking, access control, pricing, and multi‑model management.
Key capabilities
- Multi‑provider support – Connect upstream services such as OpenAI, Anthropic, Google Gemini, Azure OpenAI, AWS Bedrock, Vertex AI, DeepSeek, Qwen, etc.
- Unified endpoints – Exposes familiar OpenAI‑style routes (
/v1/chat/completions,/v1/messages,/v1/embeddings, image/audio generation, WebSocket realtime, etc.) plus a plugin task system. - Routing & fail‑over – Define channel priorities, weights, retries, and affinity to automatically balance or switch providers.
- Usage & cost accounting – Track token usage, cache accounting, quotas, subscriptions, and expression‑based pricing per tier.
- Fine‑grained access control – Users, groups, API‑key scopes, OAuth/OIDC, passkeys, 2FA, and session management.
- Extensible task plugins – JavaScript plugins let you add custom asynchronous jobs (e.g., image processing, video generation) with status endpoints.
- Web console – A multilingual React‑based UI for configuring models, viewing dashboards, managing users, and testing the API.
How to get started
- Run with Docker – A single‑command Docker run spins up New API with an SQLite store.
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 - Open
http://localhost:3000, run the setup wizard, add an upstream channel (e.g., your OpenAI key), and create an API key. - Point your client to
http://localhost:3000/v1and use the issued key just like you would with the original provider.
Deployment options
- Docker‑Compose – Includes PostgreSQL + Redis (or MySQL/ClickHouse) for production‑grade persistence and rate‑limiting.
- Configurable storage – SQLite, MySQL, PostgreSQL, optional separate log DB, optional Redis cache.
- Environment variables control DB connections, secrets, cookie security, trusted proxies, etc.
- Multi‑node setups share the main DB and secret keys; Redis can be used for shared rate limits.
Development
- Backend: Go + Gin framework.
- Frontend: React 19, TypeScript, Tailwind 4, built with Bun.
relaykit– a Go module that normalises the four major text protocols.- Plugins live under
plugins/tasks/; write JavaScript plugins following the Task Plugin API v1. - Build steps:
bun install && bun run buildfor the UI, thengo run .for the server, or use the providedmake devworkflow.
Documentation & community
- Full docs: https://docs.newapi.ai/en/docs (installation, API reference, guides).
- Community FAQ, discussion, and issue tracker on GitHub.
- Contributions welcome for translations, new provider adapters, tests, and plugins.
License – AGPL‑v3 with additional attribution requirements.
In short, New API lets teams host their own “one‑stop shop” for LLM access, giving them control over costs, security, and provider choice while keeping the familiar OpenAI‑style API.
Related
- Project
- Project
- Project
- Project
- Project